sm.localPlayer
Local player represents the current character being controlled on the client's computer. This library can only be used on the client.
For more information about other players in the world, see sm.player.
Functions:
sm.localPlayer.addRenderable(renderable)
Client only
Adds a renderable (file containing model data) to be used for the local player in first person view.
Parameters:
Type | Name | Description |
---|---|---|
string | renderable | The renderable path. |
sm.localPlayer.getActiveItem()
Client only
Returns the item currently held by the local player.
Returns:
Type | Description |
---|---|
Uuid | The player's held item uuid. |
sm.localPlayer.getAimSensitivity()
Client only
Return the player aim sensitivity
Returns:
Type | Description |
---|---|
number | The aim sensitivity |
sm.localPlayer.getCarry()
Client only
Returns the carrying container of the local player.
Returns:
Type | Description |
---|---|
Container | The player's carry. |
sm.localPlayer.getCarryColor()
Client only
Returns the color of the shape the local player is carrying.
Returns:
Type | Description |
---|---|
Color | The color of the shape the local player is carrying. |
sm.localPlayer.getDirection()
Client only
Returns the direction the local player is aiming.
Returns:
Type | Description |
---|---|
Vec3 | The direction of the player's aim. |
sm.localPlayer.getFpAnimationInfo(name)
Client only
Returns general information for a first person view animation.
Parameters:
Type | Name | Description |
---|---|---|
string | name | The name. |
Returns:
Type | Description |
---|---|
table | A table containing name, duration and looping. |
sm.localPlayer.getFpBonePos(jointName)
Client only
Returns the world position for a bone in the first person view animation skeleton.
Parameters:
Type | Name | Description |
---|---|---|
string | jointName | The joint name. |
Returns:
Type | Description |
---|---|
Vec3 | The joint position. |
sm.localPlayer.getHotbar()
Client only
Returns the hotbar container of the player.
Returns:
Type | Description |
---|---|
Container | The player's hotbar. |
sm.localPlayer.getId()
Client only
Returns the unique player id of the local player.
Returns:
Type | Description |
---|---|
integer | The player's id. |
sm.localPlayer.getInventory()
Client only
Returns the inventory container of the local player.
Returns:
Type | Description |
---|---|
Container | The player's inventory. |
sm.localPlayer.getMouseDelta()
Client only
Returns delta positions of mouse
Returns:
Type | Description |
---|---|
number,number | Delta X; Delta Y |
sm.localPlayer.getOwnedLift()
Client only
Returns the Lift of the local player.
Returns:
Type | Description |
---|---|
Lift | The player's lift. |
sm.localPlayer.getPlayer()
Client only
Returns the player object of the local player.
Returns:
Type | Description |
---|---|
Player | The player object. |
sm.localPlayer.getPosition()
Deprecated:
Client only
Returns the world position of the local player.
Returns:
Type | Description |
---|---|
Vec3 | The player's world position. |
sm.localPlayer.getRaycast(range, origin=nil, direction=nil)
Client only
Performs a raycast relative to the local player's perspective.
Parameters:
Type | Name | Description |
---|---|---|
number | range | The maximum range. |
Vec3 | origin=nil | The start position. (Defaults to sm.localPlayer.getRaycastStart) |
Vec3 | direction=nil | The direction. (Defaults to sm.localPlayer.getDirection) |
Returns:
Type | Description |
---|---|
bool, RaycastResult | True if raycast was successful; Raycast result data. |
sm.localPlayer.getRaycastStart()
Client only
Returns the start position of the local player's raycast. The position depends on the camera's position, and whether it's in first- of third-person.
Returns:
Type | Description |
---|---|
Vec3 | The start position of the raycast. |
sm.localPlayer.getRight()
Client only
Returns the right-vector perpendicular to the local player's aim.
Returns:
Type | Description |
---|---|
Vec3 | The right-vector of the player's aim. |
sm.localPlayer.getSelectedHotbarSlot()
Client only
Returns the local player's selected slot.
Returns:
Type | Description |
---|---|
integer | The player's selected slot. |
sm.localPlayer.getUp()
Client only
Returns the up-vector perpendicular to the local player's aim.
Returns:
Type | Description |
---|---|
Vec3 | The up-vector of the player's aim. |
sm.localPlayer.isGarmentUnlocked(uuid)
Client only
Check if the garment has been granted to the local player.
Parameters:
Type | Name | Description |
---|---|---|
Uuid | uuid | The garment. |
Returns:
Type | Description |
---|---|
boolean | Returns true if the garment is unlocked. |
sm.localPlayer.isInFirstPersonView()
Client only
Returns whether the player is in first person view where the viewpoint is rendered from the player's perspective. Otherwise, the player is in third person view where the camera is behind the player.
Returns:
Type | Description |
---|---|
boolean | Whether the player is in first person view. |
sm.localPlayer.removeRenderable(renderable)
Client only
Removes a renderable (file containing model data) that was used for the local player in first person view.
Parameters:
Type | Name | Description |
---|---|---|
string | renderable | The renderable path. |
sm.localPlayer.setBlockSprinting(blockSprinting)
Client only
Stops the local player from sprinting.
Parameters:
Type | Name | Description |
---|---|---|
boolean | blockSprinting | Sets whether sprinting is blocked. |
sm.localPlayer.setDirection(direction)
Client only
Sets the direction of where the player is viewing or aiming. Intended to be used when the controls have been locked. (See sm.localPlayer.setLockedControls)
Parameters:
Type | Name | Description |
---|---|---|
Vec3 | direction | The world direction. |
sm.localPlayer.setLockedControls(locked)
Client only
Sets whether the player's in-game controls are locked.
Parameters:
Type | Name | Description |
---|---|---|
boolean | locked | The lock state. |
sm.localPlayer.updateFpAnimation(name, time, weight=-1.0, looping=false)
Client only
Updates a first person view animation.
Parameters:
Type | Name | Description |
---|---|---|
string | name | The name. |
number | time | The time. |
number | weight=-1.0 | The weight. |
boolean | looping=false | The looping. |