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:
| Type | Name | Description |
| Uuid | uuid | The uuid of the shape. |
| Vec3 | size | The size of the block. |
| Vec3 | position | The shape's world position. |
| Quat | rotation? | The shape's world rotation. Defaults to no rotation (Optional) |
| boolean | dynamic? | Set true if the shape is dynamic or false if the shape is static. Defaults to true (Optional) |
| boolean | forceSpawn? | Set true to force spawn the shape even if it will cause collision. Defaults to true (Optional) |
Returns:
| Type | Description |
| Shape The created block | |
sm.shape.createPart(uuid, position, rotation, dynamic?, forceSpawn?, world?)
Server only
Create a new part
Parameters:
| Type | Name | Description |
| Uuid | uuid | The uuid of the shape. |
| Vec3 | position | The shape's world position. |
| Quat | rotation | The shape's world rotation. Defaults to no rotation (Optional) |
| boolean | dynamic? | Set true if the shape is dynamic or false if the shape is static. Defaults to true (Optional) |
| boolean | forceSpawn? | Set true to force spawn the shape even if it will cause collision. Defaults to true (Optional) |
| World | world? | The world to create the part in. Uses the script's world by default. (Optional) |
Returns:
| Type | Description |
| 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:
| Type | Name | Description |
| Uuid | uuid | The uuid of the shape. |
| Vec3 | size | The size of the wedge. |
| Vec3 | position | The shape's world position. |
| Quat | rotation? | The shape's world rotation. Defaults to no rotation (Optional) |
| boolean | dynamic? | Set true if the shape is dynamic or false if the shape is static. Defaults to true (Optional) |
| boolean | forceSpawn? | Set true to force spawn the shape even if it will cause collision. Defaults to true (Optional) |
Returns:
| Type | Description |
| Shape The created wedge | |
sm.shape.getIsHarvest(uuid)
Return whether the shape uuid belongs to a harvest shape
Parameters:
| Type | Name | Description |
| Uuid | uuid | The shape uuid. |
Returns:
| Type | Description |
| boolean | True if the shape is harvestable. |
sm.shape.getIsStackable(uuid)
Return whether the shape uuid belongs to a stackable shape
Parameters:
| Type | Name | Description |
| Uuid | uuid | The shape uuid. |
Returns:
| Type | Description |
| boolean | True if the shape is stackable. |
sm.shape.getShapeDescription(uuid)
Returns the block/part description for the given uuid.
Parameters:
| Type | Name | Description |
| Uuid | uuid | The uuid. |
Returns:
| Type | Description |
| string | The 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:
| Type | Name | Description |
| Uuid | uuid | The uuid. |
Returns:
| Type | Description |
| string | The shape title. |
sm.shape.getShapeTypeColor(uuid)
Returns the color of the uuid's shape type
Parameters:
| Type | Name | Description |
| Uuid | uuid | The uuid of the shape. |
Returns:
| Type | Description |
| Color | The 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:
| Type | Name | Description |
| Uuid | uuid | The uuid. |
Returns:
| Type | Description |
| string | The shape title in upper case. |
sm.shape.shapesInSphere(center, radius)
Returns a table of all shapes colliding with a given sphere.
Parameters:
| Type | Name | Description |
| Vec3 | center | The center position of the sphere. |
| number | radius | The radius of the sphere. |
Returns:
| Type | Description |
| table | The table of found shapes. {Shape, ..} |
sm.shape.uuidExists(uuid)
Return whether the shape uuid exists
Parameters:
| Type | Name | Description |
| Uuid | uuid | The shape uuid. |
Returns:
| Type | Description |
| boolean | exists. |