From cb87e54d93bf77411ed79fa9f053cc35d9d51137 Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Wed, 1 Jul 2026 20:59:27 -0500 Subject: [PATCH] Lung cleanup ft. minor suffocation tweak (#96659) ## About The Pull Request ### Notable changes Before: When taking suffocation damage, 3 oxyloss damage is dealt, or 0.66 damage if below 0 health (soft crit threshold). If below 0 hp, and you have `NOCRITDAMAGE`, gets nullified. After: When taking suffocation damage, 3 oxyloss damage is dealt, reduced if you had a partially successful breath (i.e. 75% of a breath = 0.25x damage) or are in soft crit or hard crit (0.22x less damage). If in crit, and you have `NOCRITDAMAGE`, gets nullified. Before: You skip 1 in every 4 breaths when your health is below 0 (soft crit threshold), and skip every breath when your health is below -30 (hard crit threshold) After: You skip 1 in every 4 breaths when in soft crit, and skip every breath when in hard crit Before: You don't heal from successful breaths when below 0 health (soft crit threshold) After: You don't heal from successful breaths when in soft or hard crit ### Other changes - Removed `gasp` from losebreath processing, ie removed chance to gasp twice in one tick when choking. - Deletes `respiration_type`s - Deletes `crit_stabilizing_reagent` - Deletes species `breathid`, replaces it with `get_breath_type` that checks the species' lungs ## Why It's Good For The Game - There was a strange inconsistency where being in crit would drastically reduce the amount of suffocation damage you were dealt, but only if you were not breathing. If you were somehow breathing, you took the full damage. I thought this was a little obtuse, so I wanted to change it to be consistent: Being in crit is just a multiplier. - Making them check for `stat` instead of `health` means they affect people with `NO_SOFTCRIT` or `NO_HARDCRIT` nicer. - See above. - Really just to be cleaner, handle gasping in one place. - I'm not sure why we have `respiration_type`. The only time they're (practically) referred to is in reagent handling, but there are no reagents that set it anything but `ALL`. All it does is make our oxyloss handling made more complicated and harder to read for no purpose. So I decided to axe it - I think anything special handing that should arise should just have some bespoke checks instead. - Nothing set this value to anything else. And guess what, if you changed it, epinephrine still worked because it applies `NO_CRITDAMAGE`. - Species de-hardcoding. Makes it easier to add new breath types. ## Changelog :cl: Melbert balance: Suffocation damage is slightly more consistent now: You take 3 oxyloss per suffocation tick, reduced for partially successful breaths and or if you are in crit. Alternatively, if you are in crit and you have epinephrine/atropine in your system, it gets nullified entirely. code: Cleaned up lungs a bit, particularly relating to abnormal lungs like plasmamen or fish, report any oddities with them. del: You no longer have a chance to gasp twice in one suffocation tick. /:cl: --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> Co-authored-by: san7890 --- code/__DEFINES/mobs.dm | 6 +- code/_globalvars/bitfields.dm | 12 ---- .../dna_infuser/organ_sets/fish_organs.dm | 1 - .../mob/living/basic/health_adjustment.dm | 4 +- .../mob/living/carbon/carbon_defense.dm | 4 +- .../mob/living/carbon/human/_species.dm | 32 +++++++--- code/modules/mob/living/carbon/human/life.dm | 20 +++--- .../carbon/human/species_types/plasmamen.dm | 2 - code/modules/mob/living/carbon/life.dm | 7 +-- code/modules/mob/living/damage_procs.dm | 33 +++------- code/modules/mob/living/living_defines.dm | 2 - .../mob/living/silicon/damage_procs.dm | 2 +- .../mob/living/simple_animal/damage_procs.dm | 4 +- code/modules/mob_spawn/mob_spawn.dm | 2 +- code/modules/reagents/chemistry/reagents.dm | 3 - .../chemistry/reagents/atmos_gas_reagents.dm | 3 +- .../reagents/cat2_medicine_reagents.dm | 10 +-- .../reagents/drinks/alcohol_reagents.dm | 10 +-- .../reagents/drinks/drink_reagents.dm | 6 +- .../chemistry/reagents/drug_reagents.dm | 4 +- .../impure_medicine_reagents.dm | 3 +- .../chemistry/reagents/medicine_reagents.dm | 61 ++++++------------- .../chemistry/reagents/toxin_reagents.dm | 16 ++--- .../surgery/organs/internal/lungs/_lungs.dm | 50 ++++++--------- 24 files changed, 119 insertions(+), 178 deletions(-) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index ce60d394d5c..a82eb4405b2 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -263,8 +263,10 @@ ///Heartbeat is gone... He's dead Jim :( #define BEAT_NONE 0 -#define HUMAN_MAX_OXYLOSS 3 -#define HUMAN_CRIT_MAX_OXYLOSS (SSMOBS_DT/3) +/// Damage dealt every life tick on suffocation +#define SUFFOCATION_OXYLOSS 3 +/// Modifier to damage dealt every life tick on suffocation when the suffocator is in crit +#define SUFFOCATION_OXYLOSS_CRIT_MODIFIER 0.22 /// Combined brute and burn damage states on a human's head after which they become disfigured #define HUMAN_DISFIGURATION_HEAD_DAMAGE_STATES 3 diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index e43efea0140..a44731d8213 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -367,12 +367,6 @@ DEFINE_BITFIELD(mob_flags, list( "MOB_HAS_SCREENTIPS_NAME_OVERRIDE" = MOB_HAS_SCREENTIPS_NAME_OVERRIDE, )) -DEFINE_BITFIELD(mob_respiration_type, list( - "RESPIRATION_OXYGEN" = RESPIRATION_OXYGEN, - "RESPIRATION_N2" = RESPIRATION_N2, - "RESPIRATION_PLASMA" = RESPIRATION_PLASMA, -)) - DEFINE_BITFIELD(mobility_flags, list( "MOVE" = MOBILITY_MOVE, "STAND" = MOBILITY_STAND, @@ -630,12 +624,6 @@ DEFINE_BITFIELD(organ_flags, list( "ORGAN_UNUSABLE" = ORGAN_UNUSABLE, )) -DEFINE_BITFIELD(respiration_type, list( - "RESPIRATION_OXYGEN" = RESPIRATION_OXYGEN, - "RESPIRATION_N2" = RESPIRATION_N2, - "RESPIRATION_PLASMA" = RESPIRATION_PLASMA, -)) - DEFINE_BITFIELD(liked_foodtypes, list( "MEAT" = MEAT, "VEGETABLES" = VEGETABLES, diff --git a/code/game/machinery/dna_infuser/organ_sets/fish_organs.dm b/code/game/machinery/dna_infuser/organ_sets/fish_organs.dm index 1776b76e03a..fcf811b0142 100644 --- a/code/game/machinery/dna_infuser/organ_sets/fish_organs.dm +++ b/code/game/machinery/dna_infuser/organ_sets/fish_organs.dm @@ -324,7 +324,6 @@ /obj/item/organ/lungs/fish/Initialize(mapload) . = ..() add_gas_reaction(/datum/gas/water_vapor, always = PROC_REF(breathe_water)) - respiration_type |= RESPIRATION_OXYGEN //after all, we get oxygen from water AddElement(/datum/element/organ_set_bonus, /datum/status_effect/organ_set_bonus/fish) if(has_gills) gills = new() diff --git a/code/modules/mob/living/basic/health_adjustment.dm b/code/modules/mob/living/basic/health_adjustment.dm index 499f679cdee..410a2afe55a 100644 --- a/code/modules/mob/living/basic/health_adjustment.dm +++ b/code/modules/mob/living/basic/health_adjustment.dm @@ -39,8 +39,8 @@ else if(damage_coeff[BURN]) . = adjust_health(amount * damage_coeff[BURN] * CONFIG_GET(number/damage_multiplier), updating_health, forced) -/mob/living/basic/adjust_oxy_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype, required_respiration_type) - if(!can_adjust_oxy_loss(amount, forced, required_biotype, required_respiration_type)) +/mob/living/basic/adjust_oxy_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype) + if(!can_adjust_oxy_loss(amount, forced, required_biotype)) return 0 if(forced) . = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 47bc96b2dc8..adb6b06d499 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -533,7 +533,7 @@ if(hit_clothes) hit_clothes.take_damage(damage_amount, damage_type, damage_flag, 0) -/mob/living/carbon/adjust_oxy_loss(amount, updating_health = TRUE, forced, required_biotype, required_respiration_type) +/mob/living/carbon/adjust_oxy_loss(amount, updating_health = TRUE, forced, required_biotype) if(!forced && HAS_TRAIT(src, TRAIT_NOBREATH)) amount = min(amount, 0) //Prevents oxy damage but not healing @@ -545,7 +545,7 @@ if(!limb) return -/mob/living/carbon/set_oxy_loss(amount, updating_health = TRUE, forced, required_biotype, required_respiration_type) +/mob/living/carbon/set_oxy_loss(amount, updating_health = TRUE, forced, required_biotype) . = ..() check_passout() diff --git a/code/modules/mob/living/carbon/human/_species.dm b/code/modules/mob/living/carbon/human/_species.dm index eeaa717558b..84c5a92a2bf 100644 --- a/code/modules/mob/living/carbon/human/_species.dm +++ b/code/modules/mob/living/carbon/human/_species.dm @@ -135,14 +135,9 @@ GLOBAL_LIST_EMPTY(features_by_species) var/list/inherent_traits = list() /// List of biotypes the mob belongs to. Used by diseases. var/inherent_biotypes = MOB_ORGANIC|MOB_HUMANOID - /// The type of respiration the mob is capable of doing. Used by adjust_oxy_loss. - var/inherent_respiration_type = RESPIRATION_OXYGEN ///List of factions the mob gain upon gaining this species. var/list/inherent_factions - ///What gas does this species breathe? Used by suffocation screen alerts, most of actual gas breathing is handled by mutantlungs. See [life.dm][code/modules/mob/living/carbon/human/life.dm] - var/breathid = GAS_O2 - ///What anim to use for gibbing var/gib_anim = "gibbed-h" @@ -377,7 +372,6 @@ GLOBAL_LIST_EMPTY(features_by_species) // Drop the items the new species can't wear human_who_gained_species.mob_biotypes = inherent_biotypes - human_who_gained_species.mob_respiration_type = inherent_respiration_type human_who_gained_species.butcher_results = knife_butcher_results?.Copy() //update body zones to match what they are supposed to have @@ -1914,12 +1908,13 @@ GLOBAL_LIST_EMPTY(features_by_species) var/list/to_add = list() - if (breathid != GAS_O2) + var/breath_id = get_breath_type() + if (breath_id && breath_id != GAS_O2) to_add += list(list( SPECIES_PERK_TYPE = SPECIES_NEGATIVE_PERK, SPECIES_PERK_ICON = "wind", - SPECIES_PERK_NAME = "[capitalize(breathid)] Breathing", - SPECIES_PERK_DESC = "[plural_form] must breathe [breathid] to survive. You receive a tank when you arrive.", + SPECIES_PERK_NAME = "[capitalize(breath_id)] Breathing", + SPECIES_PERK_DESC = "[plural_form] must breathe [breath_id] to survive. You receive a tank when you arrive.", )) return to_add @@ -2070,3 +2065,22 @@ GLOBAL_LIST_EMPTY(features_by_species) return HUMAN_HEIGHT_TALLEST return null + +/** + * Returns what type of gas this species breathes + */ +/datum/species/proc/get_breath_type() + if(isnull(mutantlungs)) + return null + + if(mutantlungs::safe_plasma_min > 0) + return GAS_PLASMA + + if(mutantlungs::safe_oxygen_min > 0) + return GAS_O2 + + if(mutantlungs::safe_nitro_min > 0) + return GAS_N2 + + stack_trace("Unsupported breath type for species with [mutantlungs]") + return null diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 3c21ea44ed5..9f2740d4c60 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -81,17 +81,16 @@ if(human_lungs) return human_lungs.check_breath(breath, src) - if(health >= crit_threshold) - adjust_oxy_loss(HUMAN_MAX_OXYLOSS + 1) - else if(!HAS_TRAIT(src, TRAIT_NOCRITDAMAGE)) - adjust_oxy_loss(HUMAN_CRIT_MAX_OXYLOSS) + var/oxy_damage = SUFFOCATION_OXYLOSS + 1 + if(stat == SOFT_CRIT || stat == HARD_CRIT) + oxy_damage *= (HAS_TRAIT(src, TRAIT_NOCRITDAMAGE) ? 0 : SUFFOCATION_OXYLOSS_CRIT_MODIFIER) + + if(oxy_damage > 0) + apply_damage(oxy_damage, OXY) failed_last_breath = TRUE - - var/datum/species/human_species = dna.species - - switch(human_species.breathid) - if(GAS_O2) + switch(dna?.species?.get_breath_type()) + if(GAS_O2, null) // null means use oxyloss alert by default throw_alert(ALERT_NOT_ENOUGH_OXYGEN, /atom/movable/screen/alert/not_enough_oxy) if(GAS_PLASMA) throw_alert(ALERT_NOT_ENOUGH_PLASMA, /atom/movable/screen/alert/not_enough_plas) @@ -99,6 +98,9 @@ throw_alert(ALERT_NOT_ENOUGH_CO2, /atom/movable/screen/alert/not_enough_co2) if(GAS_N2) throw_alert(ALERT_NOT_ENOUGH_NITRO, /atom/movable/screen/alert/not_enough_nitro) + else + stack_trace("Unsupported breath type for species [dna.species.name] in check_breath()") + return FALSE /// Environment handlers for species diff --git a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm index 2989fb95a7d..7b9c9dd516a 100644 --- a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm +++ b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm @@ -17,7 +17,6 @@ ) inherent_biotypes = MOB_HUMANOID|MOB_MINERAL|MOB_SKELETAL - inherent_respiration_type = RESPIRATION_PLASMA mutantlungs = /obj/item/organ/lungs/plasmaman smoker_lungs = /obj/item/organ/lungs/plasmaman/plasmaman_smoker mutanttongue = /obj/item/organ/tongue/bone/plasmaman @@ -27,7 +26,6 @@ mutantheart = null heatmod = 1.5 payday_modifier = 1.0 - breathid = GAS_PLASMA changesource_flags = MIRROR_BADMIN | WABBAJACK | MIRROR_PRIDE | MIRROR_MAGIC | ERT_SPAWN species_cookie = /obj/item/reagent_containers/condiment/milk outfit_important_for_life = /datum/outfit/plasmaman diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 97a6604bc17..ab2b0ca061d 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -83,20 +83,19 @@ if(lungs?.organ_flags & ORGAN_FAILING) losebreath++ else if(!get_organ_slot(ORGAN_SLOT_BREATHING_TUBE)) - if(health <= HEALTH_THRESHOLD_FULLCRIT || pulledby?.grab_state >= GRAB_KILL) + if(stat == HARD_CRIT || pulledby?.grab_state >= GRAB_KILL) losebreath++ //You can't breath at all when in critical or when being choked, so you're going to miss a breath - else if(health <= crit_threshold) + else if(stat == SOFT_CRIT) losebreath += 0.25 //You're having trouble breathing in soft crit, so you'll miss a breath one in four times //Suffocate if(losebreath >= 1) //You've missed a breath, take oxy damage losebreath-- - if(prob(10)) - emote("gasp") if(isobj(loc)) var/obj/loc_as_obj = loc loc_as_obj.handle_internal_lifeform(src,0) + else //Breathe from internal breath = get_breath_from_internal(BREATH_VOLUME) diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index 0db94ce452d..b9068964cbc 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -303,24 +303,15 @@ /mob/living/proc/get_oxy_loss() return oxyloss -/mob/living/proc/can_adjust_oxy_loss(amount, forced, required_biotype, required_respiration_type) - if(!forced) - if(HAS_TRAIT(src, TRAIT_GODMODE)) - return FALSE - if (required_respiration_type) - var/obj/item/organ/lungs/affected_lungs = get_organ_slot(ORGAN_SLOT_LUNGS) - if(isnull(affected_lungs)) - if(!(mob_respiration_type & required_respiration_type)) // if the mob has no lungs, use mob_respiration_type - return FALSE - else - if(!(affected_lungs.respiration_type & required_respiration_type)) // otherwise use the lungs' respiration_type - return FALSE +/mob/living/proc/can_adjust_oxy_loss(amount, forced, required_biotype) + if(!forced && HAS_TRAIT(src, TRAIT_GODMODE)) + return FALSE if(SEND_SIGNAL(src, COMSIG_LIVING_ADJUST_OXY_DAMAGE, OXY, amount, forced) & COMPONENT_IGNORE_CHANGE) return FALSE return TRUE -/mob/living/proc/adjust_oxy_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL, required_respiration_type = ALL) - if(!can_adjust_oxy_loss(amount, forced, required_biotype, required_respiration_type)) +/mob/living/proc/adjust_oxy_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL) + if(!can_adjust_oxy_loss(amount, forced, required_biotype)) return 0 . = oxyloss oxyloss = clamp((oxyloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2) @@ -330,18 +321,10 @@ if(updating_health) updatehealth() -/mob/living/proc/set_oxy_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL, required_respiration_type = ALL) - if(!forced) - if(HAS_TRAIT(src, TRAIT_GODMODE)) - return FALSE +/mob/living/proc/set_oxy_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL) + if(!forced && HAS_TRAIT(src, TRAIT_GODMODE)) + return FALSE - var/obj/item/organ/lungs/affected_lungs = get_organ_slot(ORGAN_SLOT_LUNGS) - if(isnull(affected_lungs)) - if(!(mob_respiration_type & required_respiration_type)) - return FALSE - else - if(!(affected_lungs.respiration_type & required_respiration_type)) - return FALSE . = oxyloss oxyloss = amount . -= oxyloss diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 69edd7a3728..cc3aad0c129 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -111,8 +111,6 @@ var/mob_size = MOB_SIZE_HUMAN /// List of biotypes the mob belongs to. Used by diseases and reagents mainly. var/mob_biotypes = MOB_ORGANIC - /// The type of respiration the mob is capable of doing. Used by adjust_oxy_loss. - var/mob_respiration_type = RESPIRATION_OXYGEN ///more or less efficiency to metabolize helpful/harmful reagents and regulate body temperature.. var/metabolism_efficiency = 1 ///does the mob have distinct limbs?(arms,legs, chest,head) diff --git a/code/modules/mob/living/silicon/damage_procs.dm b/code/modules/mob/living/silicon/damage_procs.dm index d2608e89427..83012e32f3d 100644 --- a/code/modules/mob/living/silicon/damage_procs.dm +++ b/code/modules/mob/living/silicon/damage_procs.dm @@ -22,7 +22,7 @@ /mob/living/silicon/set_organ_loss(slot, amount) return FALSE -/mob/living/silicon/adjust_oxy_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype, required_respiration_type) //immune to oxygen damage +/mob/living/silicon/adjust_oxy_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype) //immune to oxygen damage if(isAI(src)) //ais are snowflakes and use oxyloss for being in AI cards and having no battery return ..() diff --git a/code/modules/mob/living/simple_animal/damage_procs.dm b/code/modules/mob/living/simple_animal/damage_procs.dm index 2d62e8f314f..d908364ce7b 100644 --- a/code/modules/mob/living/simple_animal/damage_procs.dm +++ b/code/modules/mob/living/simple_animal/damage_procs.dm @@ -41,8 +41,8 @@ else if(damage_coeff[BURN]) . = adjustHealth(amount * damage_coeff[BURN] * CONFIG_GET(number/damage_multiplier), updating_health, forced) -/mob/living/simple_animal/adjust_oxy_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype, required_respiration_type) - if(!can_adjust_oxy_loss(amount, forced, required_biotype, required_respiration_type)) +/mob/living/simple_animal/adjust_oxy_loss(amount, updating_health = TRUE, forced = FALSE, required_biotype) + if(!can_adjust_oxy_loss(amount, forced, required_biotype)) return 0 if(forced) . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) diff --git a/code/modules/mob_spawn/mob_spawn.dm b/code/modules/mob_spawn/mob_spawn.dm index 2734fe4dca9..067107fee24 100644 --- a/code/modules/mob_spawn/mob_spawn.dm +++ b/code/modules/mob_spawn/mob_spawn.dm @@ -198,7 +198,7 @@ prompt_fail = tgui_alert(user, prompt, buttons = list("Yes", "No"), timeout = 10 SECONDS) != "Yes" var/species_pref = user.client.prefs.read_preference(/datum/preference/choiced/species) || /datum/species/human - if(!prompt_fail && user.started_as_observer && allow_custom_character && (GLOB.species_prototypes[species_pref].inherent_respiration_type & RESPIRATION_OXYGEN)) + if(!prompt_fail && user.started_as_observer && allow_custom_character && (GLOB.species_prototypes[species_pref].get_breath_type() == GAS_O2)) var/static_prompt = "Because you haven't taken a role so far, you may spawn in as \ [((allow_custom_character & GHOSTROLE_TAKE_PREFS_SPECIES) || species_pref == /datum/species/human) ? "" : "a human version of"] \ your customized character with a random name. Would you like to?" diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 81e2a7ae9e6..70afb30fb41 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -75,9 +75,6 @@ /// The affected biotype, if the reagent damages/heals toxin damage of an affected mob. /// See "Mob bio-types flags" in /code/_DEFINES/mobs.dm var/affected_biotype = MOB_ORGANIC - /// The affected respiration type, if the reagent damages/heals oxygen damage of an affected mob. - /// See "Mob bio-types flags" in /code/_DEFINES/mobs.dm - var/affected_respiration_type = ALL /// A list of traits to apply while the reagent is being metabolized. var/list/metabolized_traits /// A list of traits to apply while the reagent is in a mob. diff --git a/code/modules/reagents/chemistry/reagents/atmos_gas_reagents.dm b/code/modules/reagents/chemistry/reagents/atmos_gas_reagents.dm index 6f698959660..601e28e66bb 100644 --- a/code/modules/reagents/chemistry/reagents/atmos_gas_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/atmos_gas_reagents.dm @@ -137,13 +137,12 @@ taste_description = "bitter" chemical_flags = REAGENT_NO_RANDOM_RECIPE affected_biotype = MOB_ORGANIC | MOB_MINERAL | MOB_PLANT // "toxic to all living beings" - affected_respiration_type = ALL /datum/reagent/zauker/on_mob_life(mob/living/breather, seconds_per_tick, metabolization_ratio) . = ..() var/need_mob_update need_mob_update = breather.adjust_brute_loss(6 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) - need_mob_update += breather.adjust_oxy_loss(1 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += breather.adjust_oxy_loss(1 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += breather.adjust_fire_loss(2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += breather.adjust_tox_loss(2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) if(need_mob_update) diff --git a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm index 13784310a8b..ae3213470ba 100644 --- a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm @@ -35,10 +35,10 @@ switch(affected_mob.stat) if(CONSCIOUS) //bad thou_shall_heal = max(death_is_coming/20, 3) - need_mob_update += affected_mob.adjust_oxy_loss(2 * metabolization_ratio * seconds_per_tick, TRUE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(2 * metabolization_ratio * seconds_per_tick, TRUE, required_biotype = affected_biotype) if(SOFT_CRIT) //meh convert thou_shall_heal = round(death_is_coming/13,0.1) - need_mob_update += affected_mob.adjust_oxy_loss(1 * metabolization_ratio * seconds_per_tick, TRUE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(1 * metabolization_ratio * seconds_per_tick, TRUE, required_biotype = affected_biotype) good_kind_of_healing = TRUE else //no convert thou_shall_heal = round(death_is_coming/10, 0.1) @@ -272,7 +272,7 @@ if(!overdosed) oxycalc = min(oxycalc, affected_mob.get_oxy_loss() + 0.5) //if NOT overdosing, we lower our toxdamage to only the damage we actually healed with a minimum of 0.1*current_cycle. IE if we only heal 10 oxygen damage but we COULD have healed 20, we will only take toxdamage for the 10. We would take the toxdamage for the extra 10 if we were overdosing. var/need_mob_update - need_mob_update = affected_mob.adjust_oxy_loss(-2 * oxycalc * normalise_creation_purity() * metabolization_ratio * seconds_per_tick , FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update = affected_mob.adjust_oxy_loss(-2 * oxycalc * normalise_creation_purity() * metabolization_ratio * seconds_per_tick , FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_tox_loss(2 * oxycalc * metabolization_ratio * seconds_per_tick / CONVERMOL_RATIO, updating_health = FALSE, required_biotype = affected_biotype) if(SPT_PROB((current_cycle-1) / 2, seconds_per_tick) && affected_mob.losebreath) affected_mob.losebreath-- @@ -302,7 +302,7 @@ /datum/reagent/medicine/c2/tirimol/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, metabolization_ratio) . = ..() var/need_mob_update - need_mob_update = affected_mob.adjust_oxy_loss(-4.5 * metabolization_ratio * seconds_per_tick * normalise_creation_purity(), updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update = affected_mob.adjust_oxy_loss(-4.5 * metabolization_ratio * seconds_per_tick * normalise_creation_purity(), updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_stamina_loss(2 * metabolization_ratio * seconds_per_tick, updating_stamina = FALSE, required_biotype = affected_biotype) if(drowsycd && COOLDOWN_FINISHED(src, drowsycd)) affected_mob.adjust_drowsiness(20 SECONDS) @@ -615,7 +615,7 @@ need_mob_update += affected_mob.adjust_tox_loss(-2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_brute_loss(-2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(-2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) - need_mob_update += affected_mob.adjust_oxy_loss(-6 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(-6 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) affected_mob.losebreath = 0 diff --git a/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm index c3be5f228ec..aa18369e823 100644 --- a/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm @@ -591,7 +591,7 @@ need_mob_update = cubano.adjust_brute_loss(-1 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += cubano.adjust_fire_loss(-1 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += cubano.adjust_tox_loss(-1 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) - need_mob_update += cubano.adjust_oxy_loss(-5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += cubano.adjust_oxy_loss(-5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) if(need_mob_update) return UPDATE_MOB_HEALTH @@ -1445,7 +1445,7 @@ var/need_mob_update need_mob_update = drinker.adjust_brute_loss(-3.75 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += drinker.adjust_fire_loss(-3.75 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) - need_mob_update += drinker.adjust_oxy_loss(-5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += drinker.adjust_oxy_loss(-5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += drinker.adjust_tox_loss(-3.75 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) if(need_mob_update) return UPDATE_MOB_HEALTH @@ -1757,7 +1757,7 @@ need_mob_update = drinker.adjust_brute_loss(-heal_amt, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += drinker.adjust_fire_loss(-heal_amt, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += drinker.adjust_tox_loss(-heal_amt, updating_health = FALSE, required_biotype = affected_biotype) - need_mob_update += drinker.adjust_oxy_loss(-heal_amt, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += drinker.adjust_oxy_loss(-heal_amt, updating_health = FALSE, required_biotype = affected_biotype) // heal stamina loss on first metabolization, but only to a max of 20 need_mob_update += drinker.adjust_stamina_loss(max(-heal_amt * 5, -20), updating_stamina = FALSE, required_biotype = affected_biotype) if(need_mob_update) @@ -1773,7 +1773,7 @@ need_mob_update = drinker.adjust_brute_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += drinker.adjust_fire_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += drinker.adjust_tox_loss(-0.125 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) - need_mob_update += drinker.adjust_oxy_loss(-0.75 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += drinker.adjust_oxy_loss(-0.75 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += drinker.adjust_stamina_loss(-1.25 * metabolization_ratio * seconds_per_tick, updating_stamina = FALSE, required_biotype = affected_biotype) if(need_mob_update) return UPDATE_MOB_HEALTH @@ -2207,7 +2207,7 @@ if(drinker?.mind?.has_antag_datum(/datum/antagonist/wizard)) var/need_mob_update need_mob_update = drinker.heal_bodypart_damage(1 * metabolization_ratio * seconds_per_tick, 1 * metabolization_ratio * seconds_per_tick, updating_health = FALSE) - need_mob_update += drinker.adjust_oxy_loss(-1 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += drinker.adjust_oxy_loss(-1 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += drinker.adjust_tox_loss(-1 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += drinker.adjust_stamina_loss(-5 * metabolization_ratio * seconds_per_tick, updating_stamina = FALSE, required_biotype = affected_biotype) if(need_mob_update) diff --git a/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm index 8dfd8ac2709..c5aed896bf0 100644 --- a/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm @@ -11,7 +11,7 @@ /datum/reagent/consumable/orangejuice/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, metabolization_ratio) . = ..() if(affected_mob.get_oxy_loss() && SPT_PROB(16, seconds_per_tick)) - if(affected_mob.adjust_oxy_loss(-0.5 * metabolization_ratio, FALSE, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type)) + if(affected_mob.adjust_oxy_loss(-0.5 * metabolization_ratio, FALSE, updating_health = FALSE, required_biotype = affected_biotype)) return UPDATE_MOB_HEALTH /datum/reagent/consumable/tomatojuice @@ -824,7 +824,7 @@ need_mob_update = affected_mob.adjust_brute_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_tox_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) - need_mob_update += affected_mob.adjust_oxy_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) if(affected_mob.nutrition && (affected_mob.nutrition - 2 > 0)) var/obj/item/organ/liver/liver = affected_mob.get_organ_slot(ORGAN_SLOT_LIVER) if(!(HAS_TRAIT(liver, TRAIT_MEDICAL_METABOLISM))) @@ -1220,7 +1220,7 @@ /datum/reagent/consumable/mushroom_tea/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, metabolization_ratio) . = ..() if(islizard(affected_mob)) - if(affected_mob.adjust_oxy_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type)) + if(affected_mob.adjust_oxy_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype)) return UPDATE_MOB_HEALTH //Moth Stuff diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index 2e776ebfb06..912d068cf02 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -114,7 +114,7 @@ . = ..() var/need_mob_update need_mob_update = affected_mob.adjust_tox_loss(0.4 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) - need_mob_update += affected_mob.adjust_oxy_loss(4.4 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(4.4 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) if(need_mob_update) return UPDATE_MOB_HEALTH @@ -302,7 +302,7 @@ need_mob_update += affected_mob.adjust_tox_loss(0.5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) if(SPT_PROB(30, seconds_per_tick)) affected_mob.losebreath++ - need_mob_update += affected_mob.adjust_oxy_loss(1, FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(1, FALSE, required_biotype = affected_biotype) if(need_mob_update) return UPDATE_MOB_HEALTH diff --git a/code/modules/reagents/chemistry/reagents/impure_reagents/impure_medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/impure_reagents/impure_medicine_reagents.dm index c536445a37e..99169ee8f0a 100644 --- a/code/modules/reagents/chemistry/reagents/impure_reagents/impure_medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/impure_reagents/impure_medicine_reagents.dm @@ -32,7 +32,6 @@ addiction_types = list(/datum/addiction/medicine = 400) ph = 11 affected_biotype = MOB_ORGANIC | MOB_MINERAL | MOB_PLANT // no healing ghosts - affected_respiration_type = ALL //Random healing of the 4 main groups /datum/reagent/impurity/healing/medicine_failure/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, metabolization_ratio) @@ -47,7 +46,7 @@ if("tox") need_mob_update = affected_mob.adjust_tox_loss(-0.2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) if("oxy") - need_mob_update = affected_mob.adjust_oxy_loss(-0.2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update = affected_mob.adjust_oxy_loss(-0.2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) if(need_mob_update) return UPDATE_MOB_HEALTH diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 205000f0ff0..649483afbc0 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -160,7 +160,7 @@ if(HAS_TRAIT(affected_mob, TRAIT_KNOCKEDOUT)) //Significantly more effective when unconscious power *= 2 var/need_mob_update - need_mob_update = affected_mob.adjust_oxy_loss(-1.5 * power * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update = affected_mob.adjust_oxy_loss(-1.5 * power * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_brute_loss(-0.5 * power * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(-0.5 * power * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_tox_loss(-0.5 * power * metabolization_ratio * seconds_per_tick, updating_health = FALSE, forced = TRUE, required_biotype = affected_biotype) //heals TOXINLOVERs @@ -203,7 +203,7 @@ power *= 2 var/need_mob_update - need_mob_update = affected_mob.adjust_oxy_loss(-1 * power * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update = affected_mob.adjust_oxy_loss(-1 * power * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_brute_loss(-0.5 * power * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(-0.75 * power * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_tox_loss(-0.5 * power * metabolization_ratio * seconds_per_tick, updating_health = FALSE, forced = TRUE, required_biotype = affected_biotype) @@ -424,7 +424,7 @@ var/heal = -2 * healing * metabolization_ratio * seconds_per_tick var/need_mob_update need_mob_update = affected_mob.adjust_tox_loss(heal, updating_health = FALSE, required_biotype = affected_biotype) - need_mob_update += affected_mob.adjust_oxy_loss(heal, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(heal, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_brute_loss(heal, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(heal, updating_health = FALSE, required_bodytype = affected_bodytype) if(need_mob_update) @@ -435,7 +435,7 @@ var/hurt = 3 * metabolization_ratio * seconds_per_tick var/need_mob_update need_mob_update = affected_mob.adjust_tox_loss(hurt, updating_health = FALSE, required_biotype = affected_biotype) - need_mob_update += affected_mob.adjust_oxy_loss(hurt, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(hurt, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_brute_loss(hurt, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(hurt, updating_health = FALSE, required_bodytype = affected_bodytype) if(need_mob_update) @@ -587,13 +587,8 @@ /datum/reagent/medicine/salbutamol/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, metabolization_ratio) . = ..() var/need_mob_update - need_mob_update = affected_mob.adjust_oxy_loss(-6 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) - if(affected_mob.losebreath >= 4) - var/obj/item/organ/lungs/affected_lungs = affected_mob.get_organ_slot(ORGAN_SLOT_LUNGS) - var/our_respiration_type = affected_lungs ? affected_lungs.respiration_type : affected_mob.mob_respiration_type // use lungs' respiration type or mob_respiration_type if no lungs - if(our_respiration_type & affected_respiration_type) - affected_mob.losebreath -= 4 * metabolization_ratio * seconds_per_tick - need_mob_update = TRUE + need_mob_update = affected_mob.adjust_oxy_loss(-6 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) + affected_mob.losebreath = max(0, affected_mob.losebreath - (4 * metabolization_ratio * seconds_per_tick)) if(need_mob_update) return UPDATE_MOB_HEALTH @@ -997,13 +992,10 @@ need_mob_update = affected_mob.adjust_tox_loss(-4 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_brute_loss(-4 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(-4 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) - need_mob_update += affected_mob.adjust_oxy_loss(-10 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(-10 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) if(need_mob_update) . = UPDATE_MOB_HEALTH - var/obj/item/organ/lungs/affected_lungs = affected_mob.get_organ_slot(ORGAN_SLOT_LUNGS) - var/our_respiration_type = affected_lungs ? affected_lungs.respiration_type : affected_mob.mob_respiration_type - if(our_respiration_type & affected_respiration_type) - affected_mob.losebreath = 0 + affected_mob.losebreath = 0 if(SPT_PROB(10, seconds_per_tick)) affected_mob.set_dizzy_if_lower(10 SECONDS) affected_mob.set_jitter_if_lower(10 SECONDS) @@ -1040,16 +1032,8 @@ need_mob_update = affected_mob.adjust_tox_loss(heal, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_brute_loss(heal, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(heal, updating_health = FALSE, required_bodytype = affected_bodytype) - need_mob_update += affected_mob.adjust_oxy_loss(heal, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) - if(affected_mob.losebreath >= 4) - var/obj/item/organ/lungs/affected_lungs = affected_mob.get_organ_slot(ORGAN_SLOT_LUNGS) - var/our_respiration_type = affected_lungs ? affected_lungs.respiration_type : affected_mob.mob_respiration_type - if(our_respiration_type & affected_respiration_type) - affected_mob.losebreath -= 4 * metabolization_ratio * seconds_per_tick - need_mob_update = TRUE - if(affected_mob.losebreath < 0) - affected_mob.losebreath = 0 - need_mob_update = TRUE + need_mob_update += affected_mob.adjust_oxy_loss(heal, updating_health = FALSE, required_biotype = affected_biotype) + affected_mob.losebreath = max(0, affected_mob.losebreath - (4 * metabolization_ratio * seconds_per_tick)) need_mob_update += affected_mob.adjust_stamina_loss(-4 * metabolization_ratio * seconds_per_tick, updating_stamina = FALSE) if(SPT_PROB(10, seconds_per_tick)) affected_mob.AdjustAllImmobility(-20) @@ -1070,11 +1054,7 @@ var/need_mob_update need_mob_update = affected_mob.adjust_stamina_loss(5 * metabolization_ratio, updating_stamina = FALSE) need_mob_update += affected_mob.adjust_tox_loss(2 * metabolization_ratio, updating_health = FALSE, required_biotype = affected_biotype) - var/obj/item/organ/lungs/affected_lungs = affected_mob.get_organ_slot(ORGAN_SLOT_LUNGS) - var/our_respiration_type = affected_lungs ? affected_lungs.respiration_type : affected_mob.mob_respiration_type - if(our_respiration_type & affected_respiration_type) - affected_mob.losebreath++ - need_mob_update = TRUE + affected_mob.losebreath++ if(need_mob_update) return UPDATE_MOB_HEALTH @@ -1386,7 +1366,7 @@ var/need_mob_update if(affected_mob.health < 50 && affected_mob.health > 0) var/heal = -1 * metabolization_ratio * seconds_per_tick - need_mob_update += affected_mob.adjust_oxy_loss(heal, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(heal, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_tox_loss(heal, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_brute_loss(heal, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(heal, updating_health = FALSE, required_bodytype = affected_bodytype) @@ -1442,7 +1422,6 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED randomized_spawns = REAGENT_SPAWN_ALL_RANDOM_SPAWNS affected_biotype = MOB_ORGANIC | MOB_MINERAL | MOB_PLANT // no healing ghosts - affected_respiration_type = ALL /datum/reagent/medicine/regen_jelly/expose_mob(mob/living/exposed_mob, reac_volume) . = ..() @@ -1459,7 +1438,7 @@ var/need_mob_update need_mob_update = affected_mob.adjust_brute_loss(heal, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(heal, updating_health = FALSE, required_bodytype = affected_bodytype) - need_mob_update += affected_mob.adjust_oxy_loss(heal, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(heal, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_tox_loss(heal, updating_health = FALSE, forced = TRUE, required_biotype = affected_biotype) //heals TOXINLOVERs if(need_mob_update) return UPDATE_MOB_HEALTH @@ -1507,14 +1486,14 @@ if(current_cycle < 25) //10u has to be processed before u get into THE FUN ZONE need_mob_update = affected_mob.adjust_brute_loss(-0.5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(-0.5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) - need_mob_update += affected_mob.adjust_oxy_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_tox_loss(-0.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_stamina_loss(-1 * metabolization_ratio * seconds_per_tick, updating_stamina = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_organ_loss(ORGAN_SLOT_BRAIN, 0.5 * metabolization_ratio * seconds_per_tick, 150, affected_organ_flags) //This does, after all, come from ambrosia, and the most powerful ambrosia in existence, at that! else need_mob_update = affected_mob.adjust_brute_loss(-2.5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) //slow to start, but very quick healing once it gets going need_mob_update += affected_mob.adjust_fire_loss(-2.5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) - need_mob_update += affected_mob.adjust_oxy_loss(-1.5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(-1.5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_tox_loss(-1.5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_stamina_loss(-4 * metabolization_ratio * seconds_per_tick, updating_stamina = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_organ_loss(ORGAN_SLOT_BRAIN, 1 * metabolization_ratio * seconds_per_tick, 150, affected_organ_flags) @@ -1730,7 +1709,7 @@ affected_mob.losebreath++ need_mob_update = TRUE if(41 to 80) - need_mob_update = affected_mob.adjust_oxy_loss(2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update = affected_mob.adjust_oxy_loss(2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_stamina_loss(2 * metabolization_ratio * seconds_per_tick, updating_stamina = FALSE, required_biotype = affected_biotype) affected_mob.adjust_jitter_up_to(40 SECONDS * metabolization_ratio * seconds_per_tick, 40 SECONDS) affected_mob.adjust_stutter_up_to(40 SECONDS * metabolization_ratio * seconds_per_tick, 40 SECONDS) @@ -1744,12 +1723,12 @@ affected_mob.Paralyze(20) // you should be in a bad spot at this point unless epipen has been used if(81) to_chat(affected_mob, span_userdanger("You feel too exhausted to continue!")) // at this point you will eventually die unless you get charcoal - need_mob_update = affected_mob.adjust_oxy_loss(2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update = affected_mob.adjust_oxy_loss(2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_stamina_loss(2 * metabolization_ratio * seconds_per_tick, updating_stamina = FALSE, required_biotype = affected_biotype) if(82 to INFINITY) REMOVE_TRAIT(affected_mob, TRAIT_SLEEPIMMUNE, type) affected_mob.Sleeping(200 SECONDS * metabolization_ratio * seconds_per_tick) - need_mob_update += affected_mob.adjust_oxy_loss(30 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(30 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_stamina_loss(30 * metabolization_ratio * seconds_per_tick, updating_stamina = FALSE, required_biotype = affected_biotype) if(need_mob_update) return UPDATE_MOB_HEALTH @@ -1918,12 +1897,12 @@ if(SPT_PROB(7.5, seconds_per_tick)) affected_mob.losebreath += rand(2, 4) - affected_mob.adjust_oxy_loss(METABOLIZE_FREE_CONSTANT(1) * rand(1, 3) * metabolization_ratio, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + affected_mob.adjust_oxy_loss(METABOLIZE_FREE_CONSTANT(1) * rand(1, 3) * metabolization_ratio, updating_health = FALSE, required_biotype = affected_biotype) if(prob(30)) to_chat(affected_mob, span_danger("You can feel your blood clotting up in your veins!")) else if(prob(10)) to_chat(affected_mob, span_userdanger("You feel like your blood has stopped moving!")) - affected_mob.adjust_oxy_loss(METABOLIZE_FREE_CONSTANT(0.5) * rand(3, 4) * metabolization_ratio, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + affected_mob.adjust_oxy_loss(METABOLIZE_FREE_CONSTANT(0.5) * rand(3, 4) * metabolization_ratio, updating_health = FALSE, required_biotype = affected_biotype) if(prob(50)) var/obj/item/organ/lungs/our_lungs = affected_mob.get_organ_slot(ORGAN_SLOT_LUNGS) diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index b83cf6ded83..ce6a9cd3f7e 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -233,7 +233,7 @@ /datum/reagent/toxin/lexorin/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, metabolization_ratio) . = ..() if(!HAS_TRAIT(affected_mob, TRAIT_NOBREATH)) - affected_mob.adjust_oxy_loss(2.5 * normalise_creation_purity() * metabolization_ratio * seconds_per_tick, FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + affected_mob.adjust_oxy_loss(2.5 * normalise_creation_purity() * metabolization_ratio * seconds_per_tick, FALSE, required_biotype = affected_biotype) affected_mob.losebreath += 1 * normalise_creation_purity() * metabolization_ratio * seconds_per_tick . = UPDATE_MOB_HEALTH if(SPT_PROB(10, seconds_per_tick)) @@ -371,7 +371,7 @@ /datum/reagent/toxin/zombiepowder/proc/zombify(mob/living/holder_mob) PRIVATE_PROC(TRUE) - holder_mob.adjust_oxy_loss(0.25, FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + holder_mob.adjust_oxy_loss(0.25, FALSE, required_biotype = affected_biotype) if((data?["method"] & (INGEST|INHALE)) && holder_mob.stat != DEAD) holder_mob.apply_status_effect(/datum/status_effect/reagent_effect/fakedeath, type) @@ -416,7 +416,7 @@ /datum/reagent/toxin/ghoulpowder/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, metabolization_ratio) . = ..() - if(affected_mob.adjust_oxy_loss(0.5 * metabolization_ratio * seconds_per_tick, FALSE, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type)) + if(affected_mob.adjust_oxy_loss(0.5 * metabolization_ratio * seconds_per_tick, FALSE, updating_health = FALSE, required_biotype = affected_biotype)) return UPDATE_MOB_HEALTH /datum/reagent/toxin/mindbreaker @@ -806,7 +806,7 @@ . = ..() var/heal = 4 * metabolization_ratio * seconds_per_tick var/need_mob_update - need_mob_update = affected_mob.adjust_oxy_loss(heal, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update = affected_mob.adjust_oxy_loss(heal, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_brute_loss(heal, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_tox_loss(heal, updating_health = FALSE, required_biotype = affected_biotype) if(need_mob_update) @@ -988,7 +988,7 @@ affected_mob.Paralyze(60) if(2) affected_mob.losebreath += 10 - affected_mob.adjust_oxy_loss(2 * rand(5,25) * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + affected_mob.adjust_oxy_loss(2 * rand(5,25) * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update = TRUE if(3) if(!affected_mob.undergoing_cardiac_arrest() && affected_mob.can_heartattack()) @@ -997,7 +997,7 @@ affected_mob.visible_message(span_userdanger("[affected_mob] clutches at [affected_mob.p_their()] chest as if [affected_mob.p_their()] heart stopped!")) else affected_mob.losebreath += 10 - need_mob_update = affected_mob.adjust_oxy_loss(rand(5,25), updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update = affected_mob.adjust_oxy_loss(rand(5,25), updating_health = FALSE, required_biotype = affected_biotype) if(need_mob_update) return UPDATE_MOB_HEALTH @@ -1158,7 +1158,7 @@ . = ..() if(current_cycle > 11) affected_mob.Paralyze(240 * metabolization_ratio * seconds_per_tick) - if(affected_mob.adjust_oxy_loss(2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type)) + if(affected_mob.adjust_oxy_loss(2 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype)) return UPDATE_MOB_HEALTH /datum/reagent/toxin/heparin //Based on a real-life anticoagulant. I'm not a doctor, so this won't be realistic. @@ -1502,7 +1502,7 @@ liver_tolerance_multiplier = 0 silent_toxin = TRUE remove_paralysis(affected_mob) - need_mob_update += affected_mob.adjust_oxy_loss(-3.5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update += affected_mob.adjust_oxy_loss(-3.5 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update = affected_mob.adjust_tox_loss(-3.25 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) need_mob_update += affected_mob.adjust_brute_loss(-6 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) need_mob_update += affected_mob.adjust_fire_loss(-6.75 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_bodytype = affected_bodytype) diff --git a/code/modules/surgery/organs/internal/lungs/_lungs.dm b/code/modules/surgery/organs/internal/lungs/_lungs.dm index a93382c2b82..8e0472d271d 100644 --- a/code/modules/surgery/organs/internal/lungs/_lungs.dm +++ b/code/modules/surgery/organs/internal/lungs/_lungs.dm @@ -7,8 +7,6 @@ gender = PLURAL w_class = WEIGHT_CLASS_SMALL - var/respiration_type = NONE // The type(s) of gas this lung needs for respiration - healing_factor = STANDARD_ORGAN_HEALING decay_factor = STANDARD_ORGAN_DECAY * 0.9 // fails around 16.5 minutes, lungs are one of the last organs to die (of the ones we have) @@ -111,22 +109,12 @@ var/heat_level_3_damage = HEAT_GAS_DAMAGE_LEVEL_3 var/heat_damage_type = BURN - var/crit_stabilizing_reagent = /datum/reagent/medicine/epinephrine - var/breath_noise = "steady in- and exhalation" -// assign the respiration_type /obj/item/organ/lungs/Initialize(mapload) . = ..() breath_out = new(BREATH_VOLUME) - if(safe_nitro_min) - respiration_type |= RESPIRATION_N2 - if(safe_oxygen_min) - respiration_type |= RESPIRATION_OXYGEN - if(safe_plasma_min) - respiration_type |= RESPIRATION_PLASMA - // Sets up what gases we want to react to, and in what way // always is always processed, while_present is called when the gas is in the breath, and on_loss is called right after a gas is lost // The naming convention goes like this @@ -264,7 +252,7 @@ breathe_gas_volume(breath, /datum/gas/oxygen, /datum/gas/carbon_dioxide) // Heal mob if not in crit. - if(breather.health >= breather.crit_threshold && breather.oxyloss) + if(breather.stat != SOFT_CRIT && breather.stat != HARD_CRIT && breather.get_oxy_loss()) breather.adjust_oxy_loss(-5) /// Maximum Oxygen effects. "Too much O2!" @@ -736,32 +724,28 @@ /obj/item/organ/lungs/proc/handle_suffocation(mob/living/carbon/human/suffocator = null, breath_pp = 0, safe_breath_min = 0, mole_count = 0) . = 0 // Can't suffocate without a Human, or without minimum breath pressure. - if(!suffocator || !safe_breath_min) + if(isnull(suffocator) || safe_breath_min <= 0) return // Mob is suffocating. suffocator.failed_last_breath = TRUE // Give them a chance to notice something is wrong. - if(prob(20)) + if(prob(25)) suffocator.emote("gasp") - // If mob is at critical health, check if they can be damaged further. - if(suffocator.health < suffocator.crit_threshold) - // Mob is immune to damage at critical health. - if(HAS_TRAIT(suffocator, TRAIT_NOCRITDAMAGE)) - return - // Reagents like Epinephrine stop suffocation at critical health. - if(suffocator.reagents.has_reagent(crit_stabilizing_reagent, needs_metabolizing = TRUE)) - return - // Low pressure. - if(breath_pp) - var/ratio = safe_breath_min / breath_pp - suffocator.apply_damage(min(5 * ratio, HUMAN_MAX_OXYLOSS), OXY) - return mole_count * ratio / 6 - // Zero pressure. - if(suffocator.health >= suffocator.crit_threshold) - suffocator.apply_damage(HUMAN_MAX_OXYLOSS, OXY) - else - suffocator.apply_damage(HUMAN_CRIT_MAX_OXYLOSS, OXY) + // note: this is where crit damage is handled for mobs that breathe + var/oxy_damage_dealt = SUFFOCATION_OXYLOSS + if(breath_pp > 0) + // we got a partial breath, scale the damage based on how much we got + oxy_damage_dealt *= ((safe_breath_min - breath_pp) / safe_breath_min) + . = mole_count + + // in hard crit, suffocation damage is reduced significantly (or to zero if the relevant trait is present) + if(suffocator.stat == SOFT_CRIT || suffocator.stat == HARD_CRIT) + oxy_damage_dealt *= (HAS_TRAIT(suffocator, TRAIT_NOCRITDAMAGE) ? 0 : SUFFOCATION_OXYLOSS_CRIT_MODIFIER) + + if(oxy_damage_dealt > 0) + suffocator.apply_damage(oxy_damage_dealt, OXY) + return . /obj/item/organ/lungs/proc/handle_breath_temperature(datum/gas_mixture/breath, mob/living/carbon/human/breather) // called by human/life, handles temperatures var/breath_temperature = breath.temperature