Stun absorption
A status effect effectively functions as TRAIT_STUNIMMUNE, but with additional effects tied to it, such as showing a message on trigger / examine, or only blocking a limited amount of stuns.
Apply this via /mob/living/proc/add_stun_absorption. If you do not supply a duration, remove this via /mob/living/proc/remove_stun_absorption.
Vars | |
delete_after_passing_max | If TRUE, after passing the max seconds of stuns blocked, we will delete ourself. If FALSE, we will instead recharge after some time. |
---|---|
examine_message | Message shown on anyone examining the owner. |
incapacitation_effect_signals | Static list of all generic "stun received " signals that we will react to and block. These all have the same arguments sent, so we can handle them all via the same signal handler. Note though that we can register other signals to block effects outside of these if we want. |
max_seconds_of_stuns_blocked | The max number of seconds we can block before self-deleting. |
priority | The priority of the stun absorption. Used so that multiple sources will not trigger at once. This number is arbitrary but try to keep in sane / in line with other sources that exist. |
recharge_time | If [delete_after_passing_max] is FALSE, this is how long we will wait before recharging. |
seconds_of_stuns_absorbed | How many total seconds of stuns that have been blocked. |
self_message | The message shown to the owner when the effect triggers. |
shown_message | The message shown via visible message to all nearby mobs when the effect triggers. |
source | The string key sourcer of the stun absorption, used for logging |
Procs | |
absorb_stun | Absorb a number of seconds of stuns. If we hit the max amount of absorption, we will qdel ourself in this proc. |
can_absorb_stun | Simply checks if the owner of the effect is in a valid state to absorb stuns. |
recharge_absorption | Used in callbacks to "recharge" the effect after passing the max seconds of stuns blocked. |
try_absorb_generic_effect | Signal proc for COMSIG_LIVING_GENERIC_STUN_CHECK. (Note, this includes being stamcrit) |
try_absorb_incapacitating_effect | Signal proc for generic stun signals being sent, such as COMSIG_LIVING_STATUS_STUN or COMSIG_LIVING_STATUS_KNOCKDOWN. |
Var Details
delete_after_passing_max
If TRUE, after passing the max seconds of stuns blocked, we will delete ourself. If FALSE, we will instead recharge after some time.
examine_message
Message shown on anyone examining the owner.
incapacitation_effect_signals
Static list of all generic "stun received " signals that we will react to and block. These all have the same arguments sent, so we can handle them all via the same signal handler. Note though that we can register other signals to block effects outside of these if we want.
max_seconds_of_stuns_blocked
The max number of seconds we can block before self-deleting.
priority
The priority of the stun absorption. Used so that multiple sources will not trigger at once. This number is arbitrary but try to keep in sane / in line with other sources that exist.
recharge_time
If [delete_after_passing_max] is FALSE, this is how long we will wait before recharging.
seconds_of_stuns_absorbed
How many total seconds of stuns that have been blocked.
self_message
The message shown to the owner when the effect triggers.
shown_message
The message shown via visible message to all nearby mobs when the effect triggers.
source
The string key sourcer of the stun absorption, used for logging
Proc Details
absorb_stun
Absorb a number of seconds of stuns. If we hit the max amount of absorption, we will qdel ourself in this proc.
- amount - this is the number of deciseconds being absorbed at once.
Returns TRUE on successful absorption, or FALSE otherwise.
can_absorb_stun
Simply checks if the owner of the effect is in a valid state to absorb stuns.
recharge_absorption
Used in callbacks to "recharge" the effect after passing the max seconds of stuns blocked.
try_absorb_generic_effect
Signal proc for COMSIG_LIVING_GENERIC_STUN_CHECK. (Note, this includes being stamcrit)
Whenever a generic stun check is done against us, we'll just try to block it with "0 second" stun. This prevents spam us from showing feedback messages, and is for the generic "can be stunned" check.
try_absorb_incapacitating_effect
Signal proc for generic stun signals being sent, such as COMSIG_LIVING_STATUS_STUN or COMSIG_LIVING_STATUS_KNOCKDOWN.
When we get stunned, we will try to absorb a number of seconds from the stun, and return [COMPONENT_NO_STUN] if we succeed.