sm.shape

Associated object type: Shape

A shape is any block, part or basic material that can be built by a player. Shapes are always connected to a body, which is a collection of shapes.

For more information about creating your own scripted shapes, see ShapeClass.

Constants:

Functions:

  • createBlock
  • createPart
  • createWedge
  • getIsHarvest
  • getIsStackable
  • getShapeDescription
  • getShapeIcon
  • getShapeTitle
  • getShapeTypeColor
  • getShapeUpperCaseTitle
  • shapesInSphere
  • uuidExists

  • sm.shape.destructionType table

    Shape destruction types. Using these will handle the destruction as if it was caused by the specified type.

    None
    Melee
    Projectile
    Explosion

    sm.shape.material table

    Shape physics materials

    None
    Default
    Grass
    Dirt
    Sand
    Gravel
    Rock
    Wood
    Plastic
    Metal
    Glass
    Fence
    Fabric
    Cardboard
    Foliage
    Tape
    Water
    WaterSubmerged
    RagdollHuman
    Mechanical
    Fruit
    RagdollAnimal
    Electronics
    Sticky
    Ice
    Bubblewrap
    Scrapmetal
    Rewardlocker
    Chili
    VoxelBlueRock
    VoxelPurpleRock
    VoxelRedRock
    VoxelBlueMineral
    VoxelPurpleMineral
    VoxelRedMineral

    sm.shape.createBlock(uuid, size, position, rotation?, dynamic?, forceSpawn?)

    Server only

    Create a new block

    Parameters:

    TypeNameDescription
    UuiduuidThe uuid of the shape.
    Vec3sizeThe size of the block.
    Vec3positionThe shape's world position.
    Quatrotation?The shape's world rotation. Defaults to no rotation (Optional)
    booleandynamic?Set true if the shape is dynamic or false if the shape is static. Defaults to true (Optional)
    booleanforceSpawn?Set true to force spawn the shape even if it will cause collision. Defaults to true (Optional)

    Returns:

    TypeDescription
    Shape The created block

    sm.shape.createPart(uuid, position, rotation, dynamic?, forceSpawn?, world?)

    Server only

    Create a new part

    Parameters:

    TypeNameDescription
    UuiduuidThe uuid of the shape.
    Vec3positionThe shape's world position.
    QuatrotationThe shape's world rotation. Defaults to no rotation (Optional)
    booleandynamic?Set true if the shape is dynamic or false if the shape is static. Defaults to true (Optional)
    booleanforceSpawn?Set true to force spawn the shape even if it will cause collision. Defaults to true (Optional)
    Worldworld?The world to create the part in. Uses the script's world by default. (Optional)

    Returns:

    TypeDescription
    Shape The created part

    sm.shape.createWedge(uuid, size, position, rotation?, dynamic?, forceSpawn?)

    Server only

    Creates a wedge. The wedge is oriented with one

    cathetus along the Y-axis and the other along the Z-axis, forming a right angle.

    Parameters:

    TypeNameDescription
    UuiduuidThe uuid of the shape.
    Vec3sizeThe size of the wedge.
    Vec3positionThe shape's world position.
    Quatrotation?The shape's world rotation. Defaults to no rotation (Optional)
    booleandynamic?Set true if the shape is dynamic or false if the shape is static. Defaults to true (Optional)
    booleanforceSpawn?Set true to force spawn the shape even if it will cause collision. Defaults to true (Optional)

    Returns:

    TypeDescription
    Shape The created wedge

    sm.shape.getIsHarvest(uuid)

    Return whether the shape uuid belongs to a harvest shape

    Parameters:

    TypeNameDescription
    UuiduuidThe shape uuid.

    Returns:

    TypeDescription
    booleanTrue if the shape is harvestable.

    sm.shape.getIsStackable(uuid)

    Return whether the shape uuid belongs to a stackable shape

    Parameters:

    TypeNameDescription
    UuiduuidThe shape uuid.

    Returns:

    TypeDescription
    booleanTrue if the shape is stackable.

    sm.shape.getShapeDescription(uuid)

    Returns the block/part description for the given uuid.

    Parameters:

    TypeNameDescription
    UuiduuidThe uuid.

    Returns:

    TypeDescription
    stringThe shape description.

    sm.shape.getShapeIcon()

    Deprecated:

    Deprecated function. Kept for compability with old scripts.

    Does nothing.


    sm.shape.getShapeTitle(uuid)

    Returns the block/part name for the given uuid.

    Parameters:

    TypeNameDescription
    UuiduuidThe uuid.

    Returns:

    TypeDescription
    stringThe shape title.

    sm.shape.getShapeTypeColor(uuid)

    Returns the color of the uuid's shape type

    Parameters:

    TypeNameDescription
    UuiduuidThe uuid of the shape.

    Returns:

    TypeDescription
    ColorThe color of the shape type.

    sm.shape.getShapeUpperCaseTitle(uuid)

    Returns the block/part name for the given uuid in uppercase as given in the inventory description translations. Defaults to the shape title if an upper case version does not exist.

    Parameters:

    TypeNameDescription
    UuiduuidThe uuid.

    Returns:

    TypeDescription
    stringThe shape title in upper case.

    sm.shape.shapesInSphere(center, radius)

    Returns a table of all shapes colliding with a given sphere.

    Parameters:

    TypeNameDescription
    Vec3centerThe center position of the sphere.
    numberradiusThe radius of the sphere.

    Returns:

    TypeDescription
    tableThe table of found shapes. {Shape, ..}

    sm.shape.uuidExists(uuid)

    Return whether the shape uuid exists

    Parameters:

    TypeNameDescription
    UuiduuidThe shape uuid.

    Returns:

    TypeDescription
    booleanexists.