Module Engine

Abstract class to define functions common to engines.

Many methods found here are deprecated for the general engine type, though more specific engine unites may re-implement them for their type.

Element class:

Extends: Element

Extended by:

Functions

getWidgetData () Get element data as JSON.
getObstructionFactor () Returns the obstruction ratio of the engine exhaust by elements and voxels.
getTags () Returns the tags of the engine.
setTags (tags, ignore) Set the tags of the engine.
isIgnoringTags () Checks if the engine is ignoring default tags.
activate () Deprecated: Switches the engine on.
deactivate () Deprecated: Switches the engine off.
getState () Deprecated: Returns the activation state of the engine.
toggle () Deprecated: Toggle the state of the engine.
setThrust (thrust) Deprecated: Set the engine thrust between 0 and maxThrust.
getMaxThrustBase () Deprecated: Returns the maximal thrust the engine can deliver in principle, under optimal conditions.
getMaxThrust () Deprecated: Returns the maximal thrust the engine can deliver at the moment, which might depend on various conditions like atmospheric density, obstruction, orientation, etc.
getMinThrust () Deprecated: Returns the minimal thrust the engine can deliver at the moment (can be more than zero), which will depend on various conditions like atmospheric density, obstruction, orientation, etc.
getMaxThrustEfficiency () Deprecated: Returns the ratio between the current MaxThrust and the base MaxThrust.
getThrust () Deprecated: Returns the current thrust level of the engine.
torqueAxis () Deprecated: Returns the engine torque axis.
thrustAxis () Deprecated: Returns the engine thrust direction.
getDistance () Deprecated: Returns the distance to the first object detected in the direction of the thrust.
isOutOfFuel () Deprecated: Is the engine out of fuel?
hasFunctionalFuelTank () Deprecated: Is the engine linked to a functional fuel tank?
getCurrentFuelRate () Deprecated: The engine rate of fuel consumption per newton delivered per second.
getFuelRateEfficiency () Deprecated: Returns the ratio between the current fuel rate and the theoretical nominal fuel rate.
getT50 () Deprecated: The time needed for the engine to reach 50% of its maximal thrust (all engines do not instantly reach the thrust that is set for them, but they can take time to "warm up" to the final value).
getFuelConsumption () Deprecated: The current rate of fuel consumption.
setSignalIn (plug, state) Deprecated: Set the value of a signal in the specified IN plug of the element.
getSignalIn (plug) Return the value of a signal in the specified IN plug of the element.
mockGetClosure () Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".


Functions

getWidgetData ()
Get element data as JSON.

Engines have an engine_unit widget, which contains the following fields (bold fields are visible when making custom use of the widget):

  • currentThrust (float) Current thrust in newtons.
  • currentMaxThrust (float) Current max thrust in newtons.
  • maxThrustBase (float) Max thrust under ideal conditions in newtons.
  • name (string) The name of the element.
  • helperId (string) engine_unit
  • type (string) engine_unit

Returns:

    string Data as JSON.
getObstructionFactor ()
Returns the obstruction ratio of the engine exhaust by elements and voxels. The more obstructed the engine is, the less properly it will work. Try to fix your design if this is the case.

Returns:

    float The obstruction ratio of the engine.
getTags ()
Returns the tags of the engine.

Returns:

    string Tags of the engine, in a CSV string.
setTags (tags, ignore)
Set the tags of the engine.

Parameters:

  • tags string The CSV string of the tags.
  • ignore bool True to ignore the default engine tags.
isIgnoringTags ()
Checks if the engine is ignoring default tags.

Returns:

    0/1 1 if the engine ignores default engine tags.
activate ()
Deprecated: Switches the engine on.

This method is deprecated: element-specific methods should be used instead.

deactivate ()
Deprecated: Switches the engine off.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

getState ()
Deprecated: Returns the activation state of the engine.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    0/1 1 when the engine is on, 0 otherwise.
toggle ()
Deprecated: Toggle the state of the engine.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

setThrust (thrust)
Deprecated: Set the engine thrust between 0 and maxThrust.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Parameters:

  • thrust Newton The engine thrust.
getMaxThrustBase ()
Deprecated: Returns the maximal thrust the engine can deliver in principle, under optimal conditions. Note that the actual maxThrust will most of the time be less than maxThrustBase.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    Newton The base max thrust.
getMaxThrust ()
Deprecated: Returns the maximal thrust the engine can deliver at the moment, which might depend on various conditions like atmospheric density, obstruction, orientation, etc. The actual thrust will be anything below this maxThrust, which defines the current max capability of the engine.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    Newton The current max thrust.
getMinThrust ()
Deprecated: Returns the minimal thrust the engine can deliver at the moment (can be more than zero), which will depend on various conditions like atmospheric density, obstruction, orientation, etc. Most of the time, this will be 0 but it can be greater than 0, particularly for ailerons, in which case the actual thrust will be at least equal to minThrust.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    Newton The current min thrust.
getMaxThrustEfficiency ()
Deprecated: Returns the ratio between the current MaxThrust and the base MaxThrust.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    Usually 1 but can be lower for certain engines.
getThrust ()
Deprecated: Returns the current thrust level of the engine.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    Newton The thrust the engine is currently delivering.
torqueAxis ()
Deprecated: Returns the engine torque axis.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    vec3 The torque axis in world coordinates.
thrustAxis ()
Deprecated: Returns the engine thrust direction.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    vec3 The engine thrust direction in world coordinates.
getDistance ()
Deprecated: Returns the distance to the first object detected in the direction of the thrust.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    meter The distance to the first obstacle.
isOutOfFuel ()
Deprecated: Is the engine out of fuel?

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    bool 1 when there is no fuel left, 0 otherwise.
hasFunctionalFuelTank ()
Deprecated: Is the engine linked to a functional fuel tank?

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    bool 1 when linked tank is functional, 0 otherwise.
getCurrentFuelRate ()
Deprecated: The engine rate of fuel consumption per newton delivered per second.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    m3/(N.s) How many litres of fuel per newton per second.
getFuelRateEfficiency ()
Deprecated: Returns the ratio between the current fuel rate and the theoretical nominal fuel rate.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    Usually 1 but can be higher for certain engines at certain speeds.
getT50 ()
Deprecated: The time needed for the engine to reach 50% of its maximal thrust (all engines do not instantly reach the thrust that is set for them, but they can take time to "warm up" to the final value).

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    second The time to half thrust.
getFuelConsumption ()
Deprecated: The current rate of fuel consumption.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Returns:

    m3/s How many cubic meters of fuel per unit of time.
setSignalIn (plug, state)
Deprecated: Set the value of a signal in the specified IN plug of the element.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Valid plug names are:

  • "in" for the in signal.

Parameters:

  • plug string A valid plug name to set.
  • state 0/1 The plug signal state
getSignalIn (plug)
Return the value of a signal in the specified IN plug of the element.

The general engine version of this method is deprecated: check the more specific unit type for a new implementation.

Valid plug names are:

  • "in" for the in signal.

Parameters:

  • plug string A valid plug name to query.

Returns:

    0/1 The plug signal 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.

See also:

generated by LDoc 1.5.0 Last updated 2024-09-27 15:22:46