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:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe cell X offset.
    integercellOffsetYThe cell Y offset.
    integersizeLevelThe size level of asset. [0-3]

    Returns:

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

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe cell X offset.
    integercellOffsetYThe cell Y offset.
    integerxThe local X value.
    integeryThe local Y value.

    Returns:

    TypeDescription
    integerThe clutter index.

    sm.terrainTile.getColorAt(tileUid, cellOffsetX, cellOffsetY, lod, x, y)

    Returns the terrain color at position (x,y) in a tile cell.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe cell X offset.
    integercellOffsetYThe cell Y offset.
    integerlodThe level of detail. [0-5]
    integerxThe local X value.
    integeryThe local Y value.

    Returns:

    TypeDescription
    number,number,numberThe 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:

    TypeNameDescription
    stringprefabPathThe path to the prefab file.
    integerloadFlags?A mask of content to load. Defaults to all objects (optional)

    Returns:

    TypeDescription
    table,table,table,table,table,table,table,tablePrefab content tables.

    sm.terrainTile.getCreationsForCell(tileUid, cellOffsetX, cellOffsetY)

    Returns a table of all creations in a terrain cell.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe cell X offset.
    integercellOffsetYThe cell Y offset.

    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(tileUid, cellOffsetX, cellOffsetY)

    Returns all decals for a cell in a tile.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe cell X offset.
    integercellOffsetYThe cell Y offset.

    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(tileUid, cellOffsetX, cellOffsetY, sizeLevel)

    Returns a table of all harvestables in a terrain cell.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe cell X offset.
    integercellOffsetYThe cell Y offset.
    integersizeLevelThe size level of harvestables. [0-3]

    Returns:

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

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe cell X offset.
    integercellOffsetYThe cell Y offset.
    integerlodThe level of detail. [0-5]
    integerxThe local X value.
    integeryThe local Y value.

    Returns:

    TypeDescription
    numberThe height.

    sm.terrainTile.getKinematicsForCell(tileUid, cellOffsetX, cellOffsetY, sizeLevel)

    Returns a table of all kinematics in a terrain cell.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe cell X offset.
    integercellOffsetYThe cell Y offset.
    integersizeLevelThe size level of kinematics. [0-3]

    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(tileUid, cellOffsetX, cellOffsetY, lod, x, y)

    Returns the terrain material at position (x,y) in a tile cell.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe cell X offset.
    integercellOffsetYThe cell Y offset.
    integerlodThe level of detail. [0-5]
    integerxThe local X value.
    integeryThe local Y value.

    Returns:

    TypeDescription
    number,number,number,number,number,number,number,numberMaterial weights 1-8.

    sm.terrainTile.getNodesForCell(tileUid, cellOffsetX, cellOffsetY)

    Returns all nodes for a cell in a tile.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe cell X offset.
    integercellOffsetYThe cell Y offset.

    Returns:

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

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe cell X offset.
    integercellOffsetYThe cell Y offset.

    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.