Module Element

All elements share the same generic methods described below.

Extended by:

Functions

show () Deprecated: Show the element's widget in the in-game widget stack.
showWidget () Show the element's widget in the in-game widget stack.
hide () Deprecated: Hide the element's widget in the in-game widget stack.
hideWidget () Hide the element's widget in the in-game widget stack.
getWidgetType () Returns the widget type compatible with the element data.
getData () Deprecated: Returns the element data as JSON.
getWidgetData () Returns the element data as JSON.
getDataId () Deprecated: Returns the element data ID.
getWidgetDataId () Returns the element data ID.
getName () Returns the element's name.
getElementClass () Deprecated: The class of the element.
getClass () The class of the element.
getMass () Returns the mass of the element (includes the included items' mass when the element is a container).
getItemId () Returns the element item ID (to be used with system.getItem() function to get information about the element).
getId () Deprecated: A construct unique ID for the element.
getLocalId () Returns the unique local ID of the element.
getIntegrity () Returns the element's integrity between 0 and 100.
getHitPoints () Returns the element's current hit points (0 = destroyed).
getMaxHitPoints () Returns the element's maximal hit points.
getRemainingRestorations () Returns the element's remaining number of restorations.
getMaxRestorations () Returns the element's maximal number of restorations.
getPosition () Returns the position of the element in construct local coordinates.
getBoundingBoxSize () Returns the bounding box dimensions of the element.
getBoundingBoxCenter () Returns the position of the center of bounding box of the element in local construct coordinates.
getUp () Returns the up direction vector of the element in construct local coordinates.
getRight () Returns the right direction vector of the element in construct local coordinates.
getForward () Returns the forward direction vector of the element in construct local coordinates.
getWorldUp () Returns the up direction vector of the element in world coordinates.
getWorldRight () Returns the right direction vector of the element in world coordinates.
getWorldForward () Returns the forward direction vector of the element in world coordinates.
setSignalIn (plug, state) Set the value of a signal in the specified IN plug of the element.
getSignalIn (plug) Returns the value of a signal in the specified IN plug of the element.
getSignalOut (plug) Returns the value of a signal in the specified OUT plug of the element.
load () Returns 1 if element is loaded and 0 otherwise.
mockGetClosure () Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".


Functions

show ()
Deprecated: Show the element's widget in the in-game widget stack.

This method is deprecated: showWidget should be used instead.

See also:

showWidget ()
Show the element's widget in the in-game widget stack.
hide ()
Deprecated: Hide the element's widget in the in-game widget stack.

This method is deprecated: hideWidget should be used instead.

See also:

hideWidget ()
Hide the element's widget in the in-game widget stack.
getWidgetType ()
Returns the widget type compatible with the element data.

Returns:

    string Widget type. "" if invalid.
getData ()
Deprecated: Returns the element data as JSON.

This method is deprecated: getWidgetData should be used instead.

Returns:

    string Data as JSON.

See also:

getWidgetData ()
Returns the element data as JSON.

Returns:

    string Data as JSON.
getDataId ()
Deprecated: Returns the element data ID. Used to link en element to a custom widget.

This method is deprecated: getWidgetDataId should be used instead.

Returns:

    string Data ID. "" if invalid.

See also:

getWidgetDataId ()
Returns the element data ID. Used to link en element to a custom widget.

Returns:

    string Data ID. "" if invalid.

See also:

getName ()
Returns the element's name.

Returns:

    string The element's name.
getElementClass ()
Deprecated: The class of the element.

This method is deprecated: getClass should be used instead.

Returns:

    string The class name of the element.

See also:

getClass ()
The class of the element.

Returns:

    string The class name of the element.
getMass ()
Returns the mass of the element (includes the included items' mass when the element is a container).

Returns:

    float The mass of the element in kg.
getItemId ()
Returns the element item ID (to be used with system.getItem() function to get information about the element).

Returns:

    int The element item ID.
getId ()
Deprecated: A construct unique ID for the element.

This method is deprecated: getLocalId should be used instead.

Returns:

    The element ID.

See also:

getLocalId ()
Returns the unique local ID of the element.

Returns:

    int The element local ID.
getIntegrity ()
Returns the element's integrity between 0 and 100.

Returns:

    float 0 = element fully destroyed, 100 = element fully functional.
getHitPoints ()
Returns the element's current hit points (0 = destroyed).

Returns:

    float The hit points, where 0 = element fully destroyed.
getMaxHitPoints ()
Returns the element's maximal hit points.

Returns:

    float The max hit points of the element.
getRemainingRestorations ()
Returns the element's remaining number of restorations.

Returns:

    int The number of restorations before the element is ultimately destroyed.
getMaxRestorations ()
Returns the element's maximal number of restorations.

Returns:

    int The max number of restorations of the element.
getPosition ()
Returns the position of the element in construct local coordinates.

Returns:

    vec3 The position of the element in construct local coordinates.
getBoundingBoxSize ()
Returns the bounding box dimensions of the element.

Returns:

    vec3 The dimensions of the element bounding box.
getBoundingBoxCenter ()
Returns the position of the center of bounding box of the element in local construct coordinates.

Returns:

    vec3 The position of the center of the bounding box.
getUp ()
Returns the up direction vector of the element in construct local coordinates.

Returns:

    vec3 Up direction vector of the element in construct local coordinates.
getRight ()
Returns the right direction vector of the element in construct local coordinates.

Returns:

    vec3 Right direction vector of the element in construct local coordinates.
getForward ()
Returns the forward direction vector of the element in construct local coordinates.

Returns:

    vec3 Forward direction vector of the element in construct local coordinates.
getWorldUp ()
Returns the up direction vector of the element in world coordinates.

Returns:

    vec3 Up direction vector of the element in world coordinates.
getWorldRight ()
Returns the right direction vector of the element in world coordinates.

Returns:

    vec3 Right direction vector of the element in world coordinates.
getWorldForward ()
Returns the forward direction vector of the element in world coordinates.

Returns:

    vec3 Forward direction vector of the element in world coordinates.
setSignalIn (plug, state)
Set the value of a signal in the specified IN plug of the element.

Standard plug names are built with the following syntax: direction-type-index.

  • directionIN or OUT
  • typeITEM, FUEL, ELECTRICITY, SIGNAL, HEAT, FLUID, or CONTROL
  • indexA number between 0 and the total number of plugs of the given type in the given direction.

Some plugs have special names like "on" or "off" for the manual switch unit, just check in-game for the plug names if you have a doubt.

Note: This will have no effect if called on a plug that is connected to something that generates a signal, such as a switch or button.

Parameters:

  • plug string The plug name, of the form IN-SIGNAL-index
  • state 0/1 The plug signal state
getSignalIn (plug)
Returns the value of a signal in the specified IN plug of the element.

Standard plug names are built with the following syntax: direction-type-index.

  • directionIN or OUT
  • typeITEM, FUEL, ELECTRICITY, SIGNAL, HEAT, FLUID, or CONTROL
  • indexA number between 0 and the total number of plugs of the given type in the given direction.

Some plugs have special names like "on" or "off" for the manual switch unit, just check in-game for the plug names if you have a doubt.

Parameters:

  • plug string The plug name of the form IN-SIGNAL-index

Returns:

    0/1 The plug signal state
getSignalOut (plug)
Returns the value of a signal in the specified OUT plug of the element.

Standard plug names are built with the following syntax: direction-type-index.

  • directionIN or OUT
  • typeITEM, FUEL, ELECTRICITY, SIGNAL, HEAT, FLUID, or CONTROL
  • indexA number between 0 and the total number of plugs of the given type in the given direction.

Some plugs have special names like "on" or "off" for the manual switch unit, just check in-game for the plug names if you have a doubt.

Parameters:

  • plug string The plug name of the form OUT-SIGNAL-index

Returns:

    0/1 The plug signal state
load ()
Returns 1 if element is loaded and 0 otherwise. Elements may unload if the player gets too far away from them, at which point calls to their api will stop responding as expected. This state can only be recovered from by restarting the script.

Returns:

    0/1 The element load state.
mockGetClosure ()
Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".

Returns:

    table A table encompasing the api calls of object.
generated by LDoc 1.4.6 Last updated 2022-12-01 00:35:59