sm.tool
Associated object type: Tool
A tool is a scripted tool a player holds in their hand. The tool object is focused on handling animations for first and third person view.
For more information about creating your own scripted tools, see ToolClass.
Constants:
Functions:
sm.tool.interactState table
The interact state describe what kind of interaction is made. This is used to check whether a mouse button or key was just made pressed, held, etc.
The states are:
- null – No keypress was made.
- start – The key was just pressed.
- hold – The key is held down.
- stop – The key was just released.
null | 0 |
start | 1 |
hold | 2 |
stop | 3 |
sm.tool.checkLiftCollision(creation, position, rotation)
Used to check collisions between the lift and the world.
Parameters:
Type | Name | Description |
---|---|---|
table | creation | A table of all the bodies belonging to the creation placed on the lift. |
Vec3 | position | The lift position. |
integer | rotation | The rotation of the creation on the lift. |
Returns:
Type | Description |
---|---|
boolean, integer True if the lift collides with the world; The lift level. |
sm.tool.forceTool(tool)
Client only
Force equip a tool for the local player. Pass nil to unforce an already forced tool.
Parameters:
Type | Name | Description |
---|---|---|
Tool | tool | The tool. |
sm.tool.preloadRenderables(renderables)
Client only
Pre-loads renderable data to be used by the tool. This eliminates excessive loading during run time.
Parameters:
Type | Name | Description |
---|---|---|
table | renderables | The table of renderables names. {string, ..} |
sm.tool.uuidExists(The)
Return whether the tool uuid exists
Parameters:
Type | Name | Description |
---|---|---|
Uuid | The | shape uuid. |
Returns:
Type | Description |
---|---|
boolean | exists. |