Module construct
Construct represents your construct.
It gives access to the properties of your constructions and to the events linked to them, which can be used in your scripts.
Functions
getName () | Returns the name of the construct. |
getId () | Returns the construct unique ID. |
getOwner () | Returns the owner entity. |
getCreator () | Returns the creator entity. |
isWarping () | Checks if the construct is currently warping. |
getWarpState () | Returns the current warp state. |
isInPvPZone () | Checks if the construct is in the PvP zone. |
getDistanceToSafeZone () | Returns the distance between the construct and the nearest safe zone. |
getPvPTimer () | Returns the current construct PvP timer state. |
getMass () | Returns the mass of the construct. |
getInertialMass () | Returns the inertial mass of the construct, calculated as 1/3 of the trace of the inertial tensor. |
getInertialTensor () | Returns the inertial tensor of the construct. |
getCenterOfMass () | Returns the position of the center of mass of the construct, in local construct coordinates. |
getWorldCenterOfMass () | Returns the position of the center of mass of the construct, in world coordinates. |
getCrossSection () | Returns the construct's cross sectional surface in the current direction of movement. |
getSize () | Returns the size of the building zone of the construct. |
getBoundingBoxSize () | Returns the size of the bounding box of the construct. |
getBoundingBoxCenter () | Returns the position of the center of the bounding box of the construct in local construct coordinates. |
getMaxSpeed () | Returns the max speed along current moving direction. |
getMaxAngularSpeed () | Returns the max angular speed. |
getMaxSpeedPerAxis () | Returns the max speed per axis. |
getMaxThrustAlongAxis (taglist, CRefAxis) | Returns the construct max kinematics parameters in both atmo and space range, in newtons. |
getCurrentBrake () | Returns the current braking force genrated by construct brakes. |
getMaxBrake () | Returns the maximum brake force that can currently be generated by the construct brakes. |
getWorldPosition () | Returns the world position of the construct. |
getVelocity () | The construct's linear velocity, relative to its parent, in construct local coordinates. |
getWorldVelocity () | The construct's linear velocity, relative to its parent, in world coordinates. |
getAbsoluteVelocity () | The construct's absolute linear velocity, in construct local coordinates. |
getWorldAbsoluteVelocity () | The construct's absolute linear velocity, in world coordinates. |
getAcceleration () | The construct's linear acceleration, in construct local coordinates. |
getWorldAcceleration () | The construct's linear acceleration, in world coordinates. |
getAngularVelocity () | The construct's angular velocity, in construct local coordinates. |
getWorldAngularVelocity () | The constructs angular velocity, in world coordinates. |
getAngularAcceleration () | The construct's angular acceleration, in construct local coordinates. |
getWorldAngularAcceleration () | The construct's angular acceleration, in world coordinates. |
getWorldAirFrictionAcceleration () | Returns the acceleration generated by air resistance. |
getWorldAirFrictionAngularAcceleration () | Returns the acceleration torque generated by air resistance. |
getFrictionBurnSpeed () | Returns the speed at which your construct will suffer damage due to friction with the air. |
getForward () | Returns the forward vector of the construct coordinates system. |
getRight () | Returns the right vector of the construct coordinates system. |
getUp () | Returns the up vector of the construct coordinates system. |
getWorldForward () | Returns the forward direction of the construct, in world coordinates. |
getWorldRight () | Returns the right direction of the construct, in world coordinates. |
getWorldUp () | Returns the up direction of the construct, in world coordinates. |
getOrientationUnitId () | Returns the local ID of the current active orientation unit (core unit or gyro unit). |
getOrientationForward () | Returns the forward direction vector of the active orientation unit, in construct local coordinates. |
getOrientationRight () | Returns the right direction vector of the active orientation unit, in construct local coordinates. |
getOrientationUp () | Returns the up direction vector of the active orientation unit, in construct local coordinates. |
getWorldOrientationForward () | Returns the forward direction vector of the active orientation unit, in world coordinates. |
getWorldOrientationRight () | Returns the right direction vector of the active orientation unit, in world coordinates. |
getWorldOrientationUp () | Returns the up direction vector of the active orientation unit, in world coordinates. |
getParent () | Returns the ID of the parent construct of our active construct. |
getClosestParent () | Returns the ID of the nearest construct on which the construct can dock. |
getCloseParents () | Returns the list of IDs of nearby constructs, on which the construct can dock. |
getParentPosition () | Returns the position of the construct's parent when docked in local coordinates. |
getParentWorldPosition () | Returns the position of the construct's parent when docked in world coordinates. |
getParentForward () | Returns the construct's parent forward direction vector, in construct local coordinates. |
getParentRight () | Returns the construct's parent right direction vector, in construct local coordinates. |
getParentUp () | Returns the construct's parent up direction vector, in construct local coordinates. |
getParentWorldForward () | Returns the construct's parent forward direction vector, in world coordinates. |
getParentWorldRight () | Returns the construct's parent right direction vector, in world coordinates. |
getParentWorldUp () | Returns the construct's parent up direction vector, in world coordinates. |
getPlayersOnBoard () | Returns the list of player IDs on board the construct. |
getPlayersOnBoardInVRStation () | Returns the list of player IDs on board the construct inside a VR station. |
isPlayerBoarded (id) | Checks if the given player is on board in the construct. |
isPlayerBoardedInVRStation (id) | Returns 1 if the given player is boarded to the construct inside a VR station. |
getBoardedPlayerMass (id) | Returns the mass of the given player or surrogate if it is on board the construct. |
getBoardedInVRStationAvatarMass (id) | Returns the mass of the given player if in VR station on board the construct. |
getDockedConstructs () | Returns the list of IDs of constructs docked to the construct. |
isConstructDocked (id) | Checks if the given construct is docked to the construct. |
getDockedConstructMass (id) | Returns the mass of the given construct if it is docked to the construct. |
setDockingMode (mode) | Sets the docking mode. |
getDockingMode () | Returns the current docking mode. |
dock (id) | Sends a request to dock to the given construct. |
undock () | Sends a request to undock the construct. |
forceDeboard (id) | Sends a request to deboard a player or surrogate with the given ID. |
forceUndock (id) | Sends a request to undock a construct with the given ID. |
forceInterruptVRSession (id) | Sends a request to interrupt the surrogate session of a player with the given ID. |
load () | Unknown use. |
EVENT_onDocked (id) | Event: Emitted when the construct becomes docked. |
EVENT_onUndocked (id) | Event: Emitted when the construct is undocked. |
EVENT_onPlayerBoarded (id) | Event: Emitted when a player or surrogate boards the construct. |
EVENT_onVRStationEntered (id) | Event: Emitted when a player enters a VR station. |
EVENT_onConstructDocked (id) | Event: Emitted when another construct docks to this construct. |
EVENT_onPvPTimer (active) | Event: Emitted when the PvP timer started or elapsed. |
Functions
- getName ()
-
Returns the name of the construct.
Returns:
-
string
The construct name.
- getId ()
-
Returns the construct unique ID.
Returns:
-
int
The unique ID.
- getOwner ()
-
Returns the owner entity.
Returns:
-
table
The owner entity table with fields {[int] id, [bool] isOrganization} describing the owner. Use
system.getPlayerName(id) and system.getOrganization(id) to retrieve info about it.
See also:
- getCreator ()
-
Returns the creator entity.
Returns:
-
table
The creator entity table with fields {[int] id, [bool] isOrganization} describing the owner. Use
system.getPlayerName(id) and system.getOrganization(id) to retrieve info about it.
See also:
- isWarping ()
-
Checks if the construct is currently warping.
Returns:
-
0/1
1 if the construct is currently warping.
- getWarpState ()
-
Returns the current warp state.
Returns:
-
int
The current warp state index (Idle = 1, Engage = 2, Align = 3, Spool = 4, Accelerate = 5, Cruise = 6,
Decelerate = 7, Stopping = 8, Disengage = 9)
- isInPvPZone ()
-
Checks if the construct is in the PvP zone.
Returns:
-
0/1
1 if the construct is in the PVP zone.
- getDistanceToSafeZone ()
-
Returns the distance between the construct and the nearest safe zone.
Returns:
-
float
The distance to the nearest safe zone border in meters. Positive value if the construct is outside of any safe zone.
- getPvPTimer ()
-
Returns the current construct PvP timer state.
Returns:
-
float
The remaining time of the PvP timer, or 0.0 if elapsed.
- getMass ()
-
Returns the mass of the construct.
Returns:
-
float
The mass of the construct in kilograms.
- getInertialMass ()
-
Returns the inertial mass of the construct, calculated as 1/3 of the trace of the inertial tensor.
Returns:
-
float
The inertial mass of the construct in kilograms * meters square.
- getInertialTensor ()
-
Returns the inertial tensor of the construct.
Returns:
-
mat
The inertial tensor of the construct in kilograms * meters square.
- getCenterOfMass ()
-
Returns the position of the center of mass of the construct, in local construct coordinates.
Returns:
-
vec3
The position of the center of mass of the construct in local construct coordinates.
- getWorldCenterOfMass ()
-
Returns the position of the center of mass of the construct, in world coordinates.
Returns:
-
vec3
The position of the center of mass of the construct in world coordinates.
- getCrossSection ()
-
Returns the construct's cross sectional surface in the current direction of movement.
Returns:
-
float
The construct's surface exposed in the current direction of movement in meters square.
- getSize ()
-
Returns the size of the building zone of the construct.
Returns:
-
vec3
The building zone size in meters.
- getBoundingBoxSize ()
-
Returns the size of the bounding box of the construct.
Returns:
-
vec3
The bounding box size in meters.
- getBoundingBoxCenter ()
-
Returns the position of the center of the bounding box of the construct in local construct coordinates.
Returns:
-
vec3
The dimensions of the position of the center of the bounding box of the construct in local construct
coordinates.
- getMaxSpeed ()
-
Returns the max speed along current moving direction.
Returns:
-
float
The max speed along current moving direction in m/s.
- getMaxAngularSpeed ()
-
Returns the max angular speed.
Returns:
-
float
The max angular speed in rad/s.
- getMaxSpeedPerAxis ()
-
Returns the max speed per axis.
Returns:
-
table
The max speed along axes {x, -x, y, -y, z, -z} in m/s.
- getMaxThrustAlongAxis (taglist, CRefAxis)
-
Returns the construct max kinematics parameters in both atmo and space range, in newtons. Kinematics parameters
designate here the maximal positive and negative base force the construct is capable of producing along the chosen
CRefAxis. In practice, this gives you an estimate of the maximum thrust your ship is capable of producing in space
or in atmosphere, as well as the max reverse thrust. These are theoretical estimates and correspond with the
addition of the max thrust along the corresponding axis. It might not reflect the accurate current max thrust
capacity of your ship, which depends on various local conditions (velocity, atmospheric density, orientation,
obstruction, engine damage, etc). This is typically used in conjunction with the control unit throttle to setup the
desired forward acceleration.
Parameters:
- taglist string Comma (for union) or space (for intersection) separated list of tags. You can set tags directly on the engines in the right-click menu.
- CRefAxis vec3 Axis along which to compute the max force in construct local coordinates.
Returns:
-
vec4,Newton
The kinematics parameters in newtons in the order: atmoRange.FMaxPlus, atmoRange.FMaxMinus,
spaceRange.FMaxPlus, spaceRange.FMaxMinus
- getCurrentBrake ()
-
Returns the current braking force genrated by construct brakes.
Returns:
-
float
The current braking force in newtons.
- getMaxBrake ()
-
Returns the maximum brake force that can currently be generated by the construct brakes.
Returns:
-
float
The maximum braking force in newtons.
- getWorldPosition ()
-
Returns the world position of the construct.
Returns:
-
vec3
The xyz world coordinates of the construct center position in meters.
- getVelocity ()
-
The construct's linear velocity, relative to its parent, in construct local coordinates.
Returns:
-
vec3
Relative linear velocity vector, in construct local coordinates in m/s.
- getWorldVelocity ()
-
The construct's linear velocity, relative to its parent, in world coordinates.
Returns:
-
vec3
Relative linear velocity vector, in world coordinates in m/s.
- getAbsoluteVelocity ()
-
The construct's absolute linear velocity, in construct local coordinates.
Returns:
-
vec3
Absolute linear velocity vector, in construct local coordinates in m/s.
- getWorldAbsoluteVelocity ()
-
The construct's absolute linear velocity, in world coordinates.
Returns:
-
vec3
Absolute linear velocity vector, in world coordinates in m/s.
- getAcceleration ()
-
The construct's linear acceleration, in construct local coordinates.
Returns:
-
vec3
Linear acceleration vector, in construct local coordinates in m/s2.
- getWorldAcceleration ()
-
The construct's linear acceleration, in world coordinates.
Returns:
-
vec3
Linear acceleration vector, in world coordinates in m/s2.
- getAngularVelocity ()
-
The construct's angular velocity, in construct local coordinates.
Returns:
-
vec3
Angular velocity vector, in construct local coordinates in rad/s.
- getWorldAngularVelocity ()
-
The constructs angular velocity, in world coordinates.
Returns:
-
vec3
Angular velocity vector, in world coordinates in rad/s.
- getAngularAcceleration ()
-
The construct's angular acceleration, in construct local coordinates.
Returns:
-
vec3
Angular acceleration vector, in construct local coordinates in rad/s2.
- getWorldAngularAcceleration ()
-
The construct's angular acceleration, in world coordinates.
Returns:
-
vec3
Angular acceleration vector, in world coordinates in rad/s2.
- getWorldAirFrictionAcceleration ()
-
Returns the acceleration generated by air resistance.
Returns:
-
vec3
The xyz world acceleration generated by air resistance.
- getWorldAirFrictionAngularAcceleration ()
-
Returns the acceleration torque generated by air resistance.
Returns:
-
vec3
The xyz world acceleration torque generated by air resistance.
- getFrictionBurnSpeed ()
-
Returns the speed at which your construct will suffer damage due to friction with the air.
Returns:
-
float
The construct speed to get damages due to friction in m/s.
- getForward ()
-
Returns the forward vector of the construct coordinates system.
Returns:
-
vec3
The forward vector of the construct coordinates system. It's a static value equal to (0, 1, 0).
- getRight ()
-
Returns the right vector of the construct coordinates system.
Returns:
-
vec3
The right vector of the construct coordinates system. It's a static value equal to (1, 0, 0).
- getUp ()
-
Returns the up vector of the construct coordinates system.
Returns:
-
vec3
The up vector of the construct coordinates system. It's a static value equal to (0, 0, 1).
- getWorldForward ()
-
Returns the forward direction of the construct, in world coordinates.
Returns:
-
vec3
The forward direction vector of the construct, in world coordinates.
- getWorldRight ()
-
Returns the right direction of the construct, in world coordinates.
Returns:
-
vec3
The right direction vector of the construct, in world coordinates.
- getWorldUp ()
-
Returns the up direction of the construct, in world coordinates.
Returns:
-
vec3
The up direction vector of the construct, in world coordinates.
- getOrientationUnitId ()
-
Returns the local ID of the current active orientation unit (core unit or gyro unit).
Returns:
-
int
The local ID of the current active orientation unit (core unit or gyro unit).
- getOrientationForward ()
-
Returns the forward direction vector of the active orientation unit, in construct local coordinates.
Returns:
-
vec3
Forward direction vector of the active orientation unit, in construct local coordinates.
- getOrientationRight ()
-
Returns the right direction vector of the active orientation unit, in construct local coordinates.
Returns:
-
vec3
Right direction vector of the active orientation unit, in construct local coordinates.
- getOrientationUp ()
-
Returns the up direction vector of the active orientation unit, in construct local coordinates.
Returns:
-
vec3
Up direction vector of the active orientation unit, in construct local coordinates.
- getWorldOrientationForward ()
-
Returns the forward direction vector of the active orientation unit, in world coordinates.
Returns:
-
vec3
Forward direction vector of the active orientation unit, in world coordinates.
- getWorldOrientationRight ()
-
Returns the right direction vector of the active orientation unit, in world coordinates.
Returns:
-
vec3
Right direction vector of the active orientation unit, in world coordinates.
- getWorldOrientationUp ()
-
Returns the up direction vector of the active orientation unit, in world coordinates.
Returns:
-
vec3
Up direction vector of the active orientation unit, in world coordinates.
- getParent ()
-
Returns the ID of the parent construct of our active construct.
Returns:
-
int
The parent ID.
- getClosestParent ()
-
Returns the ID of the nearest construct on which the construct can dock.
Returns:
-
int
The ID of the nearest construct.
- getCloseParents ()
-
Returns the list of IDs of nearby constructs, on which the construct can dock.
Returns:
-
list
List of IDs of nearby constructs.
- getParentPosition ()
-
Returns the position of the construct's parent when docked in local coordinates.
Returns:
-
vec3
The position of the constructs parent in local coordinates.
- getParentWorldPosition ()
-
Returns the position of the construct's parent when docked in world coordinates.
Returns:
-
vec3
The position of the constructs parent in world coordinates.
- getParentForward ()
-
Returns the construct's parent forward direction vector, in construct local coordinates.
Returns:
-
vec3
The construct's parent forward direction vector, in construct local coordinates.
- getParentRight ()
-
Returns the construct's parent right direction vector, in construct local coordinates.
Returns:
-
vec3
The construct's parent right direction vector, in construct local coordinates.
- getParentUp ()
-
Returns the construct's parent up direction vector, in construct local coordinates.
Returns:
-
vec3
The construct's parent up direction vector, in construct local coordinates.
- getParentWorldForward ()
-
Returns the construct's parent forward direction vector, in world coordinates.
Returns:
-
vec3
The construct's parent forward direction vector, in world coordinates.
- getParentWorldRight ()
-
Returns the construct's parent right direction vector, in world coordinates.
Returns:
-
vec3
The construct's parent right direction vector, in world coordinates.
- getParentWorldUp ()
-
Returns the construct's parent up direction vector, in world coordinates.
Returns:
-
vec3
The construct's parent up direction vector, in world coordinates.
- getPlayersOnBoard ()
-
Returns the list of player IDs on board the construct.
Returns:
-
list
The list of player IDs on board.
- getPlayersOnBoardInVRStation ()
-
Returns the list of player IDs on board the construct inside a VR station.
Returns:
-
list
The list of player IDs.
- isPlayerBoarded (id)
-
Checks if the given player is on board in the construct.
Parameters:
- id int The player ID.
Returns:
-
0/1
1 if the given player is on board.
- isPlayerBoardedInVRStation (id)
-
Returns 1 if the given player is boarded to the construct inside a VR station.
Parameters:
- id int The player ID.
Returns:
-
0/1
1 if the given player is boarded to the construct.
- getBoardedPlayerMass (id)
-
Returns the mass of the given player or surrogate if it is on board the construct.
Parameters:
- id int The player ID.
Returns:
-
float
The mass of the player.
- getBoardedInVRStationAvatarMass (id)
-
Returns the mass of the given player if in VR station on board the construct.
Parameters:
- id int The player ID.
Returns:
-
float
The mass of the player.
- getDockedConstructs ()
-
Returns the list of IDs of constructs docked to the construct.
Returns:
-
list
The list of IDs of docked constructs.
- isConstructDocked (id)
-
Checks if the given construct is docked to the construct.
Parameters:
- id int The construct ID.
Returns:
-
0/1
1 if the given construct is docked.
- getDockedConstructMass (id)
-
Returns the mass of the given construct if it is docked to the construct.
Parameters:
- id int The construct ID.
Returns:
-
float
The mass of the construct.
- setDockingMode (mode)
-
Sets the docking mode.
Parameters:
- mode int The docking mode (Manual = 1, Automatic = 2, Semi-automatic = 3).
Returns:
-
0/1
1 if the operation is a success.
- getDockingMode ()
-
Returns the current docking mode.
Returns:
-
int
The docking mode (Manual = 1, Automatic = 2, Semi-automatic = 3).
- dock (id)
-
Sends a request to dock to the given construct. Limited to piloting controllers.
Parameters:
- id int The parent construct ID.
Returns:
-
0/1
1 if the operation is a success.
- undock ()
-
Sends a request to undock the construct. Limited to piloting controllers.
Returns:
-
0/1
1 if the operation is a success.
- forceDeboard (id)
-
Sends a request to deboard a player or surrogate with the given ID.
Parameters:
- id int The player ID.
Returns:
-
0/1
1 if the operation is a success.
- forceUndock (id)
-
Sends a request to undock a construct with the given ID.
Parameters:
- id int The construct ID.
Returns:
-
0/1
1 if the operation is a success.
- forceInterruptVRSession (id)
-
Sends a request to interrupt the surrogate session of a player with the given ID.
Parameters:
- id int The player ID.
Returns:
-
0/1
1 if the operation is a success.
- load ()
- Unknown use.
- EVENT_onDocked (id)
-
Event: Emitted when the construct becomes docked.
Note: This is documentation on an event handler, not a callable method.
Parameters:
- id int The parent ID.
- EVENT_onUndocked (id)
-
Event: Emitted when the construct is undocked.
Note: This is documentation on an event handler, not a callable method.
Parameters:
- id int The previous parent ID.
- EVENT_onPlayerBoarded (id)
-
Event: Emitted when a player or surrogate boards the construct.
Note: This is documentation on an event handler, not a callable method.
Parameters:
- id int The ID of the boarding player.
- EVENT_onVRStationEntered (id)
-
Event: Emitted when a player enters a VR station.
Note: This is documentation on an event handler, not a callable method.
Parameters:
- id int The ID of the VR player.
- EVENT_onConstructDocked (id)
-
Event: Emitted when another construct docks to this construct.
Note: This is documentation on an event handler, not a callable method.
Parameters:
- id int The ID of the docking construct.
- EVENT_onPvPTimer (active)
-
Event: Emitted when the PvP timer started or elapsed.
Note: This is documentation on an event handler, not a callable method.
Parameters:
- active 0/1 1 if the timer started, 0 when the timer elapsed.