Skip to content

modules_util_serialized

Source: base/tealdef/scripts/construction/modules_util_serialized.d.tl

Notes

Types of the module helpers in /scripts/construction/modulesutil.lua (ModulesUtilSerialized) used by modular constructions and their module scripts.

ModulesUtilSerialized

record global base/tealdef/scripts/construction/modules_util_serialized.d.tl:3

global record ModulesUtilSerialized

Notes

Module helpers from /scripts/construction/modulesutil.lua.

Functions

addCosts(result : ConstructionUtilSerialized.ConstructionResult, mod : ConstructionUtilSerialized.ModuleUpdateFnParams.Module) base/tealdef/scripts/construction/modules_util_serialized.d.tl:4

Notes

Adds a module's metadata.price, metadata.maintenanceCost and metadata.bulldozePrice to the result's cost, maintenanceCost and bulldozeCost.

Details

The construction script calls this automatically after running each module's update script.

TransformAlignmentFaces(transf : Mat4Serialized.Mat4, terrainAlignmentLists : {ConstructionUtilSerialized.TerrainAlignmentList}) base/tealdef/scripts/construction/modules_util_serialized.d.tl:5

Notes

Transforms the points of all faces (and triangles) of the terrain alignment lists in place with transf.

Example

-- from base/content/landmarks/hq/hq/headquarter.script.tl
modulesutil.TransformAlignmentFaces(transf2, terrainAlignmentLists)
table.insert(result.subconstructions[1].terrainAlignmentLists, terrainAlignmentLists[1])

addGroundFaces(groundTexture : string, data : any, result : ConstructionUtilSerialized.SubConstruction, transform : Mat4Serialized.Mat4) base/tealdef/scripts/construction/modules_util_serialized.d.tl:6

Notes

Adds a ground face filled with groundTexture from the static.curves.ground_face curve of the generated data, with texture coordinates stretched over its bounding box.

Parameter Type Description
groundTexture string Ground texture key, e.g. a .gtex file.
data any Generated data with a static group.
result ConstructionUtilSerialized.SubConstruction Subconstruction (or result) whose groundFaces receive the face.
transform Mat4Serialized.Mat4 Optional transform applied to the points first.