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:

  • checkLiftCollision
  • forceTool
  • preloadRenderables
  • uuidExists

  • 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 0
    start 1
    hold 2
    stop 3

    sm.tool.checkLiftCollision(creation, position, rotation)

    Used to check collisions between the lift and the world.

    Parameters:

    TypeNameDescription
    tablecreationA table of all the bodies belonging to the creation placed on the lift.
    Vec3positionThe lift position.
    integerrotationThe rotation of the creation on the lift.

    Returns:

    TypeDescription
    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:

    TypeNameDescription
    TooltoolThe 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:

    TypeNameDescription
    tablerenderablesThe table of renderables names. {string, ..}

    sm.tool.uuidExists(The)

    Return whether the tool uuid exists

    Parameters:

    TypeNameDescription
    UuidTheshape uuid.

    Returns:

    TypeDescription
    booleanexists.