From 17ec460cc54c7dee82626a2f8e3c50098ee1827a Mon Sep 17 00:00:00 2001 From: mikomyazaki <47489928+mikomyazaki@users.noreply.github.com> Date: Fri, 8 Apr 2022 15:42:06 +0100 Subject: [PATCH] Toxins suppress natural liver healing rate. (#13420) --- code/modules/organs/internal/_internal.dm | 14 +++++++++----- code/modules/organs/internal/liver.dm | 18 +++++++++--------- .../Chemistry-Reagents-Toxins.dm | 2 ++ html/changelogs/toxins-do-damage-now.yml | 6 ++++++ 4 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 html/changelogs/toxins-do-damage-now.yml diff --git a/code/modules/organs/internal/_internal.dm b/code/modules/organs/internal/_internal.dm index 6d0f6db46c6..84215072e53 100644 --- a/code/modules/organs/internal/_internal.dm +++ b/code/modules/organs/internal/_internal.dm @@ -139,8 +139,12 @@ tick_surge_damage() //Yes, this is intentional. /obj/item/organ/internal/proc/handle_regeneration() - if(!damage || BP_IS_ROBOTIC(src) || !istype(owner) || owner.chem_effects[CE_TOXIN] || (toxin_type in owner.chem_effects) || owner.is_asystole()) - return - var/repair_modifier = owner.chem_effects[CE_ORGANREPAIR] || 0.1 - if(damage < repair_modifier*max_damage) - heal_damage(repair_modifier) \ No newline at end of file + SHOULD_CALL_PARENT(TRUE) + if(damage && !BP_IS_ROBOTIC(src) && istype(owner)) + if(!owner.is_asystole()) + if(!(owner.chem_effects[CE_TOXIN] || (toxin_type in owner.chem_effects))) + var/repair_modifier = owner.chem_effects[CE_ORGANREPAIR] || 0.1 + if(damage < repair_modifier*max_damage) + heal_damage(repair_modifier) + return TRUE // regeneration is allowed + return FALSE // regeneration is prevented diff --git a/code/modules/organs/internal/liver.dm b/code/modules/organs/internal/liver.dm index ea157cda7a4..a524df28c51 100644 --- a/code/modules/organs/internal/liver.dm +++ b/code/modules/organs/internal/liver.dm @@ -47,13 +47,6 @@ if(owner.intoxication > 0) owner.adjustToxLoss(0.5 * max(2 - filter_effect, 0)) - // Heal a bit if needed and we're not busy. This allows recovery from low amounts of toxloss. - if(!owner.total_radiation && damage > 0) - if(damage < min_broken_damage) - heal_damage(0.2) - if(damage < min_bruised_damage) - heal_damage(0.3) - var/filter_strength = INTOX_FILTER_HEALTHY if(is_bruised()) filter_strength = INTOX_FILTER_BRUISED @@ -76,6 +69,13 @@ if(is_damaged()) owner.adjustToxLoss(owner.chem_effects[toxin_type] * 0.1 * PROCESS_ACCURACY) // as actual organ damage is handled elsewhere -//We got it covered in Process with more detailed thing /obj/item/organ/internal/liver/handle_regeneration() - return \ No newline at end of file + if(..()) + testing("Liver regenerating!") + if(!owner.total_radiation && damage > 0) + if(damage < min_broken_damage) + heal_damage(0.2) + if(damage < min_bruised_damage) + heal_damage(0.3) + return TRUE + return FALSE diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm index 5c1114824c3..5412470dfee 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm @@ -9,6 +9,7 @@ taste_description = "bitterness" taste_mult = 1.2 fallback_specific_heat = 0.75 + overdose = 10 var/target_organ // needs to be null by default var/strength = 2 // How much damage it deals per unit @@ -36,6 +37,7 @@ C.take_damage(removed * 2) if(dam) M.adjustToxLoss(target_organ ? (dam * 0.5) : dam) + M.add_chemical_effect(CE_TOXIN, removed * strength) /decl/reagent/toxin/plasticide name = "Plasticide" diff --git a/html/changelogs/toxins-do-damage-now.yml b/html/changelogs/toxins-do-damage-now.yml new file mode 100644 index 00000000000..ba034be053e --- /dev/null +++ b/html/changelogs/toxins-do-damage-now.yml @@ -0,0 +1,6 @@ +author: mikomyazaki + +delete-after: True + +changes: + - bugfix: "Fixes a bug where toxins (e.g. from giant spiders) would never do damage because they couldn't beat your liver's natural healing rate. Toxins now suppress your liver's natural healing and can become dangerous if you don't deal with the poison within several minutes."