Module ShieldGeneratorUnit

Generates a protective shield around the construct.

Element class:

  • ShieldGeneratorExtraSmallGroup
  • ShieldGeneratorSmallGroup
  • ShieldGeneratorMediumGroup
  • ShieldGeneratorLargeGroup

Extends: Element > ElementWithState > ElementWithToggle

Functions

activate () Activate the shield.
deactivate () Deactivate the shield.
isActive () Returns the activation state of the shield.
getWidgetData () Get element data as JSON.
getShieldHitpoints () Returns the current hit points of the shield.
getMaxShieldHitpoints () Returns the maximal hit points of the shield.
startVenting () Activate shield venting to restore hit points.
stopVenting () Stop shield venting.
isVenting () Check whether venting is in progress.
getVentingCooldown () Returns time after which venting is possible again.
getVentingMaxCooldown () Returns maximal cooldown between venting.
getResistances () Returns distribution of resistance pool over resistance types.
setResistances (antimatter, electromagnetic, kinetic, thermic) Distribute the resistance pool according to damage type.
getResistancesCooldown () Returns time after which adjusting resistances is possible again.
getResistancesMaxCooldown () Returns maximal cooldown between adjusting resistances.
getResistancesPool () Returns total resistance pool that may be distributed.
getResistancesRemaining () Returns the remaining amount of the resistance pool that can be distributed.
getStressRatio () Returns ratio per damage type of recent weapon impacts after applying resistances.
getStressRatioRaw () Returns ratio per damage type of recent weapon impacts without resistance.
getStressHitpoints () Returns stress, that is the total hit points of recent weapon impacts after applying resistances.
getStressHitpointsRaw () Returns stress, that is the total hit points of recent weapon impacts without resistances.
setSignalIn (plug, state) 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.
EVENT_toggled (active) Deprecated: Event: Emitted when we started or stopped the shield generator.
EVENT_onToggled (active) Event: Emitted when we started or stopped the shield generator.
EVENT_absorbed (hitpoints, rawHitpoints) Deprecated: Event: Emitted when the shield absorbed incoming damage.
EVENT_onAbsorbed (hitpoints, rawHitpoints) Event: Emitted when the shield absorbed incoming damage.
EVENT_venting (active, restoredHitpoints) Deprecated: Event: Emitted when venting started, stopped or restored some hitpoints.
EVENT_onVenting (active, restoredHitpoints) Event: Emitted when venting started, stopped or restored some hitpoints.
EVENT_down () Deprecated: Event: Emitted when the shield hit points reached 0 due to damages.
EVENT_onDown () Event: Emitted when the shield hit points reached 0 due to damages.
EVENT_restored () Deprecated: Event: Emitted when the shield hit points were fully restored.
EVENT_onRestored () Event: Emitted when the shield hit points were fully restored.
mockRegisterToggled (callback, active) Mock only, not in-game: Register a handler for the in-game `onToggled(active)` event.
mockDoToggled (active) Mock only, not in-game: Simulates the shield changing state.
mockRegisterAbsorbed (callback, hitpoints, rawHitpoints) Mock only, not in-game: Register a handler for the in-game `onAbsorbed(hitpoints, rawHitpoints)` event.
mockDoAbsorbed (hitpoints, rawHitpoints) Mock only, not in-game: Simulates the shield absorbing damage.
mockRegisterDown (callback) Mock only, not in-game: Register a handler for the in-game `onDown()` event.
mockDoDown () Mock only, not in-game: Simulates the shield going down, either from damage or deactivation.
mockRegisterRestored (callback) Mock only, not in-game: Register a handler for the in-game `onRestored()` event.
mockDoRestored () Mock only, not in-game: Simulates the shield becoming active.
mockTriggerCallback () Mock only, not in-game: Triggers the appropriate callback when the element state changes.
mockGetClosure () Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".


Functions

activate ()
Activate the shield.
deactivate ()
Deactivate the shield.
isActive ()
Returns the activation state of the shield.

Returns:

    0/1 1 when the shield is active, 0 otherwise.
getWidgetData ()
Get element data as JSON.

Shield generators have a shield_generator widget, which contains the following fields (bold fields are visible when making custom use of the widget):

  • shieldHp (float) Shield hit points.
  • shieldMaxHp (float) Max shield hit points.
  • isActive (boolean) True if the shield is active, false otherwise.
  • isVenting (boolean) True if the shield is venting, false otherwise.
  • ventingCooldown (float) Remaining cooldown before venting is possible in seconds.
  • ventingMaxCooldown (float) Max cooldown before venting is possible once venting stops.
  • ventingStartHp (float) Shield hit points when venting started, used to calculate percent done with venting.
  • ventingTargetHp (float) Shield hit points when venting will stop, used to calculate percent done with venting.
  • resistances (float) List of resistance parameters for each of: antimatter, electromagnetic, kinetic, thermic
    • stress (float) Percentage to fill the stress meter, ≤ 0.01 = 0 bars, ≤ .26 = 1 bar, ≤ .51 = 2 bars, > .51 = 3 bars.
    • value (float) Percentage value to show next to resistance stress meter, 0.01 will show as 1%.
  • name (string) The name of the element.
  • elementId (int) The (globally unique?) id of the shield generator element, may be related to linking the commands to the element.
  • helperId (string) shield_generator
  • type (string) shield_generator

Returns:

    string Data as JSON.
getShieldHitpoints ()
Returns the current hit points of the shield.

Returns:

    float The current hit points of the shield.
getMaxShieldHitpoints ()
Returns the maximal hit points of the shield.

Returns:

    float The maximal hit points of the shield.
startVenting ()
Activate shield venting to restore hit points.

Returns:

    0/1 1 if venting started, 0 if an error occurred.
stopVenting ()
Stop shield venting.

Returns:

    0/1 1 if venting stopped, 0 if an error occurred.
isVenting ()
Check whether venting is in progress.

Returns:

    0/1 1 if venting is ongoing, 0 otherwise.
getVentingCooldown ()
Returns time after which venting is possible again.

Returns:

    float Remaining seconds of the venting cooldown.
getVentingMaxCooldown ()
Returns maximal cooldown between venting.

Returns:

    float Maximal seconds of the venting cooldown.
getResistances ()
Returns distribution of resistance pool over resistance types.

Returns:

    table Resistance to damage type {antimatter, electromagnetic, kinetic, thermic}.
setResistances (antimatter, electromagnetic, kinetic, thermic)
Distribute the resistance pool according to damage type.

Parameters:

  • antimatter float Antimatter damage resistance.
  • electromagnetic float Electromagnetic damage resistance.
  • kinetic float Kinetic damage resistance.
  • thermic float Thermic damage resistance.

Returns:

    0/1 1 if resistance was distributed, 0 if an error occurred.
getResistancesCooldown ()
Returns time after which adjusting resistances is possible again.

Returns:

    float Remaining seconds of the resistance cooldown.
getResistancesMaxCooldown ()
Returns maximal cooldown between adjusting resistances.

Returns:

    float Maximal seconds of the resistance cooldown.
getResistancesPool ()
Returns total resistance pool that may be distributed.

Returns:

    float Total pool of resistances.
getResistancesRemaining ()
Returns the remaining amount of the resistance pool that can be distributed.

Returns:

    float Remaining resistance pool.
getStressRatio ()
Returns ratio per damage type of recent weapon impacts after applying resistances.

Returns:

    table Stress ratio due to damage type {antimatter, electromagnetic, kinetic, thermic}.
getStressRatioRaw ()
Returns ratio per damage type of recent weapon impacts without resistance.

Returns:

    table 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 resistances.

Returns:

    float Total stress hit points due to recent weapon impacts.
getStressHitpointsRaw ()
Returns stress, that is the total hit points of recent weapon impacts without resistances.

Returns:

    float Total stress hit points due to recent weapon impacts.
setSignalIn (plug, state)
Set the value of a signal in the specified IN plug of the element.

Valid plug names are:

  • "in" for the in signal (seems to have no actual effect when modified this way).

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.

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
EVENT_toggled (active)
Deprecated: Event: Emitted when we started or stopped the shield generator.

Note: This is documentation on an event handler, not a callable method.

This event is deprecated: EVENT_onToggled should be used instead.

Parameters:

  • active 0/1 1 if the element was activated, 0 otherwise.

See also:

EVENT_onToggled (active)
Event: Emitted when we started or stopped the shield generator.

Note: This is documentation on an event handler, not a callable method.

Parameters:

  • active 0/1 1 if the element was activated, 0 otherwise.
EVENT_absorbed (hitpoints, rawHitpoints)
Deprecated: Event: Emitted when the shield absorbed incoming damage.

Note: This is documentation on an event handler, not a callable method.

This event is deprecated: EVENT_onAbsorbed should be used instead.

Parameters:

  • hitpoints float Hit points the shield lost.
  • rawHitpoints float Total damage without taking resistances into account.

See also:

EVENT_onAbsorbed (hitpoints, rawHitpoints)
Event: Emitted when the shield absorbed incoming damage.

Note: This is documentation on an event handler, not a callable method.

Parameters:

  • hitpoints float Hit points the shield lost.
  • rawHitpoints float Total damage without taking resistances into account.
EVENT_venting (active, restoredHitpoints)
Deprecated: Event: Emitted when venting started, stopped or restored some hitpoints.

Note: This is documentation on an event handler, not a callable method.

This event is deprecated: EVENT_onVenting should be used instead.

Parameters:

  • active 0/1 1 when venting is active, 0 otherwise.
  • restoredHitpoints float Hitpoints restored since last venting step.

See also:

EVENT_onVenting (active, restoredHitpoints)
Event: Emitted when venting started, stopped or restored some hitpoints.

Note: This is documentation on an event handler, not a callable method.

Parameters:

  • active 0/1 1 when venting is active, 0 otherwise.
  • restoredHitpoints float Hitpoints restored since last venting step.
EVENT_down ()
Deprecated: Event: Emitted when the shield hit points reached 0 due to damages.

Note: This is documentation on an event handler, not a callable method.

This event is deprecated: EVENT_onDown should be used instead.

See also:

EVENT_onDown ()
Event: Emitted when the shield hit points reached 0 due to damages.

Note: This is documentation on an event handler, not a callable method.

EVENT_restored ()
Deprecated: Event: Emitted when the shield hit points were fully restored.

Note: This is documentation on an event handler, not a callable method.

This event is deprecated: EVENT_onRestored should be used instead.

See also:

EVENT_onRestored ()
Event: Emitted when the shield hit points were fully restored.

Note: This is documentation on an event handler, not a callable method.

mockRegisterToggled (callback, active)
Mock only, not in-game: Register a handler for the in-game `onToggled(active)` event.

Parameters:

  • callback function The function to call when the shield state changes.
  • active string The state to filter for or "*" for all.

Returns:

    int The index of the callback.

See also:

mockDoToggled (active)
Mock only, not in-game: Simulates the shield changing state.

Note: The state updates before the event handlers are called.

Parameters:

  • active 0/1 The new state, 0 for off, 1 for on.
mockRegisterAbsorbed (callback, hitpoints, rawHitpoints)
Mock only, not in-game: Register a handler for the in-game `onAbsorbed(hitpoints, rawHitpoints)` event.

Parameters:

  • callback function The function to call when the shield absorbs damage.
  • hitpoints string The hit points to filter for or "*" for all.
  • rawHitpoints string The raw hit points to filter for or "*" for all.

Returns:

    int The index of the callback.

See also:

mockDoAbsorbed (hitpoints, rawHitpoints)
Mock only, not in-game: Simulates the shield absorbing damage.

Note: The state updates to true before the event handlers are called.

Parameters:

  • hitpoints int The amount of damage to deal.
  • rawHitpoints int The amount of damage to deal before taking resistances into account.
mockRegisterDown (callback)
Mock only, not in-game: Register a handler for the in-game `onDown()` event.

Parameters:

  • callback function The function to call when the shield goes down.

Returns:

    int The index of the callback.

See also:

mockDoDown ()
Mock only, not in-game: Simulates the shield going down, either from damage or deactivation.

Note: The state updates to false before the event handlers are called.

mockRegisterRestored (callback)
Mock only, not in-game: Register a handler for the in-game `onRestored()` event.

Parameters:

  • callback function The function to call when the shield comes up.

Returns:

    int The index of the callback.

See also:

mockDoRestored ()
Mock only, not in-game: Simulates the shield becoming active.

Note: The state updates to true before the event handlers are called.

mockTriggerCallback ()
Mock only, not in-game: Triggers the appropriate callback when the element state changes. Shields don't activate / deactivate instantly, so this allows for a user-managed delay.
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