sm.cell

The cell api exposes and expands on parts of the world loading process.

These methods are commonly called from cell loading callbacks in World type scripts.

Functions:

  • getHarvestables
  • getInteractablesByAnyUuid
  • getInteractablesByTag
  • getInteractablesByTags
  • getInteractablesByUuid
  • getNodesByTag
  • getNodesByTags
  • getTags

  • sm.cell.getHarvestables(x, y, size)

    Server only

    Returns a table of harvestables of a given size for a cell coordinate.

    Sizes are:

    0: Tiny - plants and crops.

    1: Small - small trees and rocks.

    2: Medium - medium trees, visible at a long distance.

    3: Large - large trees, visible at a very long distance.

    Parameters:

    TypeNameDescription
    integerxThe X-coordinate.
    integeryThe Y-coordinate.
    integersizeSize of harvestable (defaults to any size).

    Returns:

    TypeDescription
    tableA table {harvestable, ...} of harvestables.

    sm.cell.getInteractablesByAnyUuid(x, y, uuids)

    Server only

    Returns a table of interactables which matches any of the given uuids for a cell coordinate.

    Note:

    Can only be used in a server_onCellLoaded callback.

    Parameters:

    TypeNameDescription
    integerxThe X-coordinate.
    integeryThe Y-coordinate.
    tableuuidsA table {Uuid, ...} of uuids to match interactables against.

    Returns:

    TypeDescription
    tableA table {interactable} of found interactables with matching uuid.

    sm.cell.getInteractablesByTag(x, y, tags)

    Server only

    Returns a table of interactables which contain the given tag for a cell coordinate.

    Note:

    Can only be used in a server_onCellLoaded callback.

    Parameters:

    TypeNameDescription
    integerxThe X-coordinate.
    integeryThe Y-coordinate.
    tabletagsA table {string, ...} of tags to match with.

    Returns:

    TypeDescription
    tableA table {interactable, ...} of found interactables with matching tag.

    sm.cell.getInteractablesByTags(x, y, tags)

    Server only

    Returns a table of interactables which contain all of the given tags for a cell coordinate.

    Note:

    Can only be used in a server_onCellLoaded callback

    Parameters:

    TypeNameDescription
    integerxThe X-coordinate
    integeryThe Y-coordinate
    tabletagsA table {string, ...} of tags to match with.

    Returns:

    TypeDescription
    tableA table {interactable, ...} of found interactables with matching tags

    sm.cell.getInteractablesByUuid(x, y, uuid)

    Server only

    Returns a table of interactables of a given uuid for a cell coordinate.

    Note:

    Can only be used in a server_onCellLoaded callback.

    Parameters:

    TypeNameDescription
    integerxThe X-coordinate.
    integeryThe Y-coordinate.
    UuiduuidThe uuid of the interactable(s)

    Returns:

    TypeDescription
    tableA table {interactable, ...} of found interactables with matching uuid.

    sm.cell.getNodesByTag(x, y, tag)

    Returns a table of nodes which contains the given tag for a cell coordinate.

    Parameters:

    TypeNameDescription
    integerxX-coordinate.
    integeryY-coordinate.
    stringtagTag to match with.

    Returns:

    TypeDescription
    tableTable containing { position = Vec3, rotation = Quat, scale = Vec3, tags = {string, ...}, params = table } for each node.

    sm.cell.getNodesByTags(x, y, tags)

    Returns a table of nodes which contain all of the given tags for a cell coordinate.

    Parameters:

    TypeNameDescription
    integerxX-coordinate.
    integeryY-coordinate.
    tabletagsA table {string, ...} of tags to match with.

    Returns:

    TypeDescription
    tableTable containing { position = Vec3, rotation = Quat, scale = Vec3, tags = {string, ...}, params = table } for each node.

    sm.cell.getTags(x, y)

    Returns a table of tags for a cell coordinate.

    Parameters:

    TypeNameDescription
    integerxX-coordinate
    integeryY-coordinate

    Returns:

    TypeDescription
    tableTable {string, ...} of tags.