sm.terrainTile
Reads .tile file data
Constants:
Functions:
getAssetsForCell getClutterIdxAt getColorAt getContentFromPrefab getCreationsForCell getCreatorId getDecalsForCell getHarvestablesForCell getHeightAt getKinematicsForCell getMaterialAt getNodesForCell getPrefabsForCell getSize getTileUuid
sm.terrainTile.loadFlags table
Prefab content load flags.
| creations |
| nodes |
| assets |
| decals |
| harvestables |
| kinematics |
| voxelMeshes |
| all |
sm.terrainTile.getAssetsForCell(tileUid, cellOffsetX, cellOffsetY, sizeLevel)
Returns a table of all assets in a terrain cell.
Parameters:
| Type | Name | Description |
| Uuid | tileUid | The tile uuid. |
| integer | cellOffsetX | The cell X offset. |
| integer | cellOffsetY | The cell Y offset. |
| integer | sizeLevel | The size level of asset. [0-3] |
Returns:
| Type | Description |
| table | A table { { uuid = Uuid, pos = Vec3, rot = Quat, colors = { string = Color, ...}, tags = { string, ... } }, ... } of assets in the cell. |
sm.terrainTile.getClutterIdxAt(tileUid, cellOffsetX, cellOffsetY, x, y)
Returns the clutter index at position (x,y) in a tile cell.
Parameters:
| Type | Name | Description |
| Uuid | tileUid | The tile uuid. |
| integer | cellOffsetX | The cell X offset. |
| integer | cellOffsetY | The cell Y offset. |
| integer | x | The local X value. |
| integer | y | The local Y value. |
Returns:
| Type | Description |
| integer | The clutter index. |
sm.terrainTile.getColorAt(tileUid, cellOffsetX, cellOffsetY, lod, x, y)
Returns the terrain color at position (x,y) in a tile cell.
Parameters:
| Type | Name | Description |
| Uuid | tileUid | The tile uuid. |
| integer | cellOffsetX | The cell X offset. |
| integer | cellOffsetY | The cell Y offset. |
| integer | lod | The level of detail. [0-5] |
| integer | x | The local X value. |
| integer | y | The local Y value. |
Returns:
| Type | Description |
| number,number,number | The color R, G, B values. |
sm.terrainTile.getContentFromPrefab(prefabPath, loadFlags?)
Returns the content of a prefab.
Return value 1: A table of creations in the prefab. { { name = string, pos = Vec3, rot = Quat, sortingIndex = integer, tags = { string, ... } }, ... }
Return value 2: A table of prefabs in the prefab. { { name = string, pos = Vec3, rot = Vec3, scale = Vec3, tags = { string, ... }, flags = integer }, ... }
Return value 3: A table of nodes in the prefab. { { pos = Vec3, rot = Quat, scale = Vec3, tags = { string, ... }, params = table } }
Return value 4: A table of assets in the prefab. { { uuid = Uuid, pos = Vec3, rot = Quat, slopeNormal = Vec3, colors = { string = Color, ...}, tags = { string, ... } }, ... }
Return value 5: A table of decals in the prefab. { { pos = Vec3, rot = Vec3, scale = Vec3, decalId = integer, color = Color, layer = integer, tags = { string, ... } }, ... }
Return value 6: A table of harvestables in the prefab. { {uuid = Uuid, pos = Vec3, rot = Quat, color = Color, params = table, tags = { string, ... } }, ... }
Return value 7: A table of kinematics in the prefab. { {uuid = Uuid, pos = Vec3, rot = Quat, scale = Vec3, color = Color, params = table, tags = { string, ... } }, .. }
Return value 8: A table containing the min and max bounds of the prefab. { min = Vec3, max = Vec3 }
Parameters:
| Type | Name | Description |
| string | prefabPath | The path to the prefab file. |
| integer | loadFlags? | A mask of content to load. Defaults to all objects (optional) |
Returns:
| Type | Description |
| table,table,table,table,table,table,table,table | Prefab content tables. |
sm.terrainTile.getCreationsForCell(tileUid, cellOffsetX, cellOffsetY)
Returns a table of all creations in a terrain cell.
Parameters:
| Type | Name | Description |
| Uuid | tileUid | The tile uuid. |
| integer | cellOffsetX | The cell X offset. |
| integer | cellOffsetY | The cell Y offset. |
Returns:
| Type | Description |
| table | A table { { pathOrJson = string, pos = Vec3, rot = Quat }, ... } of creations in the cell. |
sm.terrainTile.getCreatorId(path)
Returns the id of the tiles creator.
Parameters:
| Type | Name | Description |
| string | path | The tile's path. |
Returns:
| Type | Description |
| string | The creator's id. |
sm.terrainTile.getDecalsForCell(tileUid, cellOffsetX, cellOffsetY)
Returns all decals for a cell in a tile.
Parameters:
| Type | Name | Description |
| Uuid | tileUid | The tile uuid. |
| integer | cellOffsetX | The cell X offset. |
| integer | cellOffsetY | The cell Y offset. |
Returns:
| Type | Description |
| table | A table { { pos = Vec3, rot = Vec3, scale = Vec3, decalId = integer, color = Color, layer = integer, tags = { string, ... } }, ... } of decals in the cell. |
sm.terrainTile.getHarvestablesForCell(tileUid, cellOffsetX, cellOffsetY, sizeLevel)
Returns a table of all harvestables in a terrain cell.
Parameters:
| Type | Name | Description |
| Uuid | tileUid | The tile uuid. |
| integer | cellOffsetX | The cell X offset. |
| integer | cellOffsetY | The cell Y offset. |
| integer | sizeLevel | The size level of harvestables. [0-3] |
Returns:
| Type | Description |
| table | A table { {uuid = Uuid, pos = Vec3, rot = Quat, color = Color, params = table, tags = { string, ... } }, ... } of harvestables in the cell. |
sm.terrainTile.getHeightAt(tileUid, cellOffsetX, cellOffsetY, lod, x, y)
Returns the terrain height at position (x,y) in a tile cell.
Parameters:
| Type | Name | Description |
| Uuid | tileUid | The tile uuid. |
| integer | cellOffsetX | The cell X offset. |
| integer | cellOffsetY | The cell Y offset. |
| integer | lod | The level of detail. [0-5] |
| integer | x | The local X value. |
| integer | y | The local Y value. |
Returns:
| Type | Description |
| number | The height. |
sm.terrainTile.getKinematicsForCell(tileUid, cellOffsetX, cellOffsetY, sizeLevel)
Returns a table of all kinematics in a terrain cell.
Parameters:
| Type | Name | Description |
| Uuid | tileUid | The tile uuid. |
| integer | cellOffsetX | The cell X offset. |
| integer | cellOffsetY | The cell Y offset. |
| integer | sizeLevel | The size level of kinematics. [0-3] |
Returns:
| Type | Description |
| table | A table { {uuid = Uuid, pos = Vec3, rot = Quat, scale = Vec3, color = Color, params = table, tags = { string, ... } }, .. } of kinematics in the cell. |
sm.terrainTile.getMaterialAt(tileUid, cellOffsetX, cellOffsetY, lod, x, y)
Returns the terrain material at position (x,y) in a tile cell.
Parameters:
| Type | Name | Description |
| Uuid | tileUid | The tile uuid. |
| integer | cellOffsetX | The cell X offset. |
| integer | cellOffsetY | The cell Y offset. |
| integer | lod | The level of detail. [0-5] |
| integer | x | The local X value. |
| integer | y | The local Y value. |
Returns:
| Type | Description |
| number,number,number,number,number,number,number,number | Material weights 1-8. |
sm.terrainTile.getNodesForCell(tileUid, cellOffsetX, cellOffsetY)
Returns all nodes for a cell in a tile.
Parameters:
| Type | Name | Description |
| Uuid | tileUid | The tile uuid. |
| integer | cellOffsetX | The cell X offset. |
| integer | cellOffsetY | The cell Y offset. |
Returns:
| Type | Description |
| table | A table { { pos = Vec3, rot = Quat, scale = Vec3, tags = { string, ... }, params = table } } of nodes in the cell. |
sm.terrainTile.getPrefabsForCell(tileUid, cellOffsetX, cellOffsetY)
Returns all prefabs in a cell.
Parameters:
| Type | Name | Description |
| Uuid | tileUid | The tile uuid. |
| integer | cellOffsetX | The cell X offset. |
| integer | cellOffsetY | The cell Y offset. |
Returns:
| Type | Description |
| table | A table { { name = string, pos = Vec3, rot = Vec3, scale = Vec3, tags = { string, ... }, flags = integer }, ... } of prefabs in the cell. |
sm.terrainTile.getSize(path)
Returns the size of a tile as the number of cells along one of the axises.
Parameters:
| Type | Name | Description |
| string | path | The tile's path. |
Returns:
| Type | Description |
| integer | The size. |
sm.terrainTile.getTileUuid(path)
Returns the uuid for a tile file.
Parameters:
| Type | Name | Description |
| string | path | The tile's path. |
Returns:
| Type | Description |
| Uuid | The tile's uuid. |