Class Constants
ShapeClass
Listed below are ShapeClass
constants that can be set like this:
MyShape = class()
MyShape.colorHighlight = sm.color.new( "#ff0000" )
MyShape.colorNormal = sm.color.new( "#00ff00" )
--etc. etc.
colorHighlight
Sets the connection-point highlight color.
The connection-point is shown when using the Connect Tool and selecting the interactable.
Defaults to white.
highlightColor
[ Color ]: The connection-point's highlight color.
colorNormal
Sets the connection-point normal color.
The connection-point is shown when using the Connect Tool.
Defaults to gray.
normalColor
[ Color ]: The connection-point's normal color.
connectionInput
Sets the input connection type.
See sm.interactable.connectionType for details.
Defaults to 0, no input.
connectionType
[ int ]: The input connection type.
connectionOutput
Sets the output connection type.
See sm.interactable.connectionType for details.
Defaults to 0, no output.
connectionType
[ int ]: The output connection type.
maxParentCount
Sets the maximum number of allowed parent connections - the number of input connections.
Defaults to 0, no allowed parent connections.
Implement client_getAvailableParentConnectionCount to control specific types.
maxParents
[ int ]: The maximum amount of input connections.
maxChildCount
Sets the maximum number of allowed child connections - the number of output connections.
Defaults to 0, no allowed child connections.
Implement client_getAvailableChildConnectionCount to control specific types.
maxChildren
[ int ]: The maximum amount of output connections.
poseWeightCount
Sets the number of animation poses the shape's model is able to use.
Value are integers 0-3 (Defaults to 0, no poses).
A value greater that 0 indicates that the renderable's mesh is set up to blend into pose0
, pose1
, pose2
.
This is, for example, used to move the lever on the engine.
poseWeightCount
[ int ]: The number of animation poses.
UnitClass
isSaveObject
Enables or disables saving of this unit. (Defaults to true)
If enabled, the Unit will be recreated when loading a game. Otherwise, the Unit is considered a temporary object.
If disabled, self.storage
can not be used.
enable
[ bool ]: A boolean indicating whether saving the unit is enabled or not.
GameClass
defaultInventorySize
Sets default player inventory size.
Defaults to 40.
size
[ int ]: The inventory size.
enableAggro
Enables or disables enemy aggression.
Defaults to true.
enable
[ bool ]: A boolean indicating whether enemy aggression is enabled or not.
enableAmmoConsumption
Enables or disables ammo consumption.
Defaults to false.
enable
[ bool ]: A boolean indicating whether ammo consumption is enabled or not.
enableFuelConsumption
Enables or disables fuel consumption.
Defaults to false.
enable
[ bool ]: A boolean indicating whether fuel consumption is enabled or not.
enableLimitedInventory
Enables or disables limited inventory.
Defaults to false.
When limited in inventory is on, items have a limited amount.
When off, the player has access to all items. (Except for items with json value "hidden": true)
enable
[ bool ]: A boolean indicating whether the inventory is limited or not.
enableRestrictions
Enables or disables build restrictions.
Defaults to false.
enable
[ bool ]: A boolean indicating whether building is restricted or not.
enableUpgrade
Enables or disables interactable part upgrade.
Defaults to false.
enable
[ bool ]: A boolean indicating whether part upgrades are enabled or not.
HarvestableClass
poseWeightCount
Sets the number of animation poses the harvestable's model is able to use.
Value are integers 0-3 (Defaults to 0, no poses).
A value greater that 0 indicates that the renderable's mesh is set up to blend into pose0
, pose1
, pose2
.
highlightColor
[ Color ]: The connection-point's normal color.
WorldClass
cellMaxX
Terrain generation maximum cell position in X axis.
Default = 0
maxX
[ int ]: The maximum X cell position.
cellMaxY
Terrain generation maximum cell position in Y axis.
Default = 0
maxY
[ int ]: The maximum Y cell position.
cellMinX
Terrain generation minimum cell position in X axis.
Default = 0
minX
[ int ]: The minimum X cell position.
cellMinY
Terrain generation minimum cell position in Y axis.
Default = 0
minY
[ int ]: The minimum Y cell position.
enableAssets
Enables or disables terrain assets for this world.
Default = true
enable
[ bool ]: A boolean indicating whether terrain assets are enabled or not.
enableClutter
Enables or disables terrain clutter for this world.
Default = true
enable
[ bool ]: A boolean indicating whether terrain clutter is enabled or not.
enableCreations
Enables or disables creations for this world.
Default = true
enable
[ bool ]: A boolean indicating whether creations are enabled or not.
enableHarvestables
Enables or disables terrain harvestables for this world.
Default = true
enable
[ bool ]: A boolean indicating whether terrain harvestables are enabled or not.
enableKinematics
Enables or disables terrain kinematics for this world.
Default = true
enable
[ bool ]: A boolean indicating whether terrain kinematics are enabled or not.
enableNodes
Enables or disables nodes for this world.
Default = true
enable
[ bool ]: A boolean indicating whether nodes are enabled or not.
enableSurface
Enables or disables terrain surface for this world.
Default = true
enable
[ bool ]: A boolean indicating whether the terrain surface is enabled or not.
groundMaterialSet
Sets the ground material set used by the terrain.
Default = "$GAME_DATA/Terrain/Materials/gnd_standard_materialset.json"
materialSet
[ string ]: The full$-
file path to the material set.
isIndoor
Enables or disables indoor mode.
Default = false
Indoor worlds have only one terrain cell, at 0, 0
enable
[ bool ]: A boolean indicating whether indoor mode is enabled or not.
renderMode
Sets the render mode for this world.
Default = "outdoor"
Valid = "outdoor", "challenge", "warehouse"
renderMode
[ string ]: The render mode.
terrainScript
Sets the script used to generate terrain.
script
[ string ]: The full$-
file path to the terrain generation script.
worldBorder
Adds borders to the world to prevent objects from falling through the ground.
Defaults to true.
enable
[ bool ]: Whether world borders are enabled or not.
ScriptableObjectClass
isSaveObject
Enables or disables saving of this scriptable object.
Default = false
If enabled, the ScriptableObject will be recreated when loading a game.
Otherwise, the ScriptableObject is considered a temporary object.
If disabled, self.storage can not be used.
enable
[ bool ]: A boolean indicating whether saving this object is enabled or not.
Namespace Constants
sm
-
sm.isHost
[ bool ]: Whether the game is currently running on the hosting player's computer. -
sm.version
[ string ]: The current version of the game as a string.
sm.areaTrigger.filter
Filters are used to specify what object types an area trigger is able to detect.
If an area trigger is created with a filter, it will only react to objects of that type.
Filters can be combined by adding them.
{
dynamicBody = 1,
staticBody = 2,
character = 4,
areatrigger = 8,
harvestable = 512,
lift = 1024,
voxelTerrain = 32768,
all = 34319
}
sm.audio.soundList
A table containing all sounds that can be played using sm.audio.play
{
"Ambient - Birds",
"Ambient - Challenge",
"Ambient - Field",
"Blueprint - Build",
"Blueprint - Camera",
"Blueprint - Close",
"Blueprint - Delete",
"Blueprint - Open",
"Blueprint - Save",
"Blueprint - Select",
"Blueprint - Share",
"Brake",
"Button off",
"Button on",
"Challenge - Fall",
"Challenge - Start",
"Challenge - Supervisor generic",
"Character crouch",
"Character get up",
"Character hit",
"Character jump",
"Character land",
"Character movement",
"Character movement crouched",
"Character wind",
"Collision - Debris",
"Collision - Multiple",
"Collision - Rolling",
"Collision - Single",
"Collision - Sliding",
"Collision - Vehicle",
"ConnectTool",
"ConnectTool - Equip",
"ConnectTool - Idle",
"ConnectTool - Released",
"ConnectTool - Rotate",
"ConnectTool - Selected",
"ConnectTool - Unequip",
"Construction - Block attached to joint",
"Construction - Block placed",
"Construction - Resize",
"Dancebass",
"Dancedrum",
"Dancepad",
"Dancevoice",
"Destruction - Block destroyed",
"Destruction - Resize",
"ElectricEngine",
"GUI Backpack closed",
"GUI Backpack opened",
"GUI Inventory highlight",
"GUI Item drag",
"GUI Item released",
"GUI Quickbar highlight",
"GUI Shape rotate",
"Gas Explosion",
"Gas Leak",
"GasEngine",
"Handbook - Close",
"Handbook - Equip",
"Handbook - Highlight",
"Handbook - Open",
"Handbook - Turn page",
"Handbook - Unequip",
"Horn",
"Lever off",
"Lever on",
"Lift - Pickup object",
"Lift placed",
"Lift usage",
"Music",
"PaintTool - Close",
"PaintTool - ColorPick",
"PaintTool - Equip",
"PaintTool - Erase",
"PaintTool - Open",
"PaintTool - Paint",
"PaintTool - Reload",
"PaintTool - Unequip",
"Phaser",
"Piston",
"PotatoRifle - Equip",
"PotatoRifle - NoAmmo",
"PotatoRifle - Reload",
"PotatoRifle - Shoot",
"PotatoRifle - Unequip",
"Radio",
"RaftShark",
"Retrobass",
"Retrodrum",
"Retrofmblip",
"Retrovoice",
"Retrowildblip",
"Reverb - Challenge",
"Reverb - Field",
"Seat seated",
"Seat unseated",
"Sensor off",
"Sensor on",
"SequenceController",
"SequenceController change rotation",
"Sledgehammer - Equip",
"Sledgehammer - Swing",
"Sledgehammer - Unequip",
"Suspension",
"Thruster",
"Thruster dust",
"Toilet seated",
"Toilet unseated",
"Weapon - Hit",
"WeldTool - Case 1",
"WeldTool - Case 2",
"WeldTool - Equip",
"WeldTool - Error",
"WeldTool - Sparks",
"WeldTool - Unequip",
"WeldTool - Weld"
}
sm.camera.state
Camera states are used to specify how the camera will view the world.
The default state is meant for normal gameplay and the first-person and third-person states are meant to be used in cutcenes.
{
default = 1,
cutsceneFP = 2,
cutsceneTP = 3,
forcedTP = 4,
gyroSeatFP = 5,
gyroSeatTP = 6
}
sm.construction.constants
Constants used by the construction system.
- subdivideRatio - The physical size of one block.
- subdivideRatio_2 - The physical size of one block divided by two.
- subdivisions - 1 dividided by subdivideRatio.
- shapeSpacing - Bias value.
{
subdivideRatio = 0.25,
subdivideRatio_2 = 0.125,
subdivisions = 4,
shapeSpacing = 0.004
}
sm.interactable.types
The table of types that an interactable can be.
{
"electricEngine",
"gasEngine",
"steering",
"seat",
"controller",
"button",
"lever",
"sensor",
"thruster",
"radio",
"horn",
"tone",
"logic",
"timer",
"particlePreview",
"spring",
"pointLight",
"spotLight",
"chest",
"itemStack",
"scripted",
"piston",
"simpleInteractive",
"camera",
"waypoint",
"survivalThruster",
"survivalPiston",
"survivalSpring",
"survivalSequence",
"survivalSensor"
}
sm.interactable.actions
A table containing all key actions that can be received by an interactable's client_onAction
callback.
{
none = 0,
left = 1,
right = 2,
forward = 3,
backward = 4,
item0 = 5,
item1 = 6,
item2 = 7,
item3 = 8,
item4 = 9,
item5 = 10,
item6 = 11,
item8 = 13,
item7 = 12,
item9 = 14,
use = 15,
jump = 16,
exit = 17,
attack = 18,
create = 19,
zoomIn = 20,
zoomOut = 21
}
sm.interactable.connectionType
A table containing all available connection types for interactables.
{
none = 0,
logic = 1,
power = 2,
bearing = 4,
seated = 8,
piston = 16,
gasoline = 256,
electricity = 512,
water = 1024,
ammo = 2048
}
sm.interactable.steering
Flags used with the steering component.
{
left = 1,
right = 2,
forward = 4,
backward = 8
}
A table of available interactable types.
{
"electricEngine",
"gasEngine",
"steering",
"seat",
"controller",
"button",
"lever",
"sensor",
"thruster",
"radio",
"horn",
"tone",
"logic",
"timer",
"particlePreview",
"spring",
"pointLight",
"spotLight",
"chest",
"scripted",
"piston",
"simpleInteractive",
}
sm.joint.types
A table of joint types.
{
"bearing",
"piston"
}
sm.pathfinder.conditionProperty
A table of condition link types.
{
height = 0,
target = 1,
none = 2
}
sm.physics.filter
A table of physics filter types used for things like raycasts.
{
dynamicBody = 1,
staticBody = 2,
character = 4,
areaTrigger = 8,
joints = 4096,
terrainSurface = ?,
terrainAsset = ?,
harvestable = ?,
static = ?,
default = 6023,
all = -1
}
sm.physics.types
Physics types are used to define an object's characteristics is in the physics world.
Upon a raycast or collision detection, these types are used to find out what object was intersected.
{
"invalid", --No object.
"terrainSurface", --The ground.
"terrainAsset", --Trees and boulders.
"lift", --A Lift.
"body", --A Body.
"character", --A Character.
"joint", --A Joint.
"harvestable", --A Harvestable.
"vision" --A collision area used by sensors.
}
sm.tool.interactState
The interact state describe what kind of interaction is made.
This is used to check whether a mouse button or key was just pressed, held, etc.
{
null = 0, --No interaction.
start = 1, --The key was just pressed.
hold = 2, --The key is held down.
stop = 3 --The key was just released.
}
sm.world.ids
Predefined special world ids.
{
anyWorld = 65535,
noWorld = 65534
}