Codex


adjustor

activate()

Start the adjustor at full power (works only when run inside a cockpit or under remote control)

deactivate()

Stops the adjustor (works only when run inside a cockpit or under remote control)

isActive()

Checks if the adjustor is active

Returns
Name Type Description
integer
toggle()

Toggle the state of the adjustor

setThrust(thrust)

Set the exhaust thrust of the adjustor

Parameters
Name Type Description
thrust number The adjustor thrust in newtons (limited by the maximum thrust)
getThrust()

Returns the current exhaust thrust of the adjustor

Returns
Name Type Description
number
getMaxThrust()

Returns the maximal exhaust thrust the adjustor can deliver

Returns
Name Type Description
number
getThrustAxis()

Returns the adjustor exhaust thrust direction in construct local coordinates

Returns
Name Type Description
table
getTorqueAxis()

Returns the adjustor torque axis in construct local coordinates

Returns
Name Type Description
table
getWorldThrustAxis()

Returns the adjustor exhaust thrust direction in world coordinates

Returns
Name Type Description
table
getWorldTorqueAxis()

Returns the adjustor torque axis in world coordinates

Returns
Name Type Description
table
airfoil

getLift()

Returns the current lift of the airfoil

Returns
Name Type Description
number
getMaxLift()

Gives the maximum lift that the airfoil can generate, under optimal conditions.

Returns
Name Type Description
number
getDrag()

Returns the current drag of the airfoil

Returns
Name Type Description
number
getDragRatio()

The ratio between lift and drag, depending of the aerodynamic profile of the airfoil

Returns
Name Type Description
number
getCurrentMinLift()

Returns the minimal lift the airfoil can deliver at the moment (can be higher than zero),

Returns
Name Type Description
number
getCurrentMaxLift()

Returns the maximal lift the aifoil can deliver at the moment, which might depend on

Returns
Name Type Description
number
getMaxLiftEfficiency()

Returns the ratio between the current maximum lift and the optimal maximum lift

Returns
Name Type Description
number
getLiftAxis()

Returns the airfoil lift direction in construct local coordinates

Returns
Name Type Description
table
getTorqueAxis()

Returns the airfoil torque axis in construct local coordinates

Returns
Name Type Description
table
getWorldLiftAxis()

Returns the airfoil lift direction in world coordinates

Returns
Name Type Description
table
getWorldTorqueAxis()

Returns the adjustor torque axis in world coordinates

Returns
Name Type Description
table
isStalled()

Checks if the airfoil is stalled

Returns
Name Type Description
integer
getStallAngle()

Returns the airfoil stall angle

Returns
Name Type Description
number
getMinAngle()

Returns the minimum angle to produce the maximum lift of the airfoil

Returns
Name Type Description
number
getMaxAngle()

Returns the maximum angle to produce the maximum lift of the airfoil

Returns
Name Type Description
number
antigravitygenerator

activate()

Activate the anti-gravity generator

deactivate()

Deactivate the anti-gravity generator

isActive()

Returns the state of activation of the anti-gravity generator

Returns
Name Type Description
integer
toggle()

Toggle the anti-gravity generator

getFieldStrength()

Returns the strength of the anti-gravitational field

Returns
Name Type Description
number
getCompensationRate()

Returns the current rate of compensation of the gravitational field

Returns
Name Type Description
number
getFieldPower()

Returns the current power of the gravitational field

Returns
Name Type Description
number
getPulsorCount()

Returns the number of pulsors linked to the anti-gravity generator

Returns
Name Type Description
integer
setTargetAltitude(altitude)

Set the target altitude for the anti-gravity field. Cannot be called from onFlush

Parameters
Name Type Description
altitude number The target altitude in meters. It will be reached with a slow acceleration (not instantaneous)
getTargetAltitude()

Returns the target altitude defined for the anti-gravitational field

Returns
Name Type Description
number
getBaseAltitude()

Returns the current base altitude of the anti-gravitational field

Returns
Name Type Description
number
baseshieldgenerator

onToggled

Emitted when we started or stopped the shield generator

Parameters
Name Type Description
active integer 1 if the element was activated, 0 otherwise
onAbsorbed

Emitted when the shield absorbed incoming damage

Parameters
Name Type Description
hitpoints number Damage the shield absorbed
rawHitpoints number Total damage without taking resistances into account
onDown

Emitted when the shield hit points reached 0 due to damage

onRestored

Emitted when the shield hit points were fully restored

onEnterLockdown

Emitted when the shield enters lockdown

onLeaveLockdown

Emitted when the shield exits the lockdown

activate()

Activate the shield

deactivate()

Deactivate the shield

toggle()

Toggle the state of the shield

isActive()

Returns the activation state of the shield

Returns
Name Type Description
integer
getShieldHitpoints()

Returns the current hit points of the shield

Returns
Name Type Description
number
getMaxShieldHitpoints()

Returns the maximal hit points of the shield

Returns
Name Type Description
number
getResistances()

Returns distribution of resistance pool over resistance types

Returns
Name Type Description
resistancestable Resistance to damage type {antimatter, electromagnetic, kinetic, thermic}
setResistances(antimatter,electromagnetic,kinetic,thermic)

Distribute the resistance pool according to damage type

Parameters
Name Type Description
antimatter number Antimatter damage resistance
electromagnetic number Electromagnetic damage resistance
kinetic number Kinetic damage resistance
thermic number Thermic damage resistance
Returns
Name Type Description
integer
getResistancesCooldown()

Returns time after which adjusting resistances is possible again

Returns
Name Type Description
number
getResistancesMaxCooldown()

Returns maximal cooldown between adjusting resistances

Returns
Name Type Description
number
getResistancesPool()

Returns total resistance pool that may be distributed

Returns
Name Type Description
number
getResistancesRemaining()

Returns the remaining amount of the resistance pool that can be distributed

Returns
Name Type Description
number
getStressRatio()

Returns ratio per damage type of recent weapon impacts after applying resistance

Returns
Name Type Description
stresstable Stress ratio due to damage type {antimatter, electromagnetic, kinetic, thermic}
getStressRatioRaw()

Returns ratio per damage type of recent weapon impacts without resistance

Returns
Name Type Description
stresstable Stress ratio due to damage type {antimatter, electromagnetic, kinetic, thermic}
getStressHitpoints()

Returns stress, that is the total hit points of recent weapon impacts after applying resistance

Returns
Name Type Description
number
getStressHitpointsRaw()

Returns stress, that is the total hit points of recent weapon impacts without resistance

Returns
Name Type Description
number
inLockdown()

Returns whether the base shield is currently in lockdown

Returns
Name Type Description
integer
getLockdownRemaining()

Returns the remaining time of the base shield lockdown

Returns
Name Type Description
number
getLockdownExitTime()

Returns the hour since midnight of the preferred lockdown exit

Returns
Name Type Description
integer
setLockdownExitTime(hour)

Set hour since midnight for the preferred lockdown exit

Parameters
Name Type Description
hour integer Preferred lockdown exit hour UTC
Returns
Name Type Description
integer
brakeengine

activate()

Start the brake at full power (works only when run inside a cockpit or under remote control)

deactivate()

Stops the brake (works only when run inside a cockpit or under remote control)

isActive()

Checks if the brake is active

Returns
Name Type Description
integer
toggle()

Toggle the state of the brake

setThrust(thrust)

Set the thrust of the brake. Note that brakes can generate a force only in the movement opposite direction

Parameters
Name Type Description
thrust number The brake thrust in newtons (limited by the maximum thrust)
getThrust()

Returns the current thrust of the brake

Returns
Name Type Description
number
getMaxThrust()

Returns the maximal thrust the brake can deliver in principle, under optimal conditions.

Returns
Name Type Description
number
getCurrentMinThrust()

Returns the minimal thrust the brake can deliver at the moment (can be more than zero),

Returns
Name Type Description
number
getCurrentMaxThrust()

Returns the maximal thrust the brake can deliver at the moment, which might depend on

Returns
Name Type Description
number
getMaxThrustEfficiency()

Returns the ratio between the current maximum thrust and the optimal maximum thrust

Returns
Name Type Description
number
getThrustAxis()

Returns the brake thrust direction in construct local coordinates

Returns
Name Type Description
table
getWorldThrustAxis()

Returns the brake thrust direction in world coordinates

Returns
Name Type Description
table
construct

onDocked

Emitted when the construct becomes docked

Parameters
Name Type Description
id integer The parent id
onUndocked

Emitted when the construct is undocked

Parameters
Name Type Description
id integer The previous parent id
onPlayerBoarded

Emitted when a player or surrogate boards the construct

Parameters
Name Type Description
id integer The id of the boarding player
onVRStationEntered

Emitted when a player enters a VR Station

Parameters
Name Type Description
id integer The id of the boarding player
onConstructDocked

Emitted when another construct docks this construct

Parameters
Name Type Description
id integer The id of the docking construct
onPvPTimer

Emitted when the PvP timer started or elapsed

Parameters
Name Type Description
active boolean 1 if the timer started, false when the timer elapsed
getName()

Returns the name of the construct

Returns
Name Type Description
string
getId()

Returns the construct unique ID

Returns
Name Type Description
integer
getOwner()

Returns the owner entity

Returns
Name Type Description
entitytable 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
getCreator()

Returns the creator entity

Returns
Name Type Description
entityinteger 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
isWarping()

Checks if the construct is currently warping

Returns
Name Type Description
integer
getWarpState()

Returns the current warp state

Returns
Name Type Description
stateinteger 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 PvP zone

Returns
Name Type Description
integer
getDistanceToSafeZone()

Returns the distance between the construct and the nearest safe zone

Returns
Name Type Description
distancenumber 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
Name Type Description
timenumber The remaining time of the PvP timer, or 0.0 if elapsed
getMass()

Returns the mass of the construct

Returns
Name Type Description
number
getInertialMass()

Returns the inertial mass of the construct, calculated as 1/3 of the trace of the inertial tensor

Returns
Name Type Description
number
getInertialTensor()

Returns the inertial tensor of the construct

Returns
Name Type Description
table
getCenterOfMass()

Returns the position of the center of mass of the construct, in local construct coordinates

Returns
Name Type Description
table
getWorldCenterOfMass()

Returns the position of the center of mass of the construct, in world coordinates

Returns
Name Type Description
table
getCrossSection()

Returns the construct's cross sectional surface in the current direction of movement

Returns
Name Type Description
valuenumber 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
Name Type Description
table
getBoundingBoxSize()

Returns the size of the bounding box of the construct

Returns
Name Type Description
table
getBoundingBoxCenter()

Returns the position of the center of bounding box of the construct in local construct coordinates

Returns
Name Type Description
table
getMaxSpeed()

Returns the max speed along current moving direction

Returns
Name Type Description
valuenumber The max speed along current moving direction in m/s
getMaxAngularSpeed()

Returns the max angular speed

Returns
Name Type Description
valuenumber The max angular speed in rad/s
getMaxSpeedPerAxis()

Returns the max speed per axis

Returns
Name Type Description
valuetable 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
Name Type Description
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 table Axis along which to compute the max force (in construct reference)
Returns
Name Type Description
valuetable The kinematics parameters in Newtons in the order: atmoRange.FMaxPlus, atmoRange.FMaxMinus, spaceRange.FMaxPlus, spaceRange.FMaxMinus
getCurrentBrake()

Returns the current braking force generated by construct brakes

Returns
Name Type Description
valuenumber The current braking force in Newtons
getMaxBrake()

Returns the maximum braking force that can currently be generated by the construct brakes

Returns
Name Type Description
valuenumber The maximum braking force in Newtons
getWorldPosition()

Returns the world position of the construct

Returns
Name Type Description
valuetable 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
Name Type Description
valuetable 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
Name Type Description
valuetable Relative linear velocity vector, in world coordinates in m/s
getAbsoluteVelocity()

The construct's absolute linear velocity, in construct local coordinates

Returns
Name Type Description
valuetable Absolute linear velocity vector, in construct local coordinates in m/s
getWorldAbsoluteVelocity()

The construct's absolute linear velocity, in world coordinates

Returns
Name Type Description
valuetable Absolute linear velocity vector, in world coordinates in m/s
getAcceleration()

The construct's linear acceleration, in construct local coordinates

Returns
Name Type Description
valuetable Linear acceleration vector, in construct local coordinates in m/s2
getWorldAcceleration()

The construct's linear acceleration, in world coordinates

Returns
Name Type Description
valuetable Linear acceleration vector, in world coordinates in m/s2
getAngularVelocity()

The construct's angular velocity, in construct local coordinates

Returns
Name Type Description
valuetable Angular velocity vector, in construct local coordinates in rad/s
getWorldAngularVelocity()

The construct's angular velocity, in world coordinates

Returns
Name Type Description
valuetable Angular velocity vector, in world coordinates in rad/s
getAngularAcceleration()

The construct's angular acceleration, in construct local coordinates

Returns
Name Type Description
valuetable Angular acceleration vector, in construct local coordinates in rad/s2
getWorldAngularAcceleration()

The construct's angular acceleration, in world coordinates

Returns
Name Type Description
valuetable Angular acceleration vector, in world coordinates in rad/s2
getWorldAirFrictionAcceleration()

Returns the acceleration generated by air resistance

Returns
Name Type Description
valuetable The xyz world acceleration generated by air resistance
getWorldAirFrictionAngularAcceleration()

Returns the acceleration torque generated by air resistance

Returns
Name Type Description
valuetable 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
Name Type Description
valuenumber The construct speed to get damages due to friction in m/s
getForward()

Returns the forward vector of the construct coordinates system

Returns
Name Type Description
valuetable 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
Name Type Description
valuetable The right vector of the construct coordinates system. It's a static value equal to (1,0,0)
getUp()

Returns the up direction vector of the construct coordinates system

Returns
Name Type Description
valuetable The up vector of the construct coordinates system.. It's a static value equal to (0,0,1)
getWorldForward()

Returns the forward direction vector of the construct, in world coordinates

Returns
Name Type Description
valuetable The forward direction vector of the construct, in world coordinates
getWorldRight()

Returns the right direction vector of the construct, in world coordinates

Returns
Name Type Description
valuetable The right direction vector of the construct, in world coordinates
getWorldUp()

Returns the up direction vector of the construct, in world coordinates

Returns
Name Type Description
valuetable 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
Name Type Description
valueinteger 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
Name Type Description
valuetable 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
Name Type Description
valuetable 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
Name Type Description
valuetable 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
Name Type Description
valuetable 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
Name Type Description
valuetable 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
Name Type Description
valuetable Up direction vector of the active orientation unit, in world coordinates
getParent()

Returns the id of the parent construct of our active construct

Returns
Name Type Description
integer
getClosestParent()

Returns the id of the nearest constructs, on which the construct can dock

Returns
Name Type Description
integer
getCloseParents()

Returns the list of ids of nearby constructs, on which the construct can dock

Returns
Name Type Description
table
getParentPosition()

Returns the position of the construct's parent when docked in local coordinates

Returns
Name Type Description
valuetable The position of the construct's parent in local coordinates
getParentWorldPosition()

Returns the position of the construct's parent when docked in world coordinates

Returns
Name Type Description
valuetable The position of the construct's parent in world coordinates
getParentForward()

Returns the construct's parent forward direction vector, in local coordinates

Returns
Name Type Description
valuetable The construct's parent forward direction vector, in local coordinates
getParentRight()

Returns the construct's parent right direction vector, in construct local coordinates

Returns
Name Type Description
valuetable 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
Name Type Description
valuetable The construct's parent up direction vector, in construct local coordinates
getParentWorldForward()

Returns the construct's parent forward direction vector, in world coordinates

Returns
Name Type Description
valuetable The construct's parent forward direction vector, in world coordinates
getParentWorldRight()

Returns the construct's parent right direction vector, in world coordinates

Returns
Name Type Description
valuetable The construct's parent right direction vector, in world coordinates
getParentWorldUp()

Returns the construct's parent up direction vector, in world coordinates

Returns
Name Type Description
valuetable The construct's parent up direction vector, in world coordinates
getPlayersOnBoard()

Returns the list of player IDs on board the construct

Returns
Name Type Description
table
getPlayersOnBoardInVRStation()

Returns the list of player ids on board the construct inside a VR Station

Returns
Name Type Description
table
isPlayerBoarded(id)

Checks if the given player is on board in the construct

Parameters
Name Type Description
id integer The player id
Returns
Name Type Description
integer
isPlayerBoardedInVRStation(id)

Returns 1 if the given player is boarded to the construct inside a VR Station

Parameters
Name Type Description
id integer The player id
Returns
Name Type Description
integer
getBoardedPlayerMass(id)

Returns the mass of the given player or surrogate if it is on board the construct

Parameters
Name Type Description
id integer The player id
Returns
Name Type Description
number
getBoardedInVRStationAvatarMass(id)

Returns the mass of the given player if in VR station on board the construct

Parameters
Name Type Description
id integer The player id
Returns
Name Type Description
number
getDockedConstructs()

Returns the list of IDs of constructs docked to the construct

Returns
Name Type Description
table
isConstructDocked(id)

Checks if the given construct is docked to the construct

Parameters
Name Type Description
id integer The construct id
Returns
Name Type Description
integer
getDockedConstructMass(id)

Returns the mass of the given construct if it is docked to the construct

Parameters
Name Type Description
id integer The construct id
Returns
Name Type Description
number
setDockingMode(mode)

Sets the docking mode

Parameters
Name Type Description
mode integer The docking mode (Manual = 1, Automatic = 2, Semi-automatic = 3)
Returns
Name Type Description
integer
getDockingMode()

Returns the current docking mode

Returns
Name Type Description
modeinteger 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
Name Type Description
id integer The parent construct id
Returns
Name Type Description
integer
undock()

Sends a request to undock the construct. Limited to piloting controllers

Returns
Name Type Description
integer
forceDeboard(id)

Sends a request to deboard a player or surrogate with the given id

Parameters
Name Type Description
id integer The player id
Returns
Name Type Description
integer
forceUndock(id)

Sends a request to undock a construct with the given id

Parameters
Name Type Description
id integer The construct id
Returns
Name Type Description
integer
forceInterruptVRSession(id)

Sends a request to interrupt the surrogate session of a player with the given id

Parameters
Name Type Description
id integer The player id
Returns
Name Type Description
integer
container

onContentUpdate

Emitted when the container content is updated(storage update or after a manual request made with updateContent())

getSelfMass()

Returns the mass of the container element(as if it were empty).

Returns
Name Type Description
number
getItemsMass()

Returns the container content mass(the sum of the mass of all items it contains).

Returns
Name Type Description
number
getItemsVolume()

Returns the container content volume(the sum of the volume of all items it contains).

Returns
Name Type Description
number
getMaxVolume()

Returns the maximum volume of the container.

Returns
Name Type Description
number
getContent()

Returns a table describing the contents of the container, as a pair itemId and quantity per slot.

Returns
Name Type Description
contenttable The content of the container as a table with fields {[int] id, [float] quantity} per slot
updateContent()

Send a request to get an update of the content of the container, limited to one call allowed per 30 seconds.

Returns
Name Type Description
timenumber If the request is not yet possible, returns the remaining time to wait for.
controlunit

onTimer

Emitted when the timer with the tag 'tag' is ticking

Parameters
Name Type Description
tag string The tag of the timer that just ticked (see setTimer to set a timer with a given tag)
exit()

Stops the Control Unit's Lua code and exits. Warning: calling this might cause your ship to fall from the sky,

setTimer(tag, period)

Set up a timer with a given tag in a given period. This will start to trigger the 'onTimer' event with

Parameters
Name Type Description
tag string The tag of the timer, as a string, which will be used in the 'onTimer' event to identify this particular timer
period number The period of the timer, in seconds. The time resolution is limited by the framerate here, so you cannot set arbitrarily fast timers
stopTimer(tag)

Stop the timer with the given tag

Parameters
Name Type Description
tag string The tag of the timer to stop, as a string
getAtmosphereDensity()

Returns the ambient atmospheric density

Returns
Name Type Description
densitynumber The atmospheric density(between 0 and 1)
getClosestPlanetInfluence()

Returns the influence rate of the nearest planet

Returns
Name Type Description
ratenumber The planet influence rate(between 0 and 1)
hasDRM()

Checks if the control unit is protected by DRM

Returns
Name Type Description
integer
isRemoteControlled()

Check if the construct is remote controlled

Returns
Name Type Description
integer
setEngineCommand(taglist, acceleration, angularAcceleration, keepForceCollinearity, keepTorqueCollinearity, priority1SubTags, priority2SubTags, priority3SubTags, toleranceRatioToStopCommand)

Automatically assign the engines within the taglist

Parameters
Name Type Description
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
acceleration table The desired acceleration expressed in world coordinates in m/s2
angularAcceleration table The desired angular acceleration expressed in world coordinates in rad/s2
keepForceCollinearity boolean Forces the resulting acceleration vector to be collinear to the acceleration parameter
keepTorqueCollinearity boolean Forces the resulting angular acceleration vector to be collinear to the angular acceleration parameter
priority1SubTags string Comma (for union) or space (for intersection) separated list of tags of included engines to use as priority 1
priority2SubTags string Comma (for union) or space (for intersection) separated list of tags of included engines to use as priority 2
priority3SubTags string Comma (for union) or space (for intersection) separated list of tags of included engines to use as priority 3
toleranceRatioToStopCommand number When going through with priorities, if we reach a command that is achieved within this tolerance, we will stop there
setEngineThrust(taglist, thrust)

Sets the thrust values for all engines in the tag list

Parameters
Name Type Description
taglist string Comma separated list of tags. You can set tags directly on the engines in the right-click menu
thrust number The desired thrust in newtons (note that for boosters, any non zero value here will set them to 100%)
getEngineThrust(taglist)

Returns the total thrust values of all engines in the tag list

Parameters
Name Type Description
taglist string Comma separated list of tags. You can set tags directly on the engines in the right-click menu
Returns
Name Type Description
Thetable total thrust in newtons
setAxisCommandValue(axis, commandValue)

Set the value of throttle in the cockpit, which will be displayed in the cockpit widget when flying

Parameters
Name Type Description
axis integer Longitudinal = 0, lateral = 1, vertical = 2
commandValue number In 'by throttle', the value of the throttle position: -1 = full reverse, 1 = full forward. Or In 'By Target Speed', the value of the target speed in km/h
getAxisCommandValue(axis)

Get the value of throttle in the cockpit

Parameters
Name Type Description
axis integer Longitudinal = 0, lateral = 1, vertical = 2
Returns
Name Type Description
valuenumber In travel mode, return the value of the throttle position: -1 = full reverse, 1 = full forward or in cruise mode, return the value of the target speed
setupAxisCommandProperties(axis, commandType, targetSpeedRanges)

Set the properties of an axis command

Parameters
Name Type Description
axis integer Longitudinal = 0, lateral = 1, vertical = 2
commandType integer By throttle = 0, by target speed = 1, hidden = 2
targetSpeedRanges table This is to specify the cruise control target speed ranges (for now, only for the longitudinal axis) in m/s
getControlMode()

Returns the current control mode. The mode is set by clicking the UI button or using the associated keybinding

Returns
Name Type Description
Theinteger current control mode (for now, only 2 are available, 0 and 1)
cancelCurrentControlMasterMode()

Cancel the current master mode in use

isMouseControlActivated()

Check if a mouse control scheme is selected

Returns
Name Type Description
integer
isMouseDirectControlActivated()

Check if the mouse control direct scheme is selected

Returns
Name Type Description
integer
isMouseVirtualJoystickActivated()

Check if the mouse control virtual joystick scheme is selected

Returns
Name Type Description
integer
activateGroundEngineAltitudeStabilization(targetAltitude)

The ground engines will stabilize to this altitude within their limits

Parameters
Name Type Description
targetAltitude number The stabilization target altitude in m
getSurfaceEngineAltitudeStabilization()

Return the ground engines' stabilization altitude

Returns
Name Type Description
Stabnumber altitude in m or 0 if none is set
deactivateGroundEngineAltitudeStabilization()

The ground engines will behave like regular engine

computeGroundEngineAltitudeStabilizationCapabilities()

Returns ground engine stabilization altitude capabilities (lower and upper ranges)

Returns
Name Type Description
rangetable Stabilization altitude capabilities for the least powerful engine and the most powerful engine
getThrottle()

Return the current throttle value

Returns
Name Type Description
valuenumber Throttle value between -100 and 100
setWidgetControlModeLabel(modeId, label)

Set the label of a control mode buttons shown in the control unit widget

Parameters
Name Type Description
modeId integer The control mode: 0=Travel Mode, 1=Cruise Control by default
label string The display name of the control mode, displayed on the widget button
isAnyLandingGearDeployed()

Checks if any landing gear is deployed

Returns
Name Type Description
or0 1 1 if any landing gear is deployed
deployLandingGears()

Deploy a end

retractLandingGears()

Retract all landing gears

isAnyHeadlightSwitchedOn()

Check construct lights status

Returns
Name Type Description
integer
switchOnHeadlights()

Turn on the construct headlights

switchOffHeadlights()

Turn off the construct headlights

coreunit

onStressChanged

Emitted when core unit stress changed

Parameters
Name Type Description
stress number Difference to previous stress value
getElementIdList()

Returns the list of all the local IDs of the Elements of this construct

Returns
Name Type Description
table
getElementNameById(localId)

Returns the name of the Element, identified by its local ID

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
string
getElementClassById(localId)

Returns the class of the Element, identified by its local ID

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
string
getElementDisplayNameById(localId)

Returns the display name of the Element, identified by its local ID

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
string
getElementItemIdById(localId)

Returns the item ID of the Element, identified by its local ID

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
integer
getElementHitPointsById(localId)

Returns the current level of hit points of the Element, identified by its local ID

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
number
getElementMaxHitPointsById(localId)

Returns the maximum level of hit points of the Element, identified by its local ID

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
number
getElementMassById(localId)

Returns the mass of the Element, identified by its local ID

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
number
getElementPositionById(localId)

Returns the position of the Element, identified by its local ID, in construct local coordinates.

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
table
getElementUpById(localId)

Returns the up direction vector of the Element, identified by its local ID, in construct local coordinates

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
table
getElementRightById(localId)

Returns the right direction vector of the Element, identified by its local ID, in construct local coordinates

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
table
getElementForwardById(localId)

Returns the forward direction vector of the Element, identified by its local ID, in construct local coordinates

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
table
getElementTagsById(localId)

Returns the list of tags associated to the Element, identified by its local ID

Parameters
Name Type Description
localId integer The local ID of the Element
Returns
Name Type Description
string
getAltitude()

Returns the altitude above sea level, with respect to the closest planet (0 in space)

Returns
Name Type Description
number
getGravityIntensity()

Returns the local gravity intensity

Returns
Name Type Description
number
getWorldGravity()

Returns the local gravity vector in world coordinates

Returns
Name Type Description
table
getWorldVertical()

Returns the vertical unit vector along gravity, in world coordinates (0 in space)

Returns
Name Type Description
table
getCurrentPlanetId()

Returns the id of the current close stellar body

Returns
Name Type Description
integer
getCoreStress()

Returns the core's current stress, destroyed when reaching max stress

Returns
Name Type Description
number
getMaxCoreStress()

Returns the maximal stress the core can bear before it gets destroyed

Returns
Name Type Description
number
getCoreStressRatio()

Returns the core's current stress to max stress ratio

Returns
Name Type Description
number
spawnNumberSticker(nb,x,y,z,orientation)

Spawns a number sticker in the 3D world, with coordinates relative to the construct

Parameters
Name Type Description
nb integer The number to display 0 to 9
x number The x-coordinate in the construct in meters. 0 = center
y number The y-coordinate in the construct in meters. 0 = center
z number The z-coordinate in the construct in meters. 0 = center
orientation string Orientation of the number. Possible values are "front", "side"
Returns
Name Type Description
integer
spawnArrowSticker(x,y,z,orientation)

Spawns an arrow sticker in the 3D world, with coordinates relative to the construct

Parameters
Name Type Description
x number The x-coordinate in the construct in meters. 0 = center
y number the y-coordinate in the construct in meters. 0 = center
z number The z-coordinate in the construct in meters. 0 = center
orientation string Orientation of the arrow. Possible values are "up", "down", "north", "south", "east", "west"
Returns
Name Type Description
integer
deleteSticker(index)

Delete the referenced sticker

Parameters
Name Type Description
index integer Index of the sticker to delete
Returns
Name Type Description
integer
moveSticker(index,x,y,z)

Move the referenced sticker

Parameters
Name Type Description
index integer Index of the sticker to move
x number The x-coordinate in the construct in meters. 0 = center
y number The y-coordinate in the construct in meters. 0 = center
z number The z-coordinate in the construct in meters. 0 = center
Returns
Name Type Description
integer
rotateSticker(index,angle_x,angle_y,angle_z)

Rotate the referenced sticker.

Parameters
Name Type Description
index integer Index of the sticker to rotate
angle_x number Rotation along the x-axis in degrees
angle_y number Rotation along the y-axis in degrees
angle_z number Rotation along the z-axis in degrees
Returns
Name Type Description
integer
counter

getIndex()

Returns the index of the current active output plug

Returns
Name Type Description
integer
getMaxIndex()

Returns the maximum index of the counter

Returns
Name Type Description
integer
nextIndex()

Moves the next counter index

setIndex(index)

Sets the counter index

Parameters
Name Type Description
index integer The index of the plug to activate
databank

clear()

Clear the Databank

getNbKeys()

Returns the number of keys that are stored inside the Databank

Returns
Name Type Description
integer
getKeyList()

Returns all the keys in the Databank

Returns
Name Type Description
valuetable The key list, as a list of string
hasKey(key)

Returns 1 if the key is present in the Databank, 0 otherwise

Parameters
Name Type Description
key string The key used to store a value
Returns
Name Type Description
valueinteger 1 if the key exists and 0 otherwise
clearValue(key)

Remove the given key if the key is present in the Databank

Parameters
Name Type Description
key string The key used to store a value
Returns
Name Type Description
valueinteger 1 if the key has been successfully removed, 0 otherwise
setStringValue(key,val)

Stores a string value at the given key

Parameters
Name Type Description
key string The key used to store the value
val string The value, as a string
getStringValue(key)

Returns value stored in the given key as a string

Parameters
Name Type Description
key string The key used to retrieve the value
Returns
Name Type Description
valuestring The value as a string
setIntValue(key,val)

Stores an integer value at the given key

Parameters
Name Type Description
key string The key used to store the value
val integer The value, as an integer
getIntValue(key)

Returns value stored in the given key as an integer

Parameters
Name Type Description
key string The key used to retrieve the value
Returns
Name Type Description
valueinteger The value as an integer
setFloatValue(key,val)

Stores a floating number value at the given key

Parameters
Name Type Description
key string The key used to store the value
val number The value, as a floating number
getFloatValue(key)

Returns value stored in the given key as a floating number

Parameters
Name Type Description
key string The key used to retrieve the value
Returns
Name Type Description
valuenumber The value as a floating number
detectionzone

onEnter

Emitted when a player enters in the detection zone

Parameters
Name Type Description
id integer The ID of the player. Use system.getPlayerName(id) to retrieve its name
onLeave

Emitted when a player leaves in the detection zone

Parameters
Name Type Description
id integer The ID of the player. Use system.getPlayerName(id) to retrieve its name
getRadius()

Returns the detection zone radius

Returns
Name Type Description
number
getPlayers()

Returns the list of ids of the players in the detection zone

Returns
Name Type Description
table
door

open()

Open the door

close()

Close the door

isOpen()

Return the opening status of the door

Returns
Name Type Description
integer
toggle()

Toggle the door

element

showWidget()

Show the element widget in the in-game widget stack

hideWidget()

Hide the element widget in the in-game widget stack

getWidgetType()

Returns the widget type compatible with the element data

Returns
Name Type Description
string
getWidgetData()

Returns the element data as JSON

Returns
Name Type Description
string
getWidgetDataId()

Returns the element data ID

Returns
Name Type Description
string
getName()

Returns the element name

Returns
Name Type Description
string
getClass()

Returns the class of the Element

Returns
Name Type Description
string
getMass()

Returns the mass of the element (includes the included items' mass when the Element is a Container)

Returns
Name Type Description
number
getItemId()

Returns the element item ID (to be used with system.getItem() function to get information about the element).

Returns
Name Type Description
integer
getLocalId()

Returns the unique local ID of the element

Returns
Name Type Description
integer
getIntegrity()

Returns the element integrity between 0 and 100

Returns
Name Type Description
number
getHitPoints()

Returns the element's current hit points (0 = destroyed)

Returns
Name Type Description
number
getMaxHitPoints()

Returns the element's maximal hit points

Returns
Name Type Description
number
getRemainingRestorations()

Returns the element's remaining number of restorations

Returns
Name Type Description
integer
getMaxRestorations()

Returns the element's maximal number of restorations

Returns
Name Type Description
integer
getPosition()

Returns the position of the Element in construct local coordinates.

Returns
Name Type Description
table
getBoundingBoxSize()

Returns the bounding box dimensions of the element.

Returns
Name Type Description
table
getBoundingBoxCenter()

Returns the position of the center of bounding box of the element in local construct coordinates.

Returns
Name Type Description
table
getUp()

Returns the up direction vector of the Element in construct local coordinates

Returns
Name Type Description
table
getRight()

Returns the right direction vector of the Element in construct local coordinates

Returns
Name Type Description
table
getForward()

Returns the forward direction vector of the Element in construct local coordinates

Returns
Name Type Description
table
getWorldUp()

Returns the up direction vector of the Element in world coordinates

Returns
Name Type Description
table
getWorldRight()

Returns the right direction vector of the Element in world coordinates

Returns
Name Type Description
table
getWorldForward()

Returns the forward direction vector of the Element in world coordinates

Returns
Name Type Description
table
setSignalIn(plug, state)

Set the value of a signal in the specified IN plug of the Element.

Parameters
Name Type Description
plug string The plug name, in the form of IN-SIGNAL-index
state integer The plug signal state
getSignalIn(plug)

Returns the value of a signal in the specified IN plug of the Element.

Parameters
Name Type Description
plug string The plug name, in the form of IN-SIGNAL-index
Returns
Name Type Description
valueinteger The plug signal state
getSignalOut(plug)

Returns the value of a signal in the specified OUT plug of the Element.

Parameters
Name Type Description
plug string The plug name, in the form of IN-SIGNAL-index
Returns
Name Type Description
valueinteger The plug signal state
emitter

onSent

Emitted when the emitter successfully sent a message

Parameters
Name Type Description
channel string The channel name
message string The transmitted message
send(channel,message)

Send a message on the given channel, limited to one transmission per frame and per channel

Parameters
Name Type Description
channel string The channel name, limited to 64 characters. The message will not be sent if it exceeds this
message string The message to be transmitted, truncated to 512 characters in case of overflow
getRange()

Returns the emitter range

Returns
Name Type Description
number
engine

getObstructionFactor()

Returns the obstruction ratio of the engine exhaust by Elements and Voxels.

Returns
Name Type Description
number
getTags()

Returns the tags of the engine

Returns
Name Type Description
string
setTags(tags,ignore)

Set the tags of the engine

Parameters
Name Type Description
tags string The CSV string of the tags
ignore boolean: True to ignore the default engine tags
isIgnoringTags()

Checks if the engine is ignoring default tags

Returns
Name Type Description
1integer if the engine ignores default engine tags
firework

onFired

Emitted when a firework has just been fired

fire()

Fire the firework

setExplosionDelay(delay)

Set the delay before the launched Fireworks explodes

Parameters
Name Type Description
delay number The delay before explosion in seconds (maximum 5s)
getExplosionDelay(delay)

Returns the delay before the launched Fireworks explodes

Returns
Name Type Description
number
setLaunchSpeed(speed)

Set the speed at which the firework will be launched (impacts its altitude, depending on the local gravity).

Parameters
Name Type Description
speed number The launch speed in m/s (maximum 200m/s)
getLaunchSpeed()

Returns the speed at which the firework will be launched

Returns
Name Type Description
number
setType(type)

Set the type of launched firework (will affect which firework is picked in the attached Container)

Parameters
Name Type Description
type integer The type index of the firework (Ball = 1, Ring = 2, Palmtree = 3, Shower = 4)
getType()

Returns the type of launched firework

Returns
Name Type Description
integer
setColor(color)

Set the color of the launched firework (will affect which firework is picked in the attached Container)

Parameters
Name Type Description
color integer The color index of the firework (Blue = 1, Gold = 2, Green = 3, Purple = 4, Red = 5, Silver = 6)
getColor()

Returns the color of the launched firework

Returns
Name Type Description
integer
forcefield

deploy()

Deploys the forcefield

retract()

Retracts the forcefield

isDeployed()

Checks if the forcefield is deployed

Returns
Name Type Description
integer
toggle()

Toggle the forcefield

fueledengine

activate()

Start the engine at full power (works only when run inside a cockpit or under remote control)

deactivate()

Stops the engine (works only when run inside a cockpit or under remote control)

isActive()

Checks if the engine is active

Returns
Name Type Description
integer
toggle()

Toggle the state of the engine

setThrust(thrust)

Set the thrust of the engine

Parameters
Name Type Description
thrust number The engine thrust in newtons (limited by the maximum thrust)
getThrust()

Returns the current thrust of the engine

Returns
Name Type Description
number
getMaxThrust()

Returns the maximal thrust the engine can deliver in principle, under optimal conditions.

Returns
Name Type Description
number
getCurrentMinThrust()

Returns the minimal thrust the engine can deliver at the moment (can be more than zero),

Returns
Name Type Description
number
getCurrentMaxThrust()

Returns the maximal thrust the engine can deliver at the moment, which might depend on

Returns
Name Type Description
number
getMaxThrustEfficiency()

Returns the ratio between the current maximum thrust and the optimal maximum thrust

Returns
Name Type Description
number
isTorqueEnabled()

Checks if the torque generation is enabled on the engine

Returns
Name Type Description
integer
enableTorque(state)

Sets the torque generation state on the engine

Parameters
Name Type Description
state boolean
getThrustAxis()

Returns the engine thrust direction in construct local coordinates

Returns
Name Type Description
table
getTorqueAxis()

Returns the engine torque axis in construct local coordinates

Returns
Name Type Description
table
getWorldThrustAxis()

Returns the engine exhaust thrust direction in world coordinates

Returns
Name Type Description
table
getWorldTorqueAxis()

Returns the engine torque axis in world coordinates

Returns
Name Type Description
table
isOutOfFuel()

Checks if the engine out of fuel

Returns
Name Type Description
integer
getFuelId()

Returns the item ID of the fuel currently used by the engine

Returns
Name Type Description
integer
getFuelTankId()

Returns the local ID of the fueltank linked to the engine

Returns
Name Type Description
integer
hasFunctionalFuelTank()

Checks if the engine linked to a functional Fuel Tank (not broken or colliding)?

Returns
Name Type Description
integer
getCurrentFuelRate()

Returns the engine fuel consumption rate per newton of thrust delivered per second

Returns
Name Type Description
number
getFuelRateEfficiency()

Returns the ratio between the current fuel rate and the theoretical nominal fuel rate

Returns
Name Type Description
number
getFuelConsumption()

Returns the current fuel consumption rate

Returns
Name Type Description
number
getWarmupTime()

Returns the T50; the time needed for the engine to reach 50% of its maximal thrust (all engines

Returns
Name Type Description
number
gyro

activate()

Selects this gyro as the main gyro used for ship orientation

deactivate()

Deselects this gyro as the main gyro used for ship orientation, using the Core Unit instead

toggle()

Toggle the activation state of the gyro

isActive()

Returns the activation state of the gyro

Returns
Name Type Description
integer
getPitch()

The pitch value relative to the gyro orientation and the local gravity

Returns
Name Type Description
pitchnumber The pitch angle in degrees, relative to the gyro orientation and the local gravity
getRoll()

The roll value relative to the gyro orientation and the local gravity

Returns
Name Type Description
rollnumber The roll angle in degrees, relative to the gyro orientation and the local gravity
industry

onStarted

Emitted when the Industry Unit has started a new production process

Parameters
Name Type Description
id integer The product item id
quantity number The product quantity
onCompleted

Emitted when the Industry Unit has completed a run

Parameters
Name Type Description
id integer The product item id
quantity number The product quantity
onStatusChanged

Emitted when the industry status has changed

Parameters
Name Type Description
status integer The status of the industry can be (Stopped = 1, Running = 2, Jammed missing ingredient = 3, Jammed output full = 4, Jammed no output container = 5, Pending = 6)
onBankUpdate

Emitted when the schematic bank content is updated(bank update or after a manual request made with updateBank())

startRun()

Start the production, and it will run unless it is stopped or the input resources run out

startMaintain(quantity)

Start maintaining the specified quantity. Resumes production when the quantity in the output Container is too low, and pauses production when it is equal or higher

Parameters
Name Type Description
quantity integer Quantity to maintain inside output containers
startFor(numBatches)

Start the production of numBatches and then stop

Parameters
Name Type Description
numBatches integer Number of batches to run before unit stops
stop(force,allowLoss)

Stop the production of the industry unit

Parameters
Name Type Description
force boolean (optional by default false) True if you want to force the production to stop immediately
allowLoss boolean (optional by default false) True if you want to allow the industry unit to lose components when recovering in use components
getCyclesCompleted()

Get the count of completed cycles since the player started the unit

Returns
Name Type Description
integer
getEfficiency()

Returns the efficiency of the industry

Returns
Name Type Description
number
getUptime()

Returns the time elapsed in seconds since the player started the unit for the latest time

Returns
Name Type Description
number
getInputs()

Returns the list of items required to run the selected output product.

Returns
Name Type Description
outputstable Returns the list of products
getOutputs()

Returns the list of id of the items currently produced.

Returns
Name Type Description
outputstable The first entry in the table is always the main product produced
setOutput(itemId)

Set the item to produce from its id

Parameters
Name Type Description
itemId integer The item id of the item to produce
Returns
Name Type Description
successinteger The result of the operation 0 for a sucess, -1 if the industry is running
updateBank()

Send a request to get an update of the content of the schematic bank, limited to one call allowed per 30 seconds

Returns
Name Type Description
timenumber If the request is not yet possible, returns the remaining time to wait for
getBank()

Returns a table describing the contents of the schematic bank, as a pair itemId and quantity per slot

Returns
Name Type Description
contenttable The content of the schematic bank as a table with fields {[int] id, [float] quantity} per slot
landinggear

deploy()

Deploys the landing gear

retract()

Retracts the landing gear

isDeployed()

Checks if the landing gear is deployed

Returns
Name Type Description
integer
toggle()

Toggle the landing gear

laserdetector

onHit

Emitted when a laser hit the detector

onLoss

Emitted when all lasers stop hitting the detector

isHit()

Checks if any laser is hitting the detector

Returns
Name Type Description
integer
laseremitter

activate()

Activates the laser emitter

deactivate()

Deactivates the laser emitter

toggle()

Toggle the laser emitter

isActive()

Checks if the laser emitter is active

Returns
Name Type Description
integer
library

systemResolution3(c1,c2,c3,c0)

Solve the 3D linear system M*x=c0 where M is defined by its column vectors c1,c2,c3

Parameters
Name Type Description
c1 table The first column of the matrix M
c2 table The second column of the matrix M
c3 table The third column of the matrix M
c0 table The target column vector of the system
Returns
Name Type Description
valuetable The vec3 solution of the above system
systemResolution2(c1,c2,c0)

Solve the 2D linear system M*x=c0 where M is defined by its column vectors c1,c2

Parameters
Name Type Description
c1 table The first column of the matrix M
c2 table The second column of the matrix M
c0 table The target column vector of the system
Returns
Name Type Description
valuetable The vec2 solution of the above system
getPointOnScreen(worldPos)

Returns the position of the given point in world coordinates system, on the game screen

Parameters
Name Type Description
worldPos table: The world position of the point
Returns
Name Type Description
valuetable The position in percentage (between 0 and 1) of the screen resolution as vec3 with {x, y, depth}
light

activate()

Switches the light on

deactivate()

Switches the light off

isActive()

Checks if the light is on

Returns
Name Type Description
integer
toggle()

Toggle the state of the light

setColor(r,g,b)

Set the light color in RGB. Lights can use HDR color values above 1.0 to glow.

Parameters
Name Type Description
r number The red component, between 0.0 and 1.0, up to 5.0 for HDR colors.
g number The green component, between 0.0 and 1.0, up to 5.0 for HDR colors.
b number The blue component, between 0.0 and 1.0, up to 5.0 for HDR colors.
getColor()

Returns the light color in RGB

Returns
Name Type Description
colortable A vec3 for the red, blue and green components of the light, with values between 0.0 and 1.0, up to 5.0.
setBlinkingState(state)

Returns the blinking state of the light

Parameters
Name Type Description
state boolean True to enable light blinking
isBlinking()

Checks if the light blinking is enabled

Returns
Name Type Description
integer
getOnBlinkingDuration()

Returns the light 'on' blinking duration

Returns
Name Type Description
number
setOnBlinkingDuration(time)

Set the light 'on' blinking duration

Parameters
Name Type Description
time number The duration of the 'on' blinking in seconds
getOffBlinkingDuration()

Returns the light 'off' blinking duration

Returns
Name Type Description
number
setOffBlinkingDuration(time)

Set the light 'off' blinking duration

Parameters
Name Type Description
time number The duration of the 'off' blinking in seconds
getBlinkingTimeShift()

Returns the light blinking time shift

Returns
Name Type Description
number
setBlinkingTimeShift(shift)

Set the light blinking time shift

Parameters
Name Type Description
shift number The time shift of the blinking
manualbutton

onPressed

Emitted when the button is pressed

onReleased

Emitted when the button is released

isDown()

Checks if the manual button is down

Returns
Name Type Description
integer
manualswitch

onPressed

Emitted when the button is pressed

onReleased

Emitted when the button is released

activate()

Switches the switch on

deactivate()

Switches the switch off

toggle()

Toggle the switch

isActive()

Checks if the switch is active

Returns
Name Type Description
integer
miningunit

onCalibrated

Emitted when the mining unit is calibrated.

Parameters
Name Type Description
oreId integer The item ID of the ore extracted during the calibration process
amount number Amount of ore extracted during the calibration process
rate number The new calibration rate after calibration process
onStarted

Emitted when the mining unit started a new extraction process.

Parameters
Name Type Description
oreId number The item ID of the ore mined during the extraction process
onCompleted

Emitted when the mining unit complete a batch.

Parameters
Name Type Description
oreId number The item ID of the ore mined during the extraction process
amount number Amount of ore mined
onStatusChanged

Emitted when the mining unit status is changed.

Parameters
Name Type Description
status integer The status of the mining unit can be (Stopped = 1, Running = 2, Jammed output full = 3, Jammed no output container = 4)
onStopped

Emitted when the mining unit stopped the extraction process.

getState()

Returns the current state of the mining unit

Returns
Name Type Description
stateinteger The status of the mining unit can be (Stopped = 1, Running = 2, Jammed output full = 3, Jammed no output container = 4)
getRemainingTime()

Returns the remaining time of the current batch extraction process.

Returns
Name Type Description
number
getActiveOre()

Returns the item ID of the currently selected ore.

Returns
Name Type Description
integer
getOrePools()

Returns the list of available ore pools

Returns
Name Type Description
pooltable A list of tables composed with {[int] oreId, [float] available, [float] maximum);
getBaseRate()

Returns the base production rate of the mining unit.

Returns
Name Type Description
number
getEfficiency()

Returns the efficiency rate of the mining unit.

Returns
Name Type Description
number
getCalibrationRate()

Returns the calibration rate of the mining unit.

Returns
Name Type Description
number
getOptimalRate()

Returns the optimal calibration rate of the mining unit.

Returns
Name Type Description
number
getProductionRate()

Returns the current production rate of the mining unit.

Returns
Name Type Description
number
getAdjacencyBonus()

Returns the territory's adjacency bonus to the territory of the mining unit. Note: This value is updated only when a new batch is started.

Returns
Name Type Description
number
getLastExtractionPosition()

Returns the position of the last calibration excavation, in world coordinates.

Returns
Name Type Description
table
getLastExtractingPlayerId()

Returns the ID of the last player who calibrated the mining unit.

Returns
Name Type Description
integer
getLastExtractionTime()

Returns the time in seconds since the last calibration of the mining unit.

Returns
Name Type Description
number
getLastExtractedOre()

Returns the item ID of the ore extracted during the last calibration excavation.

Returns
Name Type Description
integer
getLastExtractedVolume()

Returns the volume of ore extracted during the last calibration excavation.

Returns
Name Type Description
number
plasmaextractor

onStarted

Emitted when the plasma extractor started a new extraction process

onCompleted

Emitted when the plasma extractor complete a batch

onStatusChanged

Emitted when the plasma extractor status is changed

Parameters
Name Type Description
status integer The status of the plasma extractor can be (Stopped = 1, Running = 2, Jammed output full = 3, Jammed no output container = 4)
onStopped

Emitted when the plasma extractor stopped the extraction process

getStatus()

Returns the current status of the plasma extractor

Returns
Name Type Description
statusinteger The status of the plasma extractor can be (Stopped = 1, Running = 2, Jammed output full = 3, Jammed no output container = 4)
getRemainingTime()

Returns the remaining time of the current batch extraction process.

Returns
Name Type Description
number
getPlasmaPools()

Returns the list of available plasma pools

Returns
Name Type Description
pooltable A list of tables composed with {[int] oreId, [float] available, [float] maximum);
player

onParentChanged

Emitted when the player parent change

Parameters
Name Type Description
oldId integer The previous parent construct ID
newId integer The new parent construct ID
getName()

Returns the player name

Returns
Name Type Description
valuestring The player name
getId()

Return the ID of the player

Returns
Name Type Description
valueinteger The ID of the player
getMass()

Returns the player mass

Returns
Name Type Description
valuenumber The mass of the player in kilograms
getNanopackMass()

Returns the player's nanopack content mass

Returns
Name Type Description
valuenumber The player's nanopack content mass in kilograms
getNanopackVolume()

Returns the player's nanopack content volume

Returns
Name Type Description
valuenumber The player's nanopack content volume in liters
getNanopackMaxVolume()

Returns the player's nanopack maximum volume

Returns
Name Type Description
valuenumber The player's nanopack maximum volume in liters
getOrgIds()

Returns the list of organization IDs of the player

Returns
Name Type Description
valuetable The list of organization IDs
getPosition()

Returns the position of the player, in construct local coordinates

Returns
Name Type Description
valuetable The position in construct local coordinates
getWorldPosition()

Returns the position of the player, in world coordinates

Returns
Name Type Description
valuetable The position in world coordinates
getHeadPosition()

Returns the position of the head of the player's character, in construct local coordinates

Returns
Name Type Description
valuetable 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
Name Type Description
valuetable The position of the head in world coordinates
getVelocity()

Returns the velocity vector of the player, in construct local coordinates

Returns
Name Type Description
valuetable The velocity vector in construct local coordinates
getWorldVelocity()

Returns the velocity vector of the player, in world coordinates

Returns
Name Type Description
valuetable The velocity vector in world coordinates
getAbsoluteVelocity()

Returns the absolute velocity vector of the player, in world coordinates

Returns
Name Type Description
valuetable The velocity absolute vector in world coordinates
getForward()

Returns the forward direction vector of the player, in construct local coordinates

Returns
Name Type Description
valuetable The forward direction vector in construct local coordinates
getRight()

Returns the right direction vector of the player, in construct local coordinates

Returns
Name Type Description
valuetable The right direction vector in construct local coordinates
getUp()

Returns the up direction vector of the player, in construct local coordinates

Returns
Name Type Description
valuetable The up direction vector in construct local coordinates
getWorldForward()

Returns the forward direction vector of the player, in world coordinates

Returns
Name Type Description
valuetable The forward direction vector in world coordinates
getWorldRight()

Returns the right direction vector of the player, in world coordinates

Returns
Name Type Description
valuetable The right direction vector in world coordinates
getWorldUp()

Returns the up direction vector of the player, in world coordinates

Returns
Name Type Description
valuetable The up direction vector in world coordinates
getPlanet()

Returns the id of the planet the player is located on

Returns
Name Type Description
valueinteger The id of the planet, 0 if none
getParent()

Returns the identifier of the construct to which the player is parented

Returns
Name Type Description
valueinteger The id of the construct, 0 if none
isSeated()

Checks if the player is seated

Returns
Name Type Description
valueinteger 1 if the player is seated
getSeatId()

Returns the local id of the seat on which the player is sitting

Returns
Name Type Description
valueinteger The local id of the seat, or 0 is not seated
isParentedTo(id)

Checks if the player is parented to the given construct

Parameters
Name Type Description
id integer The construct id
Returns
Name Type Description
valueinteger 1 if the player is parented to the given construct
isSprinting()

Checks if the player is currently sprinting

Returns
Name Type Description
valueinteger 1 if the player is sprinting
isJetpackOn()

Checks if the player's jetpack is on

Returns
Name Type Description
valueinteger 1 if the player's jetpack is on
isHeadlightOn()

Returns the state of the headlight of the player

Returns
Name Type Description
1integer if the player has his headlight on
setHeadlightOn(state)

Set the state of the headlight of the player

Parameters
Name Type Description
state boolean : True to turn on headlight
freeze(state)

Freezes the player movements, liberating the associated movement keys to be used by the script.

Parameters
Name Type Description
state boolean 1 freeze the character, 0 unfreeze the character
isFrozen()

Checks if the player movements are frozen

Returns
Name Type Description
valueinteger 1 if the player is frozen, 0 otherwise
hasDRMAutorization()

Checks if the player has DRM autorization to the control unit

Returns
Name Type Description
valueinteger 1 if the player has DRM autorization on the control unit
pressuretile

onPressed

Emitted when the pressure tile is pressed

onReleased

Emitter when the pressure tile is released

isDown()

Checks if the pressure tile is down

Returns
Name Type Description
integer
radar

onEnter

Emitted when a Construct enters the scan range of the radar

Parameters
Name Type Description
id integer The ID of the construct
onLeave

Emitted when a construct leaves the range of the radar

Parameters
Name Type Description
id integer The ID of the construct
onIdentified

Emitted when a construct is identified

Parameters
Name Type Description
id integer The ID of the construct
getOperationalState()

Returns 1 if the radar is not broken, works in the current environment and is not used by another control unit

Returns
Name Type Description
stateinteger 1 if the radar is operational, otherwise: 0 = broken, -1 = bad environment, -2 = obstructed, -3 = already in use
getRange()

Returns the scan range of the radar

Returns
Name Type Description
valuenumber The scan range
getIdentifyRanges()

Returns ranges to identify a target based on its core size

Returns
Name Type Description
rangestable The list of float values for ranges in meters as { xsRange, sRange, mRange, lRange }
getConstructIds()

Returns the list of construct IDs in the scan range

Returns
Name Type Description
table
getIdentifiedConstructIds()

Returns the list of identified construct IDs

Returns
Name Type Description
table
getTargetId()

Returns the ID of the target construct

Returns
Name Type Description
integer
getConstructDistance(id)

Returns the distance to the given construct

Returns
Name Type Description
number
isConstructIdentified(id)

Returns 1 if the given construct is identified

Returns
Name Type Description
integer
isConstructAbandoned(id)

Returns 1 if the given construct was abandoned

Returns
Name Type Description
integer
getConstructCoreSize(id)

Returns the core size of the given construct

Returns
Name Type Description
sizestring The core size name; can be 'XS', 'S', 'M', 'L', 'XL'
getThreatRateTo(id)

Returns the threat rate your construct is for the given construct

Returns
Name Type Description
threatinteger The threat rate index (None = 1, Identified = 2, Threatened and identified = 3, Threatened = 4, Attacked = 5), can be -1 if the radar is not operational
getThreatRateFrom(id)

Returns the threat rate the given construct is for your construct

Returns
Name Type Description
threatstring The threat rate index (None = 1, Identified = 2, Threatened and identified = 3, Threatened = 4, Attacked = 5), can be -1 if the radar is not operational
hasMatchingTransponder(id)

Returns whether the target has an active Transponder with matching tags

Returns
Name Type Description
integer
getConstructOwnerEntity(id)

Returns a table with id of the owner entity (player or organization) of the given construct, if in range and if active transponder tags match for owned dynamic constructs.

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
entitytable A table with fields {[int] id, [bool] isOrganization} describing the owner. Use system.getPlayerName(id) and system.getOrganization(id) to retrieve info about it
getConstructSize(id)

Return the size of the bounding box of the given construct, if in range

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
table
getConstructKind(id)

Return the kind of the given construct

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
kindinteger The kind index of the construct (Universe = 1, Planet = 2,Asteroid = 3,Static = 4,Dynamic = 5,Space = 6,Alien = 7)
getConstructPos(id)

Returns the position of the given construct in construct local coordinates, if active transponder tags match for owned dynamic constructs

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
table
getConstructWorldPos(id)

Returns the position of the given construct in world coordinates, if in range and if active transponder tags match for owned dynamic constructs

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
table
getConstructVelocity(id)

Returns the velocity vector of the given construct in construct local coordinates, if identified and if active transponder tags match for owned dynamic constructs

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
table
getConstructWorldVelocity(id)

Returns the velocity vector of the given construct in world coordinates, if identified and if active transponder tags match for owned dynamic constructs

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
table
getConstructMass(id)

Returns the mass of the given construct, if identified for owned dynamic constructs

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
massnumber The mass of the construct in kilograms
getConstructName(id)

Return the name of the given construct, if defined

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
string
getConstructInfos(id)

Returns a table of working elements on the given construction, if identified for owned dynamic constructs

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
infotable A table with fields : {[float] weapons, [float] radars, [float] antiGravity, [float] atmoEngines, [float] spaceEngines, [float] rocketEngines} with values between 0.0 and 1.0. Exceptionally antiGravity and rocketEngines are always 1.0 if present, even if broken
getConstructSpeed(id)

Returns the speed of the given construct, if identified for owned dynamic constructs

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
speednumber The speed of the construct relative to the universe in meters per second
getConstructAngularSpeed(id)

Returns the angular speed of the given construct to your construct, if identified for owned dynamic constructs

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
speednumber The angular speed of the construct relative to our construct in radians per second
getConstructRadialSpeed(id)

Returns the radial speed of the given construct to your construct, if identified for owned dynamic constructs

Parameters
Name Type Description
id integer The ID of the construct
Returns
Name Type Description
speednumber The radial speed of the construct relative to our construct in meters per second
receiver

onReceived

Emitted when a message is received on any channel defined on the element

Parameters
Name Type Description
channel string The channel; can be used as a filter
message string The message received
getRange()

Returns the receiver range

Returns
Name Type Description
number
hasChannel(channel)

Checks if the given channel exists in the receiver channels list

Parameters
Name Type Description
channel string The channels list as Lua table
Returns
Name Type Description
integer
setChannelList(channels)

Set the channels list

Parameters
Name Type Description
channels table The channels list as Lua table
Returns
Name Type Description
1integer if the channels list has been successfully set
getChannelList()

Returns the channels list

Returns
Name Type Description
channelstable The channels list as Lua table
screenunit

onMouseDown

Emitted when the player starts a click on the screen

Parameters
Name Type Description
x number X-coordinate of the click in percentage (between 0 and 1) of the screen width
y number Y-coordinate of the click in percentage (between 0 and 1) the screen height
onMouseUp

Emitted when the player releases a click on the screen

Parameters
Name Type Description
x number X-coordinate of the click in percentage (between 0 and 1) of the screen width
y number Y-coordinate of the click in percentage (between 0 and 1) the screen height
onOutputChanged

Emitted when the output of the screen is changed

Parameters
Name Type Description
output string The output string of the screen
activate()

Switch on the screen

deactivate()

Switch off the screen

isActive()

Checks if the screen is on

Returns
Name Type Description
1integer if the screen is on
toggle()

Toggle the state of the screen

addText(x,y,fontSize,text)

Displays the given text at the given coordinates in the screen, and returns an ID to move it later

Parameters
Name Type Description
x number Horizontal position, as a percentage (between 0 and 100) of the screen width
y number Vertical position, as a percentage (between 0 and 100) of the screen height
fontSize number Text font size, as a percentage of the screen width
text string The text to display
Returns
Name Type Description
integer
setCenteredText(text)

Displays the given text centered in the screen with a font to maximize its visibility

Parameters
Name Type Description
text string The text to display
setHTML(html)

Set the whole screen HTML content (overrides anything already set)

Parameters
Name Type Description
html string The HTML content to display
setRenderScript(script)

Set the screen render script, switching the screen to native rendering mode

Parameters
Name Type Description
script string The Lua render script
setScriptInput(input)

Defines the input of the screen rendering script, which will be automatically defined during the execution of Lua

Parameters
Name Type Description
input string A string that can be retrieved by calling getInput in a render script
clearScriptOutput()

Set the screen render script output to the empty string

getScriptOutput()

Get the screen render script output

Returns
Name Type Description
valuestring The contents of the last render script setOutput call, or an empty string
addContent(x,y,html)

Displays the given HTML content at the given coordinates in the screen, and returns an ID to move it later

Parameters
Name Type Description
x number Horizontal position, as a percentage (between 0 and 100) of the screen width
y number Vertical position, as a percentage (between 0 and 100) of the screen height
html string The HTML content to display, which can contain SVG html elements to make drawings
Returns
Name Type Description
integer
setSVG(svg)

Displays SVG code (anything that fits within a section), which overrides any preexisting content

Parameters
Name Type Description
svg string The SVG content to display, which fits inside a 1920x1080 canvas
resetContent(id,html)

Update the html element with the given ID (returned by addContent) with a new HTML content

Parameters
Name Type Description
id integer An integer ID that is used to identify the html element in the screen. Methods such as addContent return the ID that you can store to use later here
html string The HTML content to display, which can contain SVG html elements to make drawings
deleteContent(id)

Delete the html element with the given ID (returned by addContent)

Parameters
Name Type Description
id integer An integer ID that is used to identify the html element in the screen. Methods such as addContent return the id that you can store to use later here
showContent(id,state)

Update the visibility of the html element with the given ID (returned by addContent)

Parameters
Name Type Description
id integer An integer ID that is used to identify the html element in the screen. Methods such as addContent return the ID that you can store to use later here
state boolean true to show the content, false to hide
moveContent(id,x,y)

Move the html element with the given id (returned by addContent) to a new position in the screen

Parameters
Name Type Description
id integer An integer id that is used to identify the html element in the screen. Methods such as addContent return the ID that you can store to use later here
x number Horizontal position, as a percentage (between 0 and 100) of the screen width
y number Vertical position, as a percentage (between 0 and 100) of the screen height
getMouseX()

Returns the x-coordinate of the position point at in the screen

Returns
Name Type Description
xnumber The x-position as a percentage (between 0 and 1) of screen width; -1 if nothing is point at
getMouseY()

Returns the y-coordinate of the position point at in the screen

Returns
Name Type Description
ynumber The y-position as a percentage (between 0 and 1) of screen height; -1 if nothing is point at
getMouseState()

Returns the state of the mouse click

Returns
Name Type Description
1integer if the mouse is pressed, otherwise 0
clear()

Clear the screen

shieldgenerator

onToggled

Emitted when we started or stopped the shield generator

Parameters
Name Type Description
active integer 1 if the element was activated, 0 otherwise
onAbsorbed

Emitted when the shield absorbed incoming damage

Parameters
Name Type Description
hitpoints number Damage the shield absorbed
rawHitpoints number Total damage without taking resistances into account
onVenting

Emitted when venting started, stopped or restored some hitpoints

Parameters
Name Type Description
active integer 1 when venting is active, 0 otherwise
restoredHitpoints number Hitpoints restored since the last venting step
onDown

Emitted when the shield hit points reached 0 due to damage

onRestored

Emitted when the shield hit points were fully restored

activate()

Activate the shield

deactivate()

Deactivate the shield

toggle()

Toggle the state of the shield

isActive()

Returns the activation state of the shield

Returns
Name Type Description
integer
getShieldHitpoints()

Returns the current hit points of the shield

Returns
Name Type Description
number
getMaxShieldHitpoints()

Returns the maximal hit points of the shield

Returns
Name Type Description
number
startVenting()

Activate shield venting to restore hit points

Returns
Name Type Description
stateinteger 1 if venting started, 0 if an error occurred
stopVenting()

Stop shield venting

Returns
Name Type Description
stateinteger 1 if venting stopped, 0 if an error occurred
isVenting()

Check whether venting is in progress

Returns
Name Type Description
stateinteger 1 if venting is ongoing, 0 otherwise
getVentingCooldown()

Returns time after which venting is possible again

Returns
Name Type Description
valuenumber Remaining seconds of the venting cooldown
getVentingMaxCooldown()

Returns maximal cooldown between venting

Returns
Name Type Description
valuenumber Maximal seconds of the venting cooldown
getResistances()

Returns distribution of resistance pool over resistance types

Returns
Name Type Description
resistancestable Resistance to damage type {antimatter, electromagnetic, kinetic, thermic}
setResistances(antimatter,electromagnetic,kinetic,thermic)

Distribute the resistance pool according to damage type

Parameters
Name Type Description
antimatter number Antimatter damage resistance
electromagnetic number Electromagnetic damage resistance
kinetic number Kinetic damage resistance
thermic number Thermic damage resistance
Returns
Name Type Description
integer
getResistancesCooldown()

Returns time after which adjusting resistances is possible again

Returns
Name Type Description
number
getResistancesMaxCooldown()

Returns maximal cooldown between adjusting resistances

Returns
Name Type Description
number
getResistancesPool()

Returns total resistance pool that may be distributed

Returns
Name Type Description
number
getResistancesRemaining()

Returns the remaining amount of the resistance pool that can be distributed

Returns
Name Type Description
number
getStressRatio()

Returns ratio per damage type of recent weapon impacts after applying resistance

Returns
Name Type Description
stresstable Stress ratio due to damage type {antimatter, electromagnetic, kinetic, thermic}
getStressRatioRaw()

Returns ratio per damage type of recent weapon impacts without resistance

Returns
Name Type Description
stresstable Stress ratio due to damage type {antimatter, electromagnetic, kinetic, thermic}
getStressHitpoints()

Returns stress, that is the total hit points of recent weapon impacts after applying resistance

Returns
Name Type Description
number
getStressHitpointsRaw()

Returns stress, that is the total hit points of recent weapon impacts without resistance

Returns
Name Type Description
number
spaceminingunit

onStarted

Emitted when the space mining unit started a new extraction process.

Parameters
Name Type Description
oreId number The item ID of the ore mined during the extraction process
onCompleted

Emitted when the space mining unit complete a batch.

Parameters
Name Type Description
oreId number The item ID of the ore mined during the extraction process
amount number Amount of ore mined
onStatusChanged

Emitted when the space mining unit status is changed.

Parameters
Name Type Description
status integer The status of the space mining unit can be
onStopped

Emitted when the space mining unit stopped the extraction process.

getState()

Returns the current state of the space mining unit

Returns
Name Type Description
stateinteger The status of the space mining unit can be (Stopped = 1, Running = 2, Jammed output full = 3, Jammed no output container = 4)
getRemainingTime()

Returns the remaining time of the current batch extraction process.

Returns
Name Type Description
number
getActiveOre()

Returns the item ID of the currently selected ore.

Returns
Name Type Description
integer
getOrePools()

Returns the list of available ore pools

Returns
Name Type Description
pooltable A list of tables composed with {[int] oreId, [float] available, [float] maximum);
getBaseRate()

Returns the base production rate of the space mining unit.

Returns
Name Type Description
number
getEfficiency()

Returns the efficiency rate of the space mining unit.

Returns
Name Type Description
number
getCalibrationRate()

Returns the calibration rate of the space mining unit.

Returns
Name Type Description
number
getOptimalRate()

Returns the optimal calibration rate of the space mining unit.

Returns
Name Type Description
number
getProductionRate()

Returns the current production rate of the space mining unit.

Returns
Name Type Description
number
surfaceengine

getDistance()

Returns the distance to the first object detected in the direction of the thrust

Returns
Name Type Description
number
getMaxDistance()

Returns the maximum functional distance from the ground

Returns
Name Type Description
number
system

onActionStart

Emitted when an action starts

Parameters
Name Type Description
action string The action name, represented as a string taken among the set of predefined Lua-available actions (you can check the drop down list to see what is available)
onActionStop

Emitted when an action stops

Parameters
Name Type Description
action string The action name, represented as a string taken among the set of predefined Lua-available actions (you can check the drop down list to see what is available)
onActionLoop

Emitted at each update as long as the action is maintained

Parameters
Name Type Description
action string The action name, represented as a string taken among the set of predefined Lua-available actions (you can check the drop down list to see what is available)
onUpdate

Game update event. This is equivalent to a timer set at 0 seconds, as updates will go as fast as the FPS can go

onFlush

Physics update. Do not use to put anything else by a call to updateICC on your Control Unit, as many functions are

onInputText

A new message has been entered in the Lua tab of the chat, acting like a command line interface

Parameters
Name Type Description
text string The message entered
onCameraChanged

Emitted when the player changes the camera mode.

Parameters
Name Type Description
mode integer The camera mode, represented by an integer (First Person View = 1, Look Around Construct View = 2, Follow Construct View = 3)
getActionKeyName(actionName)

Return the currently key bound to the given action. Useful to display tips.

Parameters
Name Type Description
actionName string The action name, represented as a string taken among the set of predefined Lua-available actions (you can check the drop down list to see what is available)
Returns
Name Type Description
valuestring The key associated to the given action name
showScreen(bool)

Control the display of the Control Unit custom screen, where you can define customized display information in HTML.

Parameters
Name Type Description
bool boolean True to show the screen, false to hide the screen
setScreen(content)

Set the content of the Control Unit custom screen with some HTML code.

Parameters
Name Type Description
content string The HTML content you want to display on the screen widget. You can also use SVG here to make drawings.
createWidgetPanel(label)

Create an empty panel.

Parameters
Name Type Description
label string The title of the panel
Returns
Name Type Description
valuestring The panel ID, or "" on failure
destroyWidgetPanel(panelId)

Destroy the panel.

Parameters
Name Type Description
panelId string The panel ID
Returns
Name Type Description
valueinteger 1 on success, 0 on failure.
createWidget(panelId, type)

Create an empty widget and add it to a panel.

Parameters
Name Type Description
panelId string The panel ID
type string Widget type, determining how it will display data attached to ID
Returns
Name Type Description
valuestring The widget ID, or "" on failure.
destroyWidget(widgetId)

Destroy the widget.

Parameters
Name Type Description
widgetId string The widget ID
Returns
Name Type Description
valueinteger 1 on success, 0 on failure.
createData(dataJson)

Create data.

Parameters
Name Type Description
dataJson string The data fields as JSON
Returns
Name Type Description
valuestring The data ID, or "" on failure.
destroyData(dataId)

Destroy the data.

Parameters
Name Type Description
dataId string The data ID
Returns
Name Type Description
valueinteger 1 on success, 0 on failure.
updateData(dataId, dataJson)

Update JSON associated to data.

Parameters
Name Type Description
dataId string The data ID
dataJson string The data fields as JSON
Returns
Name Type Description
valueinteger 1 on success, 0 on failure.
addDataToWidget(dataId, widgetId)

Add data to widget.

Parameters
Name Type Description
dataId string The data ID
widgetId string The widget ID
Returns
Name Type Description
valueinteger 1 on success, 0 on failure.
removeDataFromWidget(dataId, widgetId)

Remove data from widget.

Parameters
Name Type Description
dataId string The data ID
widgetId string The widget ID
Returns
Name Type Description
valueinteger 1 on success, 0 on failure.
getMouseWheel()

Return the current value of the mouse wheel

Returns
Name Type Description
valuenumber The current value of the mouse wheel
getMouseDeltaX()

Return the current value of the mouse delta X

Returns
Name Type Description
valuenumber The current value of the mouse delta X
getMouseDeltaY()

Return the current value of the mouse delta Y

Returns
Name Type Description
valuenumber The current value of the mouse delta Y
getMousePosX()

Return the current value of the mouse pos X

Returns
Name Type Description
valuenumber The current value of the mouse pos X
getMousePosY()

Return the current value of the mouse pos Y

Returns
Name Type Description
valuenumber The current value of the mouse pos Y
getMouseSensitivity()

Return the value of mouse sensitivity game setting

Returns
Name Type Description
valuenumber Sensitivity setting value
getScreenHeight()

Return the current value of the screen height

Returns
Name Type Description
valueinteger The current value of the screen height
getScreenWidth()

Return the current value of the screen width

Returns
Name Type Description
valueinteger The current value of the screen width
getCameraHorizontalFov()

Return the current value of the player's horizontal field of view

Returns
Name Type Description
valuenumber The current value of the player's horizontal field of view
getCameraVerticalFov()

Return the current value of the player's vertical field of view

Returns
Name Type Description
valuenumber The current value of the player's vertical field of view
getCameraMode()

Returns the active camera mode.

Returns
Name Type Description
modeinteger 1: First Person View, 2: Look Around Construct View, 3: Follow Construct View
isFirstPerson()

Checks if the active camera is in first person view.

Returns
Name Type Description
valueinteger 1 if the camera is in first person view.
getCameraPos()

Returns the position of the camera, in construct local coordinates.

Returns
Name Type Description
valuetable Camera position in construct local coordinates.
getCameraWorldPos()

Returns the position of the camera, in world coordinates.

Returns
Name Type Description
valuetable Camera position in world coordinates.
getCameraWorldForward()

Returns the forward direction vector of the active camera, in world coordinates.

Returns
Name Type Description
valuetable Camera forward direction vector in world coordinates.
getCameraWorldRight()

Returns the right direction vector of the active camera, in world coordinates.

Returns
Name Type Description
valuetable Camera right direction vector in world coordinates.
getCameraWorldUp()

Returns the up direction vector of the active camera, in world coordinates.

Returns
Name Type Description
valuetable Camera up direction vector in world coordinates.
getCameraForward()

Returns the forward direction vector of the active camera, in construct local coordinates.

Returns
Name Type Description
valuetable Camera forward direction vector in construct local coordinates.
getCameraRight()

Returns the right direction vector of the active camera, in construct local coordinates.

Returns
Name Type Description
valuetable Camera right direction vector in construct local coordinates.
getCameraUp()

Returns the up direction vector of the active camera, in construct local coordinates.

Returns
Name Type Description
valuetable Camera up direction vector in construct local coordinates.
getThrottleInputFromMouseWheel()

Return the current value of the mouse wheel (for the throttle speedUp/speedDown action)

Returns
Name Type Description
valuenumber The current input
getControlDeviceForwardInput()

Return the mouse input for the ship control action (forward/backward)

Returns
Name Type Description
valuenumber The current input
getControlDeviceYawInput()

Return the mouse input for the ship control action (yaw right/left)

Returns
Name Type Description
valuenumber The current input
getControlDeviceLeftRightInput()

Return the mouse input for the ship control action (right/left)

Returns
Name Type Description
valuenumber The current value of the mouse delta Y
lockView(state)

Lock or unlock the mouse free look.

Parameters
Name Type Description
state boolean true to lock and false to unlock
isViewLocked()

Return the lock state of the mouse free look

Returns
Name Type Description
valueinteger 1 when locked and 0 when unlocked
getArkTime()

Return the current time since the arrival of the Arkship on September 30th, 2017

Returns
Name Type Description
valuenumber Time in seconds
getUtcTime()

Return the current time since January 1st, 1970.

Returns
Name Type Description
valuenumber Time in seconds
getUtcOffset()

Return the time offset between local timezone and UTC

Returns
Name Type Description
valuenumber Time in seconds
getLocale()

Return the locale in which the game is currently running

Returns
Name Type Description
valuestring The locale, currently one of "en-US", "fr-FR", or "de-DE"
getActionUpdateDeltaTime()

Return delta time of action updates (to use in ActionLoop)

Returns
Name Type Description
valuenumber The delta time in seconds
getPlayerName(id)

Return the name of the given player, if in range of visibility or broadcasted by a transponder

Parameters
Name Type Description
id integer The ID of the player
Returns
Name Type Description
valuestring The name of the player
getPlayerWorldPos(id)

Return the world position of the given player, if in range of visibility

Parameters
Name Type Description
id integer The ID of the player
Returns
Name Type Description
valuetable The coordinates of the player in world coordinates
getItem(id)

Return the item table corresponding to the given item ID.

Parameters
Name Type Description
id integer The ID of the item
Returns
Name Type Description
valuetable An item table with fields: {[int] id, [string] name, [string] displayName, [string] locDisplayName, [string] displayNameWithSize, [string] locDisplayNameWithSize, [string] description, [string] locDescription, [string] type, [number] unitMass, [number] unitVolume, [integer] tier, [string] scale, [string] iconPath, [table] schematics, [table] products}
getRecipes(itemId)

Returns a list of recipes producing the given item from its id.

Parameters
Name Type Description
itemId integer The ID of the item
Returns
Name Type Description
valuetable A list of recipe table with field: {[int] id, [int] tier,[double] time, [bool] nanocraftable, [table] products:{{[int] id, [double] quantity},...}, [table] ingredients:{{[int] id, [double] quantity},...}}
getOrganization(id)

Returns the corresping organization to the given organization id, if known, e.g. broadcasted by a transponder

Parameters
Name Type Description
id integer The ID of the organization
Returns
Name Type Description
valuetable A table containing information about the given organization {[string] name, [string] tag}
getWaypointFromPlayerPos()

Return the player's world position as a waypoint string, starting with '::pos' (only in explicit runs)

Returns
Name Type Description
valuestring The waypoint as a string
setWaypoint(waypointStr,notify)

Set a waypoint at the destination described by the waypoint string, of the form '::pos{...}' (only in explicit runs)

Parameters
Name Type Description
waypointStr string The waypoint as a string
notify boolean (Optional) True to display a notification on waypoint change
clearWaypoint(notify)

Clear the active destination waypoint. (only in explicit runs)'

Parameters
Name Type Description
notify boolean (Optional) True to display a notification about the waypoint's clearing
showHelper(show)

Set the visibility of the helper top menu.

Parameters
Name Type Description
show boolean True to show the top helper menu, false to hide the top helper menu
playSound(filePath)

Play a sound file from your audio folder (located in "My documents/NQ/DualUniverse/audio"). Only one sound can be played at a time.

Parameters
Name Type Description
filePath string Relative path to audio folder (.mp3, .wav)
isPlayingSound()

Checks if a sound is playing

Returns
Name Type Description
valueinteger 1 if a sound is playing
stopSound()

Stop the current playing sound

print(msg)

Print the given string in the Lua chat channel

Parameters
Name Type Description
msg string
telemeter

raycast()

Emits a raycast from the telemeter, returns a raycastHit object

Returns
Name Type Description
hittable A table with fields : {[bool] hit, [float] distance, [vec3] point}
getRayOrigin()

Returns telemeter raycast origin in local construct coordinates

Returns
Name Type Description
table
getRayWorldOrigin()

Returns telemeter raycast origin in world coordinates

Returns
Name Type Description
table
getRayAxis()

Returns telemeter raycast axis in local construct coordinates

Returns
Name Type Description
table
getRayWorldAxis()

Returns telemeter raycast axis in world coordinates

Returns
Name Type Description
table
getMaxDistance()

Returns the max distance from which an obstacle can be detected (default is 100m)

Returns
Name Type Description
number
transponder

onToggled

Emitted when the transponder is started or stopped

Parameters
Name Type Description
active integer 1 if the element was activated, 0 otherwise
activate()

Activate the transponder

deactivate()

Deactivate the transponder

toggle()

Toggle the state of the transponder

isActive()

Checks if the transponder is active

Returns
Name Type Description
integer
setTags(tags)

Set the tags list with up to 8 entries. Returns 1 if the application was successful, 0 if the tag

Parameters
Name Type Description
tags table List of up to 8 transponder tag strings
Returns
Name Type Description
integer
getTags()

Returns the tag list

Returns
Name Type Description
tagstable List of up to 8 transponder tag strings
warpdrive

initiate()

Initiate the warp jump process

getStatus()

Returns the current status of the warp drive

Returns
Name Type Description
statusinteger The current status of the warp drive (NoWarpDrive = 1, Broken = 2, Warping = 3, ParentWarping = 4, NotAnchored = 5, WarpCooldown = 6, PvPCooldown = 7, MovingChild = 8, NoContainer = 9, PlanetTooClose = 10, DestinationNotSet = 11, DestinationTooClose = 12, DestinationTooFar = 13, NotEnoughWarpCells = 14, Ready = 15)
getDistance()

Returns the distance to the current warp destination

Returns
Name Type Description
number
getDestination()

Returns the construct ID of the current warp destination

Returns
Name Type Description
integer
getDestinationName()

Returns the name of the current warp destination construct

Returns
Name Type Description
string
getContainerId()

Returns the local id of the container linked to the warp drive

Returns
Name Type Description
integer
getAvailableWarpCells()

Returns the quantity of warp cells available in the linked container

Returns
Name Type Description
integer
getRequiredWarpCells()

Returns the quantity of warp cells required to warp to the warp destination set

Returns
Name Type Description
integer
weapon

onReload

Emitted when the weapon start reloading

Parameters
Name Type Description
ammoId integer The item id of the ammo
onReloaded

Emitted when the weapon has reloaded

Parameters
Name Type Description
ammoId integer The item id of the ammo
onMissed

Emitted when the weapon has missed its target

Parameters
Name Type Description
targetId integer The construct id of the target
onDestroyed

Emitted when the weapon target has been destroyed

Parameters
Name Type Description
targetId integer The construct id of the target
onElementDestroyed

Emitted when an element on the weapon target has been destroyed

Parameters
Name Type Description
targetId integer The construct id of the target
itemId integer The item id of the destroyed element
onHit

Emitted when the weapon has hit

Parameters
Name Type Description
targetId integer The construct id of the target
damage number The damage amount dealt by the hit
getAmmo()

Returns the item id of the currently equipped ammo

Returns
Name Type Description
integer
getAmmoCount()

Returns the current amount of remaining ammunition

Returns
Name Type Description
integer
getMaxAmmo()

Returns the maximum amount of ammunition the weapon can carry

Returns
Name Type Description
integer
isOutOfAmmo()

Checks if the weapon is out of ammo

Returns
Name Type Description
integer
getOperationalState()

Returns 1 if the weapon is not broken and compatible with the construct size

Returns
Name Type Description
stateinteger 1 if the weapon is operational, otherwise 0 = broken, -1 = incompatible size
getStatus()

Returns the current weapon status

Returns
Name Type Description
statusinteger The current status of the weapon (Idle = 1, Firing = 2, Reloading = 3, Unloading = 4)
getContainerId()

Returns the local id of the container linked to the weapon

Returns
Name Type Description
integer
getHitProbability()

Returns the current hit probability of the weapon for the current target

Returns
Name Type Description
number
getBaseDamage()

Returns the base weapon damage

Returns
Name Type Description
number
getOptimalAimingCone()

Returns the optimal aim cone

Returns
Name Type Description
number
getOptimalDistance()

Returns the optimal distance to target

Returns
Name Type Description
number
getMaxDistance()

Returns the maximum distance to target

Returns
Name Type Description
number
getOptimalTracking()

Returns the optimal tracking rate

Returns
Name Type Description
number
getMagazineVolume()

Returns the magazine volume

Returns
Name Type Description
number
getCycleTime()

Returns the weapon cycle time

Returns
Name Type Description
number
getReloadTime()

Returns the weapon reload time

Returns
Name Type Description
number
getUnloadTime()

Returns the weapon unload time

Returns
Name Type Description
number
getTargetId()

Returns the id of the current target construct of the weapon

Returns
Name Type Description
integer