Module player
This class represents the player who is executing the control unit.
Functions
getName () | Returns the player name. |
getId () | Returns the ID of the player. |
getMass () | Returns the player mass. |
getNanopackMass () | Returns the player's nanopack content mass. |
getNanopackVolume () | Returns the player's nanopack content volume. |
getNanopackMaxVolume () | Returns the player's nanopack maximum volume. |
getOrgIds () | Returns the list of organization IDs of the player. |
getPosition () | Returns the position of the player, in construct local coordinates. |
getWorldPosition () | Returns the position of the player, in world coordinates. |
getHeadPosition () | Returns the position of the head of the player's character, in construct local coordinates. |
getWorldHeadPosition () | Returns the position of the head of the player's character, in world coordinates. |
getVelocity () | Returns the velocity vector of the player, in construct local coordinates. |
getWorldVelocity () | Returns the velocity vector of the player, in world coordinates. |
getAbsoluteVelocity () | Returns the absolute velocity vector of the player, in world coordinates. |
getForward () | Returns the forward direction vector of the player, in construct local coordinates. |
getRight () | Returns the right direction vector of the player, in construct local coordinates. |
getUp () | Returns the up direction vector of the player, in construct local coordinates. |
getWorldForward () | Returns the forward direction vector of the player, in world coordinates. |
getWorldRight () | Returns the right direction vector of the player, in world coordinates. |
getWorldUp () | Returns the up direction vector of the player, in world coordinates. |
getPlanet () | Returns the id of the planet the player is located on. |
getParent () | Returns the identifier of the construct to which the player is parented. |
isSeated () | Checks if the player is seated. |
getSeatId () | Returns the local ID of the seat on which the player is sitting. |
isParentedTo (id) | Checks if the player is parented to the given construct. |
isSprinting () | Checks if the player is currently sprinting. |
isJetpackOn () | Checks if the player's jetpack is on. |
isHeadlightOn () | Returns the state of the headlight of the player. |
setHeadlightOn (state) | Set the state of the headlight of the player. |
freeze (state) | Freezes the player movements, liberating the associated movement keys to be used by the script. |
isFrozen (1) | Checks if the player movements are frozen. |
hasDRMAutorization () | Checks if the player has DRM authorization to the control unit. |
load () | Unknown use. |
EVENT_onParentChanged (oldId, newId) | Event: Emitted when the player parent changes. |
mockGetClosure () | Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":". |
Functions
- getName ()
-
Returns the player name.
Returns:
-
string
The player name.
- getId ()
-
Returns the ID of the player.
Returns:
-
int
The ID of the player.
- getMass ()
-
Returns the player mass.
Returns:
-
float
The mass of the player .
- getNanopackMass ()
-
Returns the player's nanopack content mass.
Returns:
-
float
The player's nanopack content mass in kilograms.
- getNanopackVolume ()
-
Returns the player's nanopack content volume.
Returns:
-
float
THe player's nanopack content volume in liters.
- getNanopackMaxVolume ()
-
Returns the player's nanopack maximum volume.
Returns:
-
float
The player's nanopack maximum volume in liters.
- getOrgIds ()
-
Returns the list of organization IDs of the player.
Returns:
-
list
The list of organization IDs.
- getPosition ()
-
Returns the position of the player, in construct local coordinates.
Returns:
-
vec3
The position in construct local coordinates.
- getWorldPosition ()
-
Returns the position of the player, in world coordinates.
Returns:
-
vec3
The position in world coordinates.
- getHeadPosition ()
-
Returns the position of the head of the player's character, in construct local coordinates.
Returns:
-
vec3
The position of the head in construct local coordinates.
- getWorldHeadPosition ()
-
Returns the position of the head of the player's character, in world coordinates.
Returns:
-
vec3
The position of the head in world coordinates.
- getVelocity ()
-
Returns the velocity vector of the player, in construct local coordinates.
Returns:
-
vec3
The velocity vector in construct local coordinates.
- getWorldVelocity ()
-
Returns the velocity vector of the player, in world coordinates.
Returns:
-
vec3
The velocity vector in world coordinates.
- getAbsoluteVelocity ()
-
Returns the absolute velocity vector of the player, in world coordinates.
Returns:
-
vec3
The velocity absolute vector in world coordinates.
- getForward ()
-
Returns the forward direction vector of the player, in construct local coordinates.
Returns:
-
vec3
The forward direction vector in construct local coordinates.
- getRight ()
-
Returns the right direction vector of the player, in construct local coordinates.
Returns:
-
vec3
The right direction vector in construct local coordinates.
- getUp ()
-
Returns the up direction vector of the player, in construct local coordinates.
Returns:
-
vec3
The up direction vector in construct local coordinates.
- getWorldForward ()
-
Returns the forward direction vector of the player, in world coordinates.
Returns:
-
vec3
The forward direction vector in world coordinates.
- getWorldRight ()
-
Returns the right direction vector of the player, in world coordinates.
Returns:
-
vec3
The right direction vector in world coordinates.
- getWorldUp ()
-
Returns the up direction vector of the player, in world coordinates.
Returns:
-
vec3
The up direction vector in world coordinates.
- getPlanet ()
-
Returns the id of the planet the player is located on.
Returns:
-
int
The ID of the planet, 0 if none.
- getParent ()
-
Returns the identifier of the construct to which the player is parented.
Returns:
-
The
ID of the construct, 0 if none.
- isSeated ()
-
Checks if the player is seated.
Returns:
-
0/1
1 if the player is seated.
- getSeatId ()
-
Returns the local ID of the seat on which the player is sitting.
Returns:
-
The
local ID of the seat, or 0 if not seated.
- isParentedTo (id)
-
Checks if the player is parented to the given construct.
Parameters:
- id int The construct ID.
Returns:
-
0/1
1 if the player is parented to the given construct.
- isSprinting ()
-
Checks if the player is currently sprinting.
Returns:
-
0/1
1 if the player is sprinting.
- isJetpackOn ()
-
Checks if the player's jetpack is on.
Returns:
-
0/1
1 if the player's jetpack is on.
- isHeadlightOn ()
-
Returns the state of the headlight of the player.
Returns:
-
0/1
1 if the player has his headlight on.
- setHeadlightOn (state)
-
Set the state of the headlight of the player.
Parameters:
- state bool True to turn on the headlight.
- freeze (state)
-
Freezes the player movements, liberating the associated movement keys to be used by the script.
Note: This function is disabled if the player is not running the script explicitly (pressing F on the control unit, vs. via a plug signal).
Parameters:
- state bool 1 to freeze the character, 0 to unfreeze the character.
- isFrozen (1)
-
Checks if the player movements are frozen.
Parameters:
- 1 0/1 if the player is frozen, 0 otherwise.
- hasDRMAutorization ()
-
Checks if the player has DRM authorization to the control unit.
Returns:
-
0/1
1 if the player has DRM authorization on the control unit.
- load ()
- Unknown use.
- EVENT_onParentChanged (oldId, newId)
-
Event: Emitted when the player parent changes.
Note: This is documentation on an event handler, not a callable method.
Parameters:
- oldId int The previous parent construct ID.
- newId int The new parent construct ID.
- mockGetClosure ()
-
Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".
Returns:
-
table
A table encompasing the api calls of object.