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:

    TypeNameDescription
    UuidtileIdThe tile id.
    integertileOffsetXThe tile offset X.
    integertileOffsetYThe tile offset Y.
    integersizeLevelThe size level of asset.

    Returns:

    TypeDescription
    tableA 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:

    TypeNameDescription
    integertileIdThe tile id.
    integertileOffsetXThe tile offset X.
    integertileOffsetYThe tile offset Y.
    integerxThe X.
    integeryThe Y.

    Returns:

    TypeDescription
    numberThe clutter index.

    sm.terrainTile.getColorAt(tileId, tileOffsetX, tileOffsetY, lod, x, y)

    Returns the terrain color at position (X,Y) in a tile.

    Parameters:

    TypeNameDescription
    integertileIdThe tile id.
    integertileOffsetXThe tile offset X.
    integertileOffsetYThe tile offset Y.
    integerlodThe level of detail.
    integerxThe X.
    integeryThe Y.

    Returns:

    TypeDescription
    numberThe color R value.
    numberThe color G value.
    numberThe color B value.

    sm.terrainTile.getContentFromPrefab(prefabPath, loadFlags)

    Returns the content of prefab.

    Parameters:

    TypeNameDescription
    stringprefabPathThe path to the prefab file.
    integerloadFlagsA mask of content to load

    Returns:

    TypeDescription
    tableA table { { name = string, pos = Vec3, rot = Quat, sortingIndex = integer, tags = { string, ... } }, ... } of creations in the prefab.
    tableA table { { name = string, pos = Vec3, rot = Vec3, scale = Vec3, tags = { string, ... }, flags = integer }, ... } of prefabs in the prefab.
    tableA table { { pos = Vec3, rot = Quat, scale = Vec3, tags = { string, ... }, params = table } } of nodes in the prefab.
    tableA table { { uuid = Uuid, pos = Vec3, rot = Quat, slopeNormal = Vec3, colors = { string = Color, ...}, tags = { string, ... } }, ... } of assets in the prefab.
    tableA table { { pos = Vec3, rot = Vec3, scale = Vec3, decalId = integer, color = Color, layer = integer, tags = { string, ... } }, ... } of decals in the prefab.
    tableA table { {uuid = Uuid, pos = Vec3, rot = Quat, color = Color, params = table, tags = { string, ... } }, ... } of harvestables in the prefab.
    tableA 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:

    TypeNameDescription
    UuidtileIdThe tile id.
    integertileOffsetXThe tile offset X.
    integertileOffsetYThe tile offset Y.

    Returns:

    TypeDescription
    tableA table { { pathOrJson = string, pos = Vec3, rot = Quat }, ... } of creations in the cell.

    sm.terrainTile.getCreatorId(path)

    Returns the id of the tiles creator.

    Parameters:

    TypeNameDescription
    stringpathThe tile's path.

    Returns:

    TypeDescription
    stringThe creator's id.

    sm.terrainTile.getDecalsForCell(id, X-offset, Y-offset)

    Returns all decals for a cell in a tile.

    Parameters:

    TypeNameDescription
    UuididThe tile id
    integerX-offsetThe offset along the X axis
    integerY-offsetThe offset along the Y axis

    Returns:

    TypeDescription
    tableA 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:

    TypeNameDescription
    UuidtileIdThe tile id.
    integertileOffsetXThe tile offset X.
    integertileOffsetYThe tile offset Y.
    integersizeLevelThe size level of harvestables.

    Returns:

    TypeDescription
    tableA 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:

    TypeNameDescription
    integertileIdThe tile id.
    integertileOffsetXThe tile offset X.
    integertileOffsetYThe tile offset Y.
    integerlodThe level of detail.
    integerxThe X.
    integeryThe Y.

    Returns:

    TypeDescription
    numberThe height.

    sm.terrainTile.getKinematicsForCell(tileId, tileOffsetX, tileOffsetY, sizeLevel)

    Returns a table of all kinematics in a terrain cell.

    Parameters:

    TypeNameDescription
    UuidtileIdThe tile id.
    integertileOffsetXThe tile offset X.
    integertileOffsetYThe tile offset Y.
    integersizeLevelThe size level of kinematics.

    Returns:

    TypeDescription
    tableA 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:

    TypeNameDescription
    integertileIdThe tile id.
    integertileOffsetXThe tile offset X.
    integertileOffsetYThe tile offset Y.
    integerlodThe level of detail.
    integerxThe X.
    integeryThe Y.

    Returns:

    TypeDescription
    numberThe first R value.
    numberThe first G value.
    numberThe first B value.
    numberThe first A value.
    numberThe second R value.
    numberThe second G value.
    numberThe second B value.
    numberThe second A value.

    sm.terrainTile.getNodesForCell(id, X-offset, Y-offset)

    Returns all nodes for a cell in a tile.

    Parameters:

    TypeNameDescription
    UuididThe tile id
    integerX-offsetThe offset along the X axis
    integerY-offsetThe offset along the Y axis

    Returns:

    TypeDescription
    tableA 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:

    TypeNameDescription
    UuidtileIdThe tile id.
    integerX-offsetThe offset along the X axis.
    integerY-offsetThe offset along the Y axis.

    Returns:

    TypeDescription
    tableA 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:

    TypeNameDescription
    stringpathThe tile's path.

    Returns:

    TypeDescription
    integerThe size.

    sm.terrainTile.getTileUuid(path)

    Returns the uuid for a tile file.

    Parameters:

    TypeNameDescription
    stringpathThe tile's path.

    Returns:

    TypeDescription
    UuidThe tile's uuid.