Pain controller 
Attatched to a mob, this datum tracks all the pain values on all their bodyparts and handles updating them. This datum processes on alive humans every 2 seconds.
Vars | |
| base_pain_decay | The base amount of pain decay received. |
|---|---|
| natural_pain_decay | Natural amount of decay given to each limb per 5 ticks of process, increases over time |
| pain_modifier | Modifier that determines how much of the "pain" the mob actually feels.] |
| pain_mods | Lazy Assoc list [id] to [modifier], all our pain modifiers affecting our final mod |
| parent | The parent mob we're tracking. |
| time_since_last_pain_loss | Cooldown to track the last time we lost pain. |
| time_since_last_pain_message | Cooldown to track last time we sent a pain message. |
| traumatic_shock | Amount of traumatic shock building up from higher levels of pain |
Procs | |
| add_bodypart | Add a bodypart to be tracked. Also causes pain if the limb was added non-'special'. |
| add_damage_pain | Hooks into [apply_damage] to apply pain to the parent based on incoming damage. |
| add_wound_pain | Gaining a wound applies a flat amount of pain based on severity. |
| adjust_bodypart_min_pain | Set the minimum amount of pain in all [def_zones] by [amount]. |
| adjust_bodypart_pain | Adjust the amount of pain in all [def_zones] provided by [amount] (multiplied by the [pain_modifier] if positive). |
| adjust_traumatic_shock | Adjusts the progress of pain shock on the current mob. |
| do_pain_emote | Run a pain related emote, if a few checks are successful. |
| do_pain_message | Run a pain related message, if a few checks are successful. |
| get_total_pain | Get the total pain of all bodyparts. |
| handle_message | Adds a custom stammer to people under the effects of pain. |
| on_analyzed | Signal proc for COMSIG_LIVING_HEALTHSCAN Reports how much pain [parent] is sustaining to [user]. |
| on_mob_fired_gun | Affect accuracy of fired guns while in pain. |
| on_pain_gain | Called when pain is gained to apply side effects. Calls [affected_part]'s [on_gain_pain_effects] proc with arguments [amount]. |
| on_pain_loss | Called when pain is lost, if the mob did not lose pain in the last 60 seconds. Calls [affected_part]'s [on_lose_pain_effects] proc with arguments [amount]. |
| on_parent_statchance | Determines if we should be processing or not. |
| refresh_pain_attributes | Apply or remove pain various modifiers from pain (mood, action speed, movement speed) based on the [average_pain]. |
| remove_all_pain | Remove all pain, pain paralysis, side effects, etc. from our mob after we're fully healed by something (like an adminheal) |
| remove_bodypart | Removes a limb from being tracked. Also causes pain if the limb was removed non-'special'. |
| remove_wound_pain | Removes pain when a wound is healed. |
| revived | When we are revived, reduced shock & pain |
| set_pain_modifier | Add a pain modifier and update our overall modifier. |
| unregister_pain_signals | Unregister all of our signals from our parent when we're done, if we have signals to unregister. |
| unset_pain_modifier | Remove a pain modifier and update our overall modifier. |
| update_pain_modifier | Update our overall pain modifier. The pain modifier is multiplicative based on all the pain modifiers we have. |
Var Details
base_pain_decay 
The base amount of pain decay received.
natural_pain_decay 
Natural amount of decay given to each limb per 5 ticks of process, increases over time
pain_modifier 
Modifier that determines how much of the "pain" the mob actually feels.]
Affects:
- Pain feedback messages
- Doing pain-related emotes (screams or gasps)
- Duration of some pain effects (dizziness, etc)
- Rate of traumatic shock buildup
Below 0.5, a mob is treated as "numb", and will outright no longer experience pain feedback messages or effects (but it'll still accumulate!)
pain_mods 
Lazy Assoc list [id] to [modifier], all our pain modifiers affecting our final mod
parent 
The parent mob we're tracking.
time_since_last_pain_loss 
Cooldown to track the last time we lost pain.
time_since_last_pain_message 
Cooldown to track last time we sent a pain message.
traumatic_shock 
Amount of traumatic shock building up from higher levels of pain
Proc Details
add_bodypart
Add a bodypart to be tracked. Also causes pain if the limb was added non-'special'.
add_damage_pain
Hooks into [apply_damage] to apply pain to the parent based on incoming damage.
add_wound_pain
Gaining a wound applies a flat amount of pain based on severity.
adjust_bodypart_min_pain
Set the minimum amount of pain in all [def_zones] by [amount].
- def_zones - list of all zones being adjusted. Can be passed a non-list.
- amount - amount of pain being all items in [def_zones] are set to.
adjust_bodypart_pain
Adjust the amount of pain in all [def_zones] provided by [amount] (multiplied by the [pain_modifier] if positive).
This is the bread and butter way to apply pain to a mob.
- def_zones - zone being adjusted
- amount - amount of pain being applied to all items in [def_zones]. If posiitve, multiplied by [pain_modifier].
Returns the amount of pain caused, or 0 if no pain was caused.
adjust_traumatic_shock
Adjusts the progress of pain shock on the current mob.
- amount - the number of ticks of progress to remove. Note that one tick = two seconds for pain.
- down_to - shock will be healed down to this amount, but not beyond it.
do_pain_emote
Run a pain related emote, if a few checks are successful.
Comes with defaults so you can just call it straight up to do a random emote
- emote - string, what emote we're running
- cooldown - what cooldown to set our emote cooldown to
Returns TRUE if successful. Returns FALSE if we failed to send an emote.
do_pain_message
Run a pain related message, if a few checks are successful.
- message - string, what message we're sending
- painless_message - optional string, what message we're sending if the mob doesn't "feel" pain
- cooldown - what cooldown to set our message cooldown to
Returns TRUE if successful. Returns FALSE if we failed to send a message, even if painless_message was provided and sent.
get_total_pain
Get the total pain of all bodyparts.
handle_message
Adds a custom stammer to people under the effects of pain.
on_analyzed
Signal proc for COMSIG_LIVING_HEALTHSCAN Reports how much pain [parent] is sustaining to [user].
Note, this report is relatively vague intentionally - rather than sending a detailed report of which bodyparts are in pain and how much, the patient is encouraged to elaborate on which bodyparts hurt the most, and how much they hurt.
(To encourage a bit more interaction between the doctors and their patients)
on_mob_fired_gun
Affect accuracy of fired guns while in pain.
on_pain_gain
Called when pain is gained to apply side effects. Calls [affected_part]'s [on_gain_pain_effects] proc with arguments [amount].
- affected_part - the bodypart that gained the pain
- amount - amount of pain that was gained, post-[pain_modifier] applied
on_pain_loss
Called when pain is lost, if the mob did not lose pain in the last 60 seconds. Calls [affected_part]'s [on_lose_pain_effects] proc with arguments [amount].
- affected_part - the bodypart that lost pain
- amount - amount of pain that was lost
on_parent_statchance
Determines if we should be processing or not.
refresh_pain_attributes
Apply or remove pain various modifiers from pain (mood, action speed, movement speed) based on the [average_pain].
remove_all_pain
Remove all pain, pain paralysis, side effects, etc. from our mob after we're fully healed by something (like an adminheal)
remove_bodypart
Removes a limb from being tracked. Also causes pain if the limb was removed non-'special'.
remove_wound_pain
Removes pain when a wound is healed.
revived
When we are revived, reduced shock & pain
set_pain_modifier
Add a pain modifier and update our overall modifier.
- key - key of the added modifier
- amount - multiplier of the modifier
Returns TRUE if our pain mod actually changed
unregister_pain_signals
Unregister all of our signals from our parent when we're done, if we have signals to unregister.
unset_pain_modifier
Remove a pain modifier and update our overall modifier.
- key - key of the removed modifier
Returns TRUE if our pain mod actually changed
update_pain_modifier
Update our overall pain modifier. The pain modifier is multiplicative based on all the pain modifiers we have.
Returns TRUE if our pain modifier was changed after update, FALSE if it remained the same