Skip to main content

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 in a Body, which is a collection of Shapes.

For more information about creating custom scripted shapes, see ShapeClass.

Functions

createBlock

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

Server-Only

Creates a new block shape.

Parameters:

  • uuid (Uuid): The block UUID.
  • size (Vec3): The block size.
  • position (Vec3): The world position.
  • rotation (Quat, optional): The world rotation. Defaults to identity.
  • dynamic (boolean, optional): Whether the shape is dynamic or static. Defaults to true (dynamic).
  • forceSpawn (boolean, optional): Whether to force spawn the shape or not. Defaults to false.

Returns:

  • shape (Shape): The created shape.

createPart

local shape = sm.shape.createPart(uuid, position, rotation, dynamic, forceSpawn)

Server-Only

Creates a new part.

Parameters:

  • uuid (Uuid): The part uuid.
  • position (Vec3): The the world position.
  • rotation (Quat, optional): The world rotation. Defaults to identity.
  • dynamic (boolean, optional): Whether the shape is dynamic or static. Defaults to true (dynamic).
  • forceSpawn (boolean, optional): Whether to force spawn the shape or not.

Returns:

  • shape (Shape): The created shape.

getShapeDescription

local description = sm.shape.getShapeDescription(uuid)

Returns the item description for the given UUID.

Parameters:

  • uuid (Uuid): The item UUID.

Returns:

  • description (string): The description.

getShapeIcon

sm.shape.getShapeIcon(uuid)

Not implemented.

Parameters:

  • uuid (Uuid): The item UUID.

getShapeTitle

local title = sm.shape.getShapeTitle(uuid)

Returns the item's name for the given UUID.

Parameters:

  • uuid (Uuid): The item UUID.

Returns:

  • title (string): The shape's name.

getShapeTypeColor

local color = sm.shape.getShapeTypeColor(uuid)

Returns the color of the UUID's shape type.
This is the category color in the player inventory.

Parameters:

  • uuid (Uuid): The item UUID.

Returns:

  • color (Color): The color of the shape type.

uuidExists

local exists = sm.shape.uuidExists(uuid)

Returns whether a shape with the given UUID exists.

Parameters:

  • uuid (Uuid): The shape UUID.

Returns:

  • exists (boolean): Whether a shape with this UUID exists or not.