Files
Bubberstation/code/_globalvars/traits.dm
lessthanthree 224e8ef3f6 [MANUAL MIRROR] Fixes plasmamen dying from liver damage when consuming plasma (#19074)
Fixes plasmamen dying from liver damage when consuming plasma & other organic toxins, fixes plasma fixation for plasmamen and other species (#72644)

## About The Pull Request

(edited for brevity---AS BEST I COULD, this turned into a lot more fixes
than I set out to do)

Instead of actually removing and metabolizing plasma in the liver,
plasmamen were having plasma removed in a special handle_chemicals proc.

The issue with this is that the liver's on_life proc would still fire
off alongside it, detecting reagents in the mob (because
handle_chemicals removes them little by little, at the same rate as the
liver does). And because the liver code sees it as a toxin, it takes
damage until it fails, leading to death as described in #72229.

Not actually metabolizing plasma also led to another issue, as mentioned
in #61424.

The solution after much faffing around ended up being to move the actual
reagent removal from handle_chemicals to the liver code, and to compare
a toxin's affected_organtype to the liver's 'status' var to check if the
toxin can damage the liver. There was currently only an ORGAN_ORGANIC
and ORGAN_ROBOTIC defined for this, so I added ORGAN_MINERAL for plasma
livers.

It still works as before, but now the reagent will actually get all the
metabolism procs called on it and be removed by the liver. And mobs with
mineral livers (currently only plasmamen) do not suffer organ failure
from processing organic toxins.

Plasma fixation itself also needed some TLC, as it was likely written
before liver damage was a thing. A lot of this comes down to rogue
livers operating independently of their species now that I think about
it...

Fixed it so you no longer take liver damage from injected/consumed
plasma when under the effects of the stage 4+ virus by making use of the
new PLASMA_LOVER_METABOLISM liver trait.

---

On top of that made it so that breathing in plasma through internals
also contributes to plasma fixation healing. This is a slight buff to
virology (especially for plasmamen) but it didn't seem busted or
anything from my testing. Can lead to some interesting subtle approaches
to healing for virologists as they can use internals rather than just
flooding rooms with plasma...

Some notes: 

- due to the way lungs are coded, non-plasma breathing species take a
significant amount of tox damage from breathing plasma through internals
in most cases and still need the right gas to be present so as to not
asphyxiate.
- During my testing this damage did not get healed fast enough to make
it viable for humans to wear plasma internals as found in spawned tanks
and such.
- I did not play around with creating custom internals mixes of O2 and
plasma but in theory that could possibly allow humans to heal faster
than the tox damage is applied. I think the tox damage on breath is
based on the amount of mols in the tank so perhaps a small amount of
plasma in the mix could work.
- As it stands the heal is very slight at 4kpa which is the typical tank
pressure for plasma internals. Going up to 15kpa can result in a
stronger heal (on par with injecting plasma) but going further offers no
additional benefit, and internals will be consumed much more quickly.
- This heal bonus is multiplicative with the rest, but from my testing
it still stays within reasonable numbers even with all 3 sources going
at once so as to not feel broken.
- Plasma fixation does not heal organ damage, but if I could add that in
easily enough should it be wanted.

The numbers themselves can be easily tweaked if desired, should people
find it too strong or what have you!

## Why It's Good For The Game

Fixes #72229
Fixes #61424
Fixes #70460 --not sure if this PR fixed it but I was able to infect
monkeys and plasmamen with a virus containing Inorganic Biology in my
testing, so this may be closed

Plasmamen dying from plasma is a travesty and reparations must be made.


## Changelog

🆑
fix: plasmamen no longer can suffer liver failure from injecting
themselves with plasma (unless they have a human liver for some reason).
fix: a person who is infected with a plasma fixation disease can no
longer can suffer liver failure from injecting themselves with plasma.
fix: plasmamen no longer can suffer liver failure from consuming other
organic toxins, which they are not supposed to be affected by.
fix: plasma fixation heal-through-inject-or-consumption now works for
plasmamen by letting the metabolism procs take care of removing it from
their systems.
fix: hot ice now has the same wound-healing and nontoxic properties as
plasma to plasmamen, since it is described as "frozen plasma". It is
also nontoxic to plasma fixation virus sufferers.
fix: plasma breathed through internals now contributes to the healing
amount from plasma fixation.
/🆑

Co-authored-by: Bloop <vinylspiders@gmail.com>
2023-02-03 20:01:55 -05:00

259 lines
10 KiB
Plaintext

/*
FUN ZONE OF ADMIN LISTINGS
Try to keep this in sync with __DEFINES/traits.dm
quirks have it's own panel so we don't need them here.
*/
GLOBAL_LIST_INIT(traits_by_type, list(
/mob = list(
"TRAIT_KNOCKEDOUT" = TRAIT_KNOCKEDOUT,
"TRAIT_IMMOBILIZED" = TRAIT_IMMOBILIZED,
"TRAIT_FLOORED" = TRAIT_FLOORED,
"TRAIT_FORCED_STANDING" = TRAIT_FORCED_STANDING,
"TRAIT_HANDS_BLOCKED" = TRAIT_HANDS_BLOCKED,
"TRAIT_UI_BLOCKED" = TRAIT_UI_BLOCKED,
"TRAIT_PULL_BLOCKED" = TRAIT_PULL_BLOCKED,
"TRAIT_RESTRAINED" = TRAIT_RESTRAINED,
"TRAIT_PERFECT_ATTACKER" = TRAIT_PERFECT_ATTACKER,
"TRAIT_INCAPACITATED" = TRAIT_INCAPACITATED,
"TRAIT_CRITICAL_CONDITION" = TRAIT_CRITICAL_CONDITION,
"TRAIT_LITERATE" = TRAIT_LITERATE,
"TRAIT_ILLITERATE" = TRAIT_ILLITERATE,
"TRAIT_MUTE" = TRAIT_MUTE,
"TRAIT_EMOTEMUTE " = TRAIT_EMOTEMUTE,
"TRAIT_DEAF" = TRAIT_DEAF,
"TRAIT_FAT" = TRAIT_FAT,
"TRAIT_HUSK" = TRAIT_HUSK,
"TRAIT_DEFIB_BLACKLISTED" = TRAIT_DEFIB_BLACKLISTED,
"TRAIT_BADDNA" = TRAIT_BADDNA,
"TRAIT_CLUMSY" = TRAIT_CLUMSY,
"TRAIT_CHUNKYFINGERS" = TRAIT_CHUNKYFINGERS,
"TRAIT_DUMB" = TRAIT_DUMB,
"TRAIT_ADVANCEDTOOLUSER" = TRAIT_ADVANCEDTOOLUSER,
"TRAIT_DISCOORDINATED_TOOL_USER" = TRAIT_DISCOORDINATED_TOOL_USER,
"TRAIT_PACIFISM" = TRAIT_PACIFISM,
"TRAIT_IGNORESLOWDOWN" = TRAIT_IGNORESLOWDOWN,
"TRAIT_IGNOREDAMAGESLOWDOWN" = TRAIT_IGNOREDAMAGESLOWDOWN,
"TRAIT_DEATHCOMA" = TRAIT_DEATHCOMA,
"TRAIT_FAKEDEATH" = TRAIT_FAKEDEATH,
"TRAIT_DISFIGURED" = TRAIT_DISFIGURED,
"TRAIT_XENO_HOST" = TRAIT_XENO_HOST,
"TRAIT_STUNIMMUNE" = TRAIT_STUNIMMUNE,
"TRAIT_BATON_RESISTANCE" = TRAIT_BATON_RESISTANCE,
"TRAIT_IWASBATONED" = TRAIT_IWASBATONED,
"TRAIT_SLEEPIMMUNE" = TRAIT_SLEEPIMMUNE,
"TRAIT_PUSHIMMUNE" = TRAIT_PUSHIMMUNE,
"TRAIT_SHOCKIMMUNE" = TRAIT_SHOCKIMMUNE,
"TRAIT_TESLA_SHOCKIMMUNE" = TRAIT_TESLA_SHOCKIMMUNE,
"TRAIT_STABLEHEART" = TRAIT_STABLEHEART,
"TRAIT_STABLELIVER" = TRAIT_STABLELIVER,
"TRAIT_RESISTHEAT" = TRAIT_RESISTHEAT,
"TRAIT_USED_DNA_VAULT" = TRAIT_USED_DNA_VAULT,
"TRAIT_RESISTHEATHANDS" = TRAIT_RESISTHEATHANDS,
"TRAIT_RESISTCOLD" = TRAIT_RESISTCOLD,
"TRAIT_RESISTHIGHPRESSURE" = TRAIT_RESISTHIGHPRESSURE,
"TRAIT_RESISTLOWPRESSURE" = TRAIT_RESISTLOWPRESSURE,
"TRAIT_BOMBIMMUNE" = TRAIT_BOMBIMMUNE,
"TRAIT_RADIMMUNE" = TRAIT_RADIMMUNE,
"TRAIT_GENELESS" = TRAIT_GENELESS,
"TRAIT_VIRUSIMMUNE" = TRAIT_VIRUSIMMUNE,
"TRAIT_PIERCEIMMUNE" = TRAIT_PIERCEIMMUNE,
"TRAIT_NODISMEMBER" = TRAIT_NODISMEMBER,
"TRAIT_NOFIRE" = TRAIT_NOFIRE,
"TRAIT_NOGUNS" = TRAIT_NOGUNS,
"TRAIT_NOHUNGER" = TRAIT_NOHUNGER,
"TRAIT_NOMETABOLISM" = TRAIT_NOMETABOLISM,
"TRAIT_PLASMA_LOVER_METABOLISM" = TRAIT_PLASMA_LOVER_METABOLISM,
"TRAIT_NOCLONELOSS" = TRAIT_NOCLONELOSS,
"TRAIT_TOXIMMUNE" = TRAIT_TOXIMMUNE,
"TRAIT_EASYDISMEMBER" = TRAIT_EASYDISMEMBER,
"TRAIT_LIMBATTACHMENT" = TRAIT_LIMBATTACHMENT,
"TRAIT_NOLIMBDISABLE" = TRAIT_NOLIMBDISABLE,
"TRAIT_EASILY_WOUNDED" = TRAIT_EASILY_WOUNDED,
"TRAIT_HARDLY_WOUNDED" = TRAIT_HARDLY_WOUNDED,
"TRAIT_NEVER_WOUNDED" = TRAIT_NEVER_WOUNDED,
"TRAIT_TOXINLOVER" = TRAIT_TOXINLOVER,
"TRAIT_NOCRITOVERLAY" = TRAIT_NOCRITOVERLAY,
"TRAIT_NOBREATH" = TRAIT_NOBREATH,
"TRAIT_ANTIMAGIC" = TRAIT_ANTIMAGIC,
"TRAIT_HOLY" = TRAIT_HOLY,
"TRAIT_DEPRESSION" = TRAIT_DEPRESSION,
"TRAIT_JOLLY" = TRAIT_JOLLY,
"TRAIT_NOCRITDAMAGE" = TRAIT_NOCRITDAMAGE,
"TRAIT_NOSLIPWATER" = TRAIT_NOSLIPWATER,
"TRAIT_NOSLIPALL" = TRAIT_NOSLIPALL,
"TRAIT_NODEATH" = TRAIT_NODEATH,
"TRAIT_NOHARDCRIT" = TRAIT_NOHARDCRIT,
"TRAIT_NOSOFTCRIT" = TRAIT_NOSOFTCRIT,
"TRAIT_MINDSHIELD" = TRAIT_MINDSHIELD,
"TRAIT_DISSECTED" = TRAIT_DISSECTED,
"TRAIT_SIXTHSENSE" = TRAIT_SIXTHSENSE,
"TRAIT_FEARLESS" = TRAIT_FEARLESS,
"TRAIT_PARALYSIS_L_ARM" = TRAIT_PARALYSIS_L_ARM,
"TRAIT_PARALYSIS_R_ARM" = TRAIT_PARALYSIS_R_ARM,
"TRAIT_PARALYSIS_L_LEG" = TRAIT_PARALYSIS_L_LEG,
"TRAIT_PARALYSIS_R_LEG" = TRAIT_PARALYSIS_R_LEG,
"TRAIT_CANNOT_OPEN_PRESENTS" = TRAIT_CANNOT_OPEN_PRESENTS,
"TRAIT_PRESENT_VISION" = TRAIT_PRESENT_VISION,
"TRAIT_DISK_VERIFIER" = TRAIT_DISK_VERIFIER,
"TRAIT_BYPASS_MEASURES" = TRAIT_BYPASS_MEASURES,
"TRAIT_NOMOBSWAP" = TRAIT_NOMOBSWAP,
"TRAIT_XRAY_VISION" = TRAIT_XRAY_VISION,
"TRAIT_WEB_WEAVER" = TRAIT_WEB_WEAVER,
"TRAIT_THERMAL_VISION" = TRAIT_THERMAL_VISION,
"TRAIT_ABDUCTOR_TRAINING" = TRAIT_ABDUCTOR_TRAINING,
"TRAIT_ABDUCTOR_SCIENTIST_TRAINING" = TRAIT_ABDUCTOR_SCIENTIST_TRAINING,
"TRAIT_SURGEON" = TRAIT_SURGEON,
"TRAIT_STRONG_GRABBER" = TRAIT_STRONG_GRABBER,
"TRAIT_SOOTHED_THROAT" = TRAIT_SOOTHED_THROAT,
"TRAIT_BOOZE_SLIDER" = TRAIT_BOOZE_SLIDER,
"TRAIT_QUICK_CARRY" = TRAIT_QUICK_CARRY,
"TRAIT_QUICKER_CARRY" = TRAIT_QUICKER_CARRY,
"TRAIT_PLANT_SAFE" = TRAIT_PLANT_SAFE,
"TRAIT_UNINTELLIGIBLE_SPEECH" = TRAIT_UNINTELLIGIBLE_SPEECH,
"TRAIT_UNSTABLE" = TRAIT_UNSTABLE,
"TRAIT_OIL_FRIED" = TRAIT_OIL_FRIED,
"TRAIT_MEDICAL_HUD" = TRAIT_MEDICAL_HUD,
"TRAIT_SECURITY_HUD" = TRAIT_SECURITY_HUD,
"TRAIT_DIAGNOSTIC_HUD" = TRAIT_DIAGNOSTIC_HUD,
"TRAIT_TRAIT_MEDIBOTCOMINGTHROUGH" = TRAIT_MEDIBOTCOMINGTHROUGH,
"TRAIT_PASSTABLE" = TRAIT_PASSTABLE,
"TRAIT_NOFLASH" = TRAIT_NOFLASH,
"TRAIT_XENO_IMMUNE" = TRAIT_XENO_IMMUNE,
"TRAIT_NAIVE" = TRAIT_NAIVE,
"TRAIT_PRIMITIVE" = TRAIT_PRIMITIVE, //unable to use mechs. Given to Ash Walkers
"TRAIT_GUNFLIP" = TRAIT_GUNFLIP,
"TRAIT_SPECIAL_TRAUMA_BOOST" = TRAIT_SPECIAL_TRAUMA_BOOST,
"TRAIT_SPACEWALK" = TRAIT_SPACEWALK,
"TRAIT_GAMERGOD" = TRAIT_GAMERGOD,
"TRAIT_GIANT" = TRAIT_GIANT,
"TRAIT_DWARF" = TRAIT_DWARF,
"TRAIT_SILENT_FOOTSTEPS" = TRAIT_SILENT_FOOTSTEPS,
"TRAIT_NICE_SHOT" = TRAIT_NICE_SHOT,
"TRAIT_TUMOR_SUPPRESSION" = TRAIT_TUMOR_SUPPRESSED,
"TRAIT_PERMANENTLY_ONFIRE" = TRAIT_PERMANENTLY_ONFIRE,
"TRAIT_SIGN_LANG" = TRAIT_SIGN_LANG,
"TRAIT_UNDERWATER_BASKETWEAVING_KNOWLEDGE" = TRAIT_UNDERWATER_BASKETWEAVING_KNOWLEDGE,
"TRAIT_WINE_TASTER" = TRAIT_WINE_TASTER,
"TRAIT_BONSAI" = TRAIT_BONSAI,
"TRAIT_LIGHTBULB_REMOVER" = TRAIT_LIGHTBULB_REMOVER,
"TRAIT_KNOW_CYBORG_WIRES" = TRAIT_KNOW_CYBORG_WIRES,
"TRAIT_KNOW_ENGI_WIRES" = TRAIT_KNOW_ENGI_WIRES,
"TRAIT_ALCOHOL_TOLERANCE" = TRAIT_ALCOHOL_TOLERANCE,
"TRAIT_AGEUSIA" = TRAIT_AGEUSIA,
"TRAIT_HEAVY_SLEEPER" = TRAIT_HEAVY_SLEEPER,
"TRAIT_NIGHT_VISION" = TRAIT_NIGHT_VISION,
"TRAIT_LIGHT_STEP" = TRAIT_LIGHT_STEP,
"TRAIT_SPIRITUAL" = TRAIT_SPIRITUAL,
"TRAIT_CLOWN_ENJOYER" = TRAIT_CLOWN_ENJOYER,
"TRAIT_MIME_FAN" = TRAIT_MIME_FAN,
"TRAIT_VORACIOUS" = TRAIT_VORACIOUS,
"TRAIT_SELF_AWARE" = TRAIT_SELF_AWARE,
"TRAIT_FREERUNNING" = TRAIT_FREERUNNING,
"TRAIT_SKITTISH" = TRAIT_SKITTISH,
"TRAIT_POOR_AIM" = TRAIT_POOR_AIM,
"TRAIT_PROSOPAGNOSIA" = TRAIT_PROSOPAGNOSIA,
"TRAIT_TAGGER" = TRAIT_TAGGER,
"TRAIT_PHOTOGRAPHER" = TRAIT_PHOTOGRAPHER,
"TRAIT_MUSICIAN" = TRAIT_MUSICIAN,
"TRAIT_LIGHT_DRINKER" = TRAIT_LIGHT_DRINKER,
"TRAIT_SMOKER" = TRAIT_SMOKER,
"TRAIT_EMPATH" = TRAIT_EMPATH,
"TRAIT_FRIENDLY" = TRAIT_FRIENDLY,
"TRAIT_GRABWEAKNESS" = TRAIT_GRABWEAKNESS,
"TRAIT_SNOB" = TRAIT_SNOB,
"TRAIT_BALD" = TRAIT_BALD,
"TRAIT_BADTOUCH" = TRAIT_BADTOUCH,
"TRAIT_NOBLOOD" = TRAIT_NOBLOOD,
"TRAIT_KISS_OF_DEATH" = TRAIT_KISS_OF_DEATH,
"TRAIT_ANXIOUS" = TRAIT_ANXIOUS,
"TRAIT_WEAK_SOUL" = TRAIT_WEAK_SOUL,
"TRAIT_NO_SOUL" = TRAIT_NO_SOUL,
"TRAIT_INVISIBLE_MAN" = TRAIT_INVISIBLE_MAN,
"TRAIT_SACRIFICED" = TRAIT_SACRIFICED, //SKYRAT CHANGE - SOULSTONE_CHANGES
"TRAIT_HIDE_EXTERNAL_ORGANS" = TRAIT_HIDE_EXTERNAL_ORGANS,
"TRAIT_CULT_HALO" = TRAIT_CULT_HALO,
"TRAIT_UNNATURAL_RED_GLOWY_EYES" = TRAIT_UNNATURAL_RED_GLOWY_EYES,
"TRAIT_BLOODSHOT_EYES" = TRAIT_BLOODSHOT_EYES,
"TRAIT_SHIFTY_EYES" = TRAIT_SHIFTY_EYES,
"TRAIT_OVERSIZED" = TRAIT_OVERSIZED, //SKYRAT EDIT ADDITION - Leaving this here so that it hopefully doesn't cause conflicts again in the future(?)
"TRAIT_CANNOT_BE_UNBUCKLED" = TRAIT_CANNOT_BE_UNBUCKLED,
"TRAIT_GAMER" = TRAIT_GAMER,
"TRAIT_UNKNOWN" = TRAIT_UNKNOWN,
"TRAIT_PREVENT_IMPLANT_AUTO_EXPLOSION" = TRAIT_PREVENT_IMPLANT_AUTO_EXPLOSION,
),
/obj/item/bodypart = list(
"TRAIT_PARALYSIS" = TRAIT_PARALYSIS,
),
/obj/item/organ/internal/lungs = list(
"TRAIT_SPACEBREATHING" = TRAIT_SPACEBREATHING,
),
/obj/item/organ/internal/liver = list(
"TRAIT_LAW_ENFORCEMENT_METABOLISM" = TRAIT_LAW_ENFORCEMENT_METABOLISM,
"TRAIT_CULINARY_METABOLISM" = TRAIT_CULINARY_METABOLISM,
"TRAIT_COMEDY_METABOLISM" = TRAIT_COMEDY_METABOLISM,
"TRAIT_MEDICAL_METABOLISM" = TRAIT_MEDICAL_METABOLISM,
"TRAIT_ENGINEER_METABOLISM" = TRAIT_ENGINEER_METABOLISM,
"TRAIT_ROYAL_METABOLISM" = TRAIT_ROYAL_METABOLISM,
"TRAIT_PRETENDER_ROYAL_METABOLISM" = TRAIT_PRETENDER_ROYAL_METABOLISM,
"TRAIT_BALLMER_SCIENTIST" = TRAIT_BALLMER_SCIENTIST,
),
/obj/item = list(
"TRAIT_NODROP" = TRAIT_NODROP,
"TRAIT_NO_STORAGE_INSERT" = TRAIT_NO_STORAGE_INSERT,
"TRAIT_T_RAY_VISIBLE" = TRAIT_T_RAY_VISIBLE,
"TRAIT_NO_TELEPORT" = TRAIT_NO_TELEPORT,
"TRAIT_APC_SHOCKING" = TRAIT_APC_SHOCKING,
"TRAIT_UNCATCHABLE" = TRAIT_UNCATCHABLE,
),
/atom = list(
"TRAIT_KEEP_TOGETHER" = TRAIT_KEEP_TOGETHER,
),
/atom/movable = list(
"TRAIT_MOVE_GROUND" = TRAIT_MOVE_GROUND,
"TRAIT_MOVE_FLYING" = TRAIT_MOVE_FLYING,
"TRAIT_MOVE_VENTCRAWLING" = TRAIT_MOVE_VENTCRAWLING,
"TRAIT_MOVE_FLOATING" = TRAIT_MOVE_FLOATING,
"TRAIT_MOVE_PHASING" = TRAIT_MOVE_PHASING,
"TRAIT_LAVA_IMMUNE" = TRAIT_LAVA_IMMUNE,
"TRAIT_ASHSTORM_IMMUNE" = TRAIT_ASHSTORM_IMMUNE,
"TRAIT_SNOWSTORM_IMMUNE" = TRAIT_SNOWSTORM_IMMUNE,
"TRAIT_VOIDSTORM_IMMUNE" = TRAIT_VOIDSTORM_IMMUNE,
"TRAIT_WEATHER_IMMUNE" = TRAIT_WEATHER_IMMUNE,
"TRAIT_RUNECHAT_HIDDEN" = TRAIT_RUNECHAT_HIDDEN,
),
/obj/item/card/id = list(
"TRAIT_MAGNETIC_ID_CARD" = TRAIT_MAGNETIC_ID_CARD,
),
))
/// value -> trait name, generated on use from trait_by_type global
GLOBAL_LIST(trait_name_map)
/proc/generate_trait_name_map()
. = list()
for(var/key in GLOB.traits_by_type)
for(var/tname in GLOB.traits_by_type[key])
var/val = GLOB.traits_by_type[key][tname]
.[val] = tname
GLOBAL_LIST_INIT(movement_type_trait_to_flag, list(
TRAIT_MOVE_GROUND = GROUND,
TRAIT_MOVE_FLYING = FLYING,
TRAIT_MOVE_VENTCRAWLING = VENTCRAWLING,
TRAIT_MOVE_FLOATING = FLOATING,
TRAIT_MOVE_PHASING = PHASING
))
GLOBAL_LIST_INIT(movement_type_addtrait_signals, set_movement_type_addtrait_signals())
GLOBAL_LIST_INIT(movement_type_removetrait_signals, set_movement_type_removetrait_signals())
/proc/set_movement_type_addtrait_signals(signal_prefix)
. = list()
for(var/trait in GLOB.movement_type_trait_to_flag)
. += SIGNAL_ADDTRAIT(trait)
/proc/set_movement_type_removetrait_signals(signal_prefix)
. = list()
for(var/trait in GLOB.movement_type_trait_to_flag)
. += SIGNAL_REMOVETRAIT(trait)