sm.terrainTile
Reads .tile file data
Functions:
getAssetsForCell getClutterIdxAt getColorAt getContentFromPrefab getCreationsForCell getCreatorId getDecalsForCell getHarvestablesForCell getHeightAt getKinematicsForCell getMaterialAt getNodesForCell getPrefabsForCell getSize getTileUuid
sm.terrainTile.getAssetsForCell(tileId, tileOffsetX, tileOffsetY, sizeLevel)
Returns a table of all assets in a terrain cell.
Parameters:
Type | Name | Description |
Uuid | tileId | The tile id. |
integer | tileOffsetX | The tile offset X. |
integer | tileOffsetY | The tile offset Y. |
integer | sizeLevel | The size level of asset. |
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(tileId, tileOffsetX, tileOffsetY, x, y)
Returns the clutter index at position (X,Y) in a tile.
Parameters:
Type | Name | Description |
integer | tileId | The tile id. |
integer | tileOffsetX | The tile offset X. |
integer | tileOffsetY | The tile offset Y. |
integer | x | The X. |
integer | y | The Y. |
Returns:
Type | Description |
number | The clutter index. |
sm.terrainTile.getColorAt(tileId, tileOffsetX, tileOffsetY, lod, x, y)
Returns the terrain color at position (X,Y) in a tile.
Parameters:
Type | Name | Description |
integer | tileId | The tile id. |
integer | tileOffsetX | The tile offset X. |
integer | tileOffsetY | The tile offset Y. |
integer | lod | The level of detail. |
integer | x | The X. |
integer | y | The Y. |
Returns:
Type | Description |
number | The color R value. |
number | The color G value. |
number | The color B value. |
sm.terrainTile.getContentFromPrefab(prefabPath, loadFlags)
Returns the content of prefab.
Parameters:
Type | Name | Description |
string | prefabPath | The path to the prefab file. |
integer | loadFlags | A mask of content to load |
Returns:
Type | Description |
table | A table { { name = string, pos = Vec3, rot = Quat, sortingIndex = integer, tags = { string, ... } }, ... } of creations in the prefab. |
table | A table { { name = string, pos = Vec3, rot = Vec3, scale = Vec3, tags = { string, ... }, flags = integer }, ... } of prefabs in the prefab. |
table | A table { { pos = Vec3, rot = Quat, scale = Vec3, tags = { string, ... }, params = table } } of nodes in the prefab. |
table | A table { { uuid = Uuid, pos = Vec3, rot = Quat, slopeNormal = Vec3, colors = { string = Color, ...}, tags = { string, ... } }, ... } of assets in the prefab. |
table | A table { { pos = Vec3, rot = Vec3, scale = Vec3, decalId = integer, color = Color, layer = integer, tags = { string, ... } }, ... } of decals in the prefab. |
table | A table { {uuid = Uuid, pos = Vec3, rot = Quat, color = Color, params = table, tags = { string, ... } }, ... } of harvestables in the prefab. |
table | A table { {uuid = Uuid, pos = Vec3, rot = Quat, scale = Vec3, color = Color, params = table, tags = { string, ... } }, .. } of kinematics in the prefab. |
sm.terrainTile.getCreationsForCell(tileId, tileOffsetX, tileOffsetY)
Returns a table of all creations in a terrain cell.
Parameters:
Type | Name | Description |
Uuid | tileId | The tile id. |
integer | tileOffsetX | The tile offset X. |
integer | tileOffsetY | The tile offset Y. |
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(id, X-offset, Y-offset)
Returns all decals for a cell in a tile.
Parameters:
Type | Name | Description |
Uuid | id | The tile id |
integer | X-offset | The offset along the X axis |
integer | Y-offset | The offset along the Y axis |
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(tileId, tileOffsetX, tileOffsetY, sizeLevel)
Returns a table of all harvestables in a terrain cell.
Parameters:
Type | Name | Description |
Uuid | tileId | The tile id. |
integer | tileOffsetX | The tile offset X. |
integer | tileOffsetY | The tile offset Y. |
integer | sizeLevel | The size level of harvestables. |
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(tileId, tileOffsetX, tileOffsetY, lod, x, y)
Returns the terrain height at position (X,Y) in a tile.
Parameters:
Type | Name | Description |
integer | tileId | The tile id. |
integer | tileOffsetX | The tile offset X. |
integer | tileOffsetY | The tile offset Y. |
integer | lod | The level of detail. |
integer | x | The X. |
integer | y | The Y. |
Returns:
Type | Description |
number | The height. |
sm.terrainTile.getKinematicsForCell(tileId, tileOffsetX, tileOffsetY, sizeLevel)
Returns a table of all kinematics in a terrain cell.
Parameters:
Type | Name | Description |
Uuid | tileId | The tile id. |
integer | tileOffsetX | The tile offset X. |
integer | tileOffsetY | The tile offset Y. |
integer | sizeLevel | The size level of kinematics. |
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(tileId, tileOffsetX, tileOffsetY, lod, x, y)
Returns the terrain material at position (X,Y) in a tile.
Parameters:
Type | Name | Description |
integer | tileId | The tile id. |
integer | tileOffsetX | The tile offset X. |
integer | tileOffsetY | The tile offset Y. |
integer | lod | The level of detail. |
integer | x | The X. |
integer | y | The Y. |
Returns:
Type | Description |
number | The first R value. |
number | The first G value. |
number | The first B value. |
number | The first A value. |
number | The second R value. |
number | The second G value. |
number | The second B value. |
number | The second A value. |
sm.terrainTile.getNodesForCell(id, X-offset, Y-offset)
Returns all nodes for a cell in a tile.
Parameters:
Type | Name | Description |
Uuid | id | The tile id |
integer | X-offset | The offset along the X axis |
integer | Y-offset | The offset along the Y axis |
Returns:
Type | Description |
table | A table { { pos = Vec3, rot = Quat, scale = Vec3, tags = { string, ... }, params = table } } of nodes in the cell. |
sm.terrainTile.getPrefabsForCell(tileId, X-offset, Y-offset)
Returns all prefabs in a cell.
Parameters:
Type | Name | Description |
Uuid | tileId | The tile id. |
integer | X-offset | The offset along the X axis. |
integer | Y-offset | The offset along the Y axis. |
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. |