setFoliageSurface
Client-side
Changes which GTA surface type a foliage patch grows, rebuilding the native triangle.
Syntax
bool setFoliageSurface(foliage theFoliage, int surface)Arguments
theFoliagefoliageFoliage element.
surfaceintSurface ID from 0 through 255 with plant properties defined.
Returns
true when the surface was accepted and the patch rebuilt; false for an out-of-range surface or one with no plant properties.
Ownership and lifecycle
A foliage element belongs to the resource that created it and joins its element group, so stopping the resource removes its patches without explicit cleanup. Every setter rebuilds the native triangle atomically and rolls back to the previous state when the new combination is rejected.
Important behavior
- The rebuild is atomic: a rejected surface leaves the patch on its previous one.
OOP aliases
foliage:setSurface(surface)foliage.surface
Where this comes from
SOURCECLuaFoliageDefs.cppClient/mods/deathmatch/logic/luadefs/CLuaFoliageDefs.cpp INTRODUCED / EXTENDED29e4398beRead the commit and why the change was made TEST RESOURCE foliage-test test-resources/foliage-test
RELATED NEON APIS
Read the system guide →