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