From ec990f17966bab39b59f2ddf4c6e8c149b08ab53 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 19 Nov 2023 22:05:19 +0100 Subject: [PATCH] [MIRROR] Splits reagent metabolization from reagent effects. [MDB IGNORE] (#25125) * Splits reagent metabolization from reagent effects. * Update alcohol_reagents.dm --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com> --- code/modules/reagents/chemistry/holder.dm | 11 ++- code/modules/reagents/chemistry/reagents.dm | 18 ++-- .../chemistry/reagents/atmos_gas_reagents.dm | 3 +- .../reagents/cat2_medicine_reagents.dm | 2 +- .../reagents/drinks/alcohol_reagents.dm | 3 +- .../reagents/drinks/drink_reagents.dm | 9 +- .../chemistry/reagents/drug_reagents.dm | 3 +- .../chemistry/reagents/food_reagents.dm | 12 +-- .../chemistry/reagents/impure_reagents.dm | 9 +- .../chemistry/reagents/medicine_reagents.dm | 38 ++++---- .../chemistry/reagents/other_reagents.dm | 29 +++--- .../reagents/pyrotechnic_reagents.dm | 21 +++-- .../chemistry/reagents/toxin_reagents.dm | 90 ++++++++++--------- 13 files changed, 127 insertions(+), 121 deletions(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 8236a17fb58..2caf6503eed 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -786,10 +786,13 @@ if(reagent.overdosed) need_mob_update += reagent.overdose_process(owner, seconds_per_tick, times_fired) - if(!dead) - need_mob_update += reagent.on_mob_life(owner, seconds_per_tick, times_fired) - if(dead) - need_mob_update += reagent.on_mob_dead(owner, seconds_per_tick) + reagent.current_cycle++ + need_mob_update += reagent.on_mob_life(owner, seconds_per_tick, times_fired) + if(dead && !QDELETED(owner) && !QDELETED(reagent)) + need_mob_update += reagent.on_mob_dead(owner, seconds_per_tick) + if(!QDELETED(owner) && !QDELETED(reagent)) + reagent.metabolize_reagent(owner, seconds_per_tick, times_fired) + return need_mob_update /** diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 9b388c66085..49eb6d18908 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -155,7 +155,9 @@ */ /datum/reagent/proc/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) SHOULD_CALL_PARENT(TRUE) - current_cycle++ + +///Metabolizes a portion of the reagent after on_mob_life() is called +/datum/reagent/proc/metabolize_reagent(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) if(length(reagent_removal_skip_list)) return if(isnull(holder)) @@ -170,6 +172,7 @@ holder.remove_reagent(type, metabolizing_out) + /// Called in burns.dm *if* the reagent has the REAGENT_AFFECTS_WOUNDS process flag /datum/reagent/proc/on_burn_wound_processing(datum/wound/burn/flesh/burn_wound) return @@ -203,15 +206,12 @@ Primarily used in reagents/reaction_agents /datum/reagent/proc/on_mob_end_metabolize(mob/living/affected_mob) return -/// Called when a reagent is inside of a mob when they are dead. Returning UPDATE_MOB_HEALTH will cause updatehealth() to be called on the holder mob by /datum/reagents/proc/metabolize. +/** + * Called when a reagent is inside of a mob when they are dead if the reagent has the REAGENT_DEAD_PROCESS flag + * Returning UPDATE_MOB_HEALTH will cause updatehealth() to be called on the holder mob by /datum/reagents/proc/metabolize. + */ /datum/reagent/proc/on_mob_dead(mob/living/carbon/affected_mob, seconds_per_tick) - if(!(chemical_flags & REAGENT_DEAD_PROCESS)) - return - current_cycle++ - if(length(reagent_removal_skip_list)) - return - if(holder) - holder.remove_reagent(type, metabolization_rate * affected_mob.metabolism_efficiency * seconds_per_tick) + SHOULD_CALL_PARENT(TRUE) /// Called after add_reagents creates a new reagent. /datum/reagent/proc/on_new(data) diff --git a/code/modules/reagents/chemistry/reagents/atmos_gas_reagents.dm b/code/modules/reagents/chemistry/reagents/atmos_gas_reagents.dm index 4550edbdfdf..7b13b2d28b1 100644 --- a/code/modules/reagents/chemistry/reagents/atmos_gas_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/atmos_gas_reagents.dm @@ -130,13 +130,12 @@ if(!HAS_TRAIT(breather, TRAIT_KNOCKEDOUT)) return - . = ..() for(var/obj/item/organ/organ_being_healed as anything in breather.organs) if(!organ_being_healed.damage) continue if(organ_being_healed.apply_organ_damage(-0.5 * REM * seconds_per_tick, required_organ_flag = ORGAN_ORGANIC)) - return UPDATE_MOB_HEALTH + . = UPDATE_MOB_HEALTH /datum/reagent/zauker name = "Zauker" diff --git a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm index 2f90e9f0896..2ebb6a884c0 100644 --- a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm @@ -26,6 +26,7 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/medicine/c2/helbital/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() var/death_is_coming = (affected_mob.getToxLoss() + affected_mob.getOxyLoss() + affected_mob.getFireLoss() + affected_mob.getBruteLoss())*normalise_creation_purity() var/thou_shall_heal = 0 var/good_kind_of_healing = FALSE @@ -78,7 +79,6 @@ affected_mob.revive(HEAL_ALL) holder.del_reagent(type) return - return ..() || . /datum/reagent/medicine/c2/helbital/overdose_process(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() diff --git a/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm index a29fad6d68e..4b517df06a4 100644 --- a/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm @@ -653,9 +653,9 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/consumable/ethanol/bloody_mary/on_mob_life(mob/living/carbon/drinker, seconds_per_tick, times_fired) + . = ..() if(drinker.blood_volume < BLOOD_VOLUME_NORMAL) drinker.blood_volume = min(drinker.blood_volume + (1 * REM * seconds_per_tick), BLOOD_VOLUME_NORMAL) //Bloody Mary quickly restores blood loss. // SKYRAT EDIT - Bloodshot is now the go-to drink for bloodloss, not Bloody Mary - ORIGINAL: drinker.blood_volume = min(drinker.blood_volume + (3 * REM * delta_time), BLOOD_VOLUME_NORMAL) - ..() /datum/reagent/consumable/ethanol/brave_bull name = "Brave Bull" @@ -1751,6 +1751,7 @@ /datum/reagent/consumable/ethanol/alexander/on_mob_life(mob/living/drinker, seconds_per_tick, times_fired) if(mighty_shield && !(mighty_shield in drinker.contents)) //If you had a shield and lose it, you lose the reagent as well. Otherwise this is just a normal drink. holder.remove_reagent(type, volume) + return return ..() /datum/reagent/consumable/ethanol/alexander/on_mob_end_metabolize(mob/living/drinker) diff --git a/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm index 9a459e41e5b..e76e0e8fbb5 100644 --- a/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm @@ -251,10 +251,9 @@ default_container = /obj/item/reagent_containers/cup/glass/bottle/juice/cream /datum/reagent/consumable/cream/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) - if(affected_mob.getBruteLoss() && SPT_PROB(10, seconds_per_tick)) - affected_mob.heal_bodypart_damage(1, 0) - . = TRUE - ..() + . = ..() + if(SPT_PROB(10, seconds_per_tick) && affected_mob.heal_bodypart_damage(1, 0)) + return UPDATE_MOB_HEALTH /datum/reagent/consumable/coffee name = "Coffee" @@ -272,6 +271,7 @@ affected_mob.set_jitter_if_lower(10 SECONDS * REM * seconds_per_tick) /datum/reagent/consumable/coffee/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() affected_mob.adjust_dizzy(-10 SECONDS * REM * seconds_per_tick) affected_mob.adjust_drowsiness(-6 SECONDS * REM * seconds_per_tick) affected_mob.AdjustSleeping(-40 * REM * seconds_per_tick) @@ -279,7 +279,6 @@ affected_mob.adjust_bodytemperature(25 * REM * TEMPERATURE_DAMAGE_COEFFICIENT * seconds_per_tick, 0, affected_mob.get_body_temp_normal()) if(holder.has_reagent(/datum/reagent/consumable/frostoil)) holder.remove_reagent(/datum/reagent/consumable/frostoil, 5 * REM * seconds_per_tick) - return ..() || . /datum/reagent/consumable/tea name = "Tea" diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index 6f8dac870ce..69bb1266e4f 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -625,7 +625,6 @@ /datum/reagent/drug/blastoff/on_mob_life(mob/living/carbon/dancer, seconds_per_tick, times_fired) . = ..() - if(dancer.adjustOrganLoss(ORGAN_SLOT_LUNGS, 0.3 * REM * seconds_per_tick, required_organ_flag = affected_organ_flags)) . = UPDATE_MOB_HEALTH dancer.AdjustKnockdown(-20) @@ -818,7 +817,7 @@ //I wish i could give it some kind of bonus when smoked, but we don't have an INHALE method. /datum/reagent/drug/kronkaine/on_mob_life(mob/living/carbon/kronkaine_fiend, seconds_per_tick, times_fired) - . = ..() || TRUE + . = ..() kronkaine_fiend.add_mood_event("tweaking", /datum/mood_event/stimulant_medium) if(kronkaine_fiend.adjustOrganLoss(ORGAN_SLOT_HEART, 0.4 * REM * seconds_per_tick, required_organ_flag = affected_organ_flags)) . = UPDATE_MOB_HEALTH diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index 8d6c617b816..f897d8f4bb2 100644 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -69,7 +69,7 @@ reagent_state = SOLID nutriment_factor = 15 color = "#664330" // rgb: 102, 67, 48 - chemical_flags = REAGENT_CAN_BE_SYNTHESIZED|REAGENT_DEAD_PROCESS + chemical_flags = REAGENT_CAN_BE_SYNTHESIZED var/brute_heal = 1 var/burn_heal = 0 @@ -345,6 +345,7 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/consumable/capsaicin/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() var/heating = 0 switch(current_cycle) if(1 to 15) @@ -366,7 +367,6 @@ if(isslime(affected_mob)) heating = rand(20, 25) affected_mob.adjust_bodytemperature(heating * TEMPERATURE_DAMAGE_COEFFICIENT * REM * seconds_per_tick) - return ..() /datum/reagent/consumable/frostoil name = "Frost Oil" @@ -380,6 +380,7 @@ default_container = /obj/item/reagent_containers/cup/bottle/frostoil /datum/reagent/consumable/frostoil/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() var/cooling = 0 switch(current_cycle) if(1 to 15) @@ -405,7 +406,6 @@ if(isslime(affected_mob)) cooling = -rand(20, 25) affected_mob.adjust_bodytemperature(cooling * TEMPERATURE_DAMAGE_COEFFICIENT * REM * seconds_per_tick, 50) - return ..() /datum/reagent/consumable/frostoil/expose_turf(turf/exposed_turf, reac_volume) . = ..() @@ -464,10 +464,10 @@ return ..() /datum/reagent/consumable/condensedcapsaicin/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() if(!holder.has_reagent(/datum/reagent/consumable/milk)) if(SPT_PROB(5, seconds_per_tick)) affected_mob.visible_message(span_warning("[affected_mob] [pick("dry heaves!","coughs!","splutters!")]")) - return ..() /datum/reagent/consumable/salt name = "Table Salt" @@ -807,8 +807,8 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/consumable/corn_syrup/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() holder.add_reagent(/datum/reagent/consumable/sugar, 3 * REM * seconds_per_tick) - return ..() /datum/reagent/consumable/honey name = "Honey" @@ -830,8 +830,8 @@ mytray.adjust_pestlevel(rand(1, 2)) /datum/reagent/consumable/honey/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) - holder.add_reagent(/datum/reagent/consumable/sugar, 3 * REM * seconds_per_tick) . = ..() + holder.add_reagent(/datum/reagent/consumable/sugar, 3 * REM * seconds_per_tick) var/need_mob_update if(SPT_PROB(33, seconds_per_tick)) need_mob_update = affected_mob.adjustBruteLoss(-1, updating_health = FALSE, required_bodytype = affected_bodytype) diff --git a/code/modules/reagents/chemistry/reagents/impure_reagents.dm b/code/modules/reagents/chemistry/reagents/impure_reagents.dm index 1a06ae11cd9..9db1d223f8e 100644 --- a/code/modules/reagents/chemistry/reagents/impure_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/impure_reagents.dm @@ -112,11 +112,14 @@ cryostylane_alert.attached_effect = src //so the alert can reference us, if it needs to /datum/reagent/inverse/cryostylane/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) - if(current_cycle >= 60) - holder.remove_reagent(type, volume) // remove it all if we're past 60 cycles - return ..() + . = ..() if(!cube || affected_mob.loc != cube) metabolization_rate += 0.01 + +/datum/reagent/inverse/cryostylane/metabolize_reagent(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + if(current_cycle >= 60) + holder.remove_reagent(type, volume) // remove it all if we're past 60 cycles + return return ..() /datum/reagent/inverse/cryostylane/on_mob_delete(mob/living/carbon/affected_mob, amount) diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index b5b1f2f89f5..8351bad8cfb 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -85,6 +85,7 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/medicine/synaptizine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() affected_mob.adjust_drowsiness(-10 SECONDS * REM * seconds_per_tick) affected_mob.AdjustStun(-20 * REM * seconds_per_tick) affected_mob.AdjustKnockdown(-20 * REM * seconds_per_tick) @@ -93,7 +94,6 @@ affected_mob.AdjustParalyzed(-20 * REM * seconds_per_tick) if(holder.has_reagent(/datum/reagent/toxin/mindbreaker)) holder.remove_reagent(/datum/reagent/toxin/mindbreaker, 5 * REM * seconds_per_tick) - . = ..() affected_mob.adjust_hallucinations(-20 SECONDS * REM * seconds_per_tick) if(SPT_PROB(16, seconds_per_tick)) if(affected_mob.adjustToxLoss(1, updating_health = FALSE, required_biotype = affected_biotype)) @@ -107,12 +107,12 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/medicine/synaphydramine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() affected_mob.adjust_drowsiness(-10 SECONDS * REM * seconds_per_tick) if(holder.has_reagent(/datum/reagent/toxin/mindbreaker)) holder.remove_reagent(/datum/reagent/toxin/mindbreaker, 5 * REM * seconds_per_tick) if(holder.has_reagent(/datum/reagent/toxin/histamine)) holder.remove_reagent(/datum/reagent/toxin/histamine, 5 * REM * seconds_per_tick) - . = ..() affected_mob.adjust_hallucinations(-20 SECONDS * REM * seconds_per_tick) if(SPT_PROB(16, seconds_per_tick)) if(affected_mob.adjustToxLoss(1 * REM * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype)) @@ -655,11 +655,11 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/medicine/diphenhydramine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() if(SPT_PROB(5, seconds_per_tick)) affected_mob.adjust_drowsiness(2 SECONDS) affected_mob.adjust_jitter(-2 SECONDS * REM * seconds_per_tick) holder.remove_reagent(/datum/reagent/toxin/histamine, 3 * REM * seconds_per_tick) - return ..() /datum/reagent/medicine/morphine name = "Morphine" @@ -874,14 +874,11 @@ REMOVE_TRAIT(affected_mob, TRAIT_NOCRITDAMAGE, type) /datum/reagent/medicine/epinephrine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() if(holder.has_reagent(/datum/reagent/toxin/lexorin)) - holder.remove_reagent(/datum/reagent/toxin/lexorin, 2 * REM * seconds_per_tick) - holder.remove_reagent(/datum/reagent/medicine/epinephrine, 1 * REM * seconds_per_tick) if(SPT_PROB(10, seconds_per_tick)) holder.add_reagent(/datum/reagent/toxin/histamine, 4) - return ..() - - . = ..() + return var/need_mob_update if(affected_mob.health <= affected_mob.crit_threshold) @@ -905,6 +902,12 @@ if(need_mob_update) return UPDATE_MOB_HEALTH +/datum/reagent/medicine/epinephrine/metabolize_reagent(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + if(holder.has_reagent(/datum/reagent/toxin/lexorin)) + holder.remove_reagent(/datum/reagent/toxin/lexorin, 2 * REM * seconds_per_tick) + holder.remove_reagent(/datum/reagent/medicine/epinephrine, 1 * REM * seconds_per_tick) + return ..() + /datum/reagent/medicine/epinephrine/overdose_process(mob/living/affected_mob, seconds_per_tick, times_fired) . = ..() if(SPT_PROB(18, REM * seconds_per_tick)) @@ -1100,11 +1103,11 @@ affected_carbon.setOrganLoss(ORGAN_SLOT_BRAIN, initial_bdamage) /datum/reagent/medicine/neurine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() if(holder.has_reagent(/datum/reagent/consumable/ethanol/neurotoxin)) holder.remove_reagent(/datum/reagent/consumable/ethanol/neurotoxin, 5 * REM * seconds_per_tick * normalise_creation_purity()) if(SPT_PROB(8 * normalise_creation_purity(), seconds_per_tick)) affected_mob.cure_trauma_type(resilience = TRAUMA_RESILIENCE_BASIC) - return ..() /datum/reagent/medicine/neurine/on_mob_dead(mob/living/carbon/affected_mob, seconds_per_tick) . = ..() @@ -1212,9 +1215,9 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/medicine/insulin/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() affected_mob.AdjustSleeping(-20 * REM * seconds_per_tick) holder.remove_reagent(/datum/reagent/consumable/sugar, 3 * REM * seconds_per_tick) - return ..() //Trek Chems, used primarily by medibots. Only heals a specific damage type, but is very efficient. @@ -1506,13 +1509,14 @@ /datum/reagent/medicine/modafinil/on_mob_life(mob/living/carbon/metabolizer, seconds_per_tick, times_fired) . = ..() - if(!overdosed) // We do not want any effects on OD - overdose_threshold = overdose_threshold + ((rand(-10, 10) / 10) * REM * seconds_per_tick) // for extra fun - metabolizer.AdjustAllImmobility(-5 * REM * seconds_per_tick) - metabolizer.adjustStaminaLoss(-0.5 * REM * seconds_per_tick, updating_stamina = FALSE, required_biotype = affected_biotype) - metabolizer.set_jitter_if_lower(1 SECONDS * REM * seconds_per_tick) - metabolization_rate = 0.005 * REAGENTS_METABOLISM * rand(5, 20) // randomizes metabolism between 0.02 and 0.08 per second - return UPDATE_MOB_HEALTH + if(overdosed) // We do not want any effects on OD + return + overdose_threshold = overdose_threshold + ((rand(-10, 10) / 10) * REM * seconds_per_tick) // for extra fun + metabolizer.AdjustAllImmobility(-5 * REM * seconds_per_tick) + metabolizer.adjustStaminaLoss(-0.5 * REM * seconds_per_tick, updating_stamina = FALSE, required_biotype = affected_biotype) + metabolizer.set_jitter_if_lower(1 SECONDS * REM * seconds_per_tick) + metabolization_rate = 0.005 * REAGENTS_METABOLISM * rand(5, 20) // randomizes metabolism between 0.02 and 0.08 per second + return UPDATE_MOB_HEALTH /datum/reagent/medicine/modafinil/overdose_start(mob/living/affected_mob) . = ..() diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 1e8582112a3..c72ac608fa5 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -394,6 +394,7 @@ /datum/reagent/water/holywater/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() + . = ..() data["deciseconds_metabolized"] += (seconds_per_tick * 1 SECONDS * REM) @@ -497,6 +498,7 @@ ADD_TRAIT(affected_mob, TRAIT_COAGULATING, type) /datum/reagent/fuel/unholywater/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() . = ..() var/need_mob_update = FALSE if(IS_CULTIST(affected_mob)) @@ -745,8 +747,6 @@ to_chat(affected_mob, span_warning("You've become \a [lowertext(initial(species_type.name))]!")) return - return ..() - /datum/reagent/mutationtoxin/classic //The one from plasma on green slimes name = "Mutation Toxin" description = "A corruptive toxin." @@ -944,9 +944,8 @@ /datum/reagent/serotrotium/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() - if(ishuman(affected_mob)) - if(SPT_PROB(3.5, seconds_per_tick)) - affected_mob.emote(pick("twitch","drool","moan","gasp")) + if(SPT_PROB(3.5, seconds_per_tick)) + affected_mob.emote(pick("twitch","drool","moan","gasp")) /datum/reagent/oxygen name = "Oxygen" @@ -1021,7 +1020,7 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/mercury/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) - . = ..() + . = ..() if(!HAS_TRAIT(src, TRAIT_IMMOBILIZED) && !isspaceturf(affected_mob.loc)) step(affected_mob, pick(GLOB.cardinals)) if(SPT_PROB(3.5, seconds_per_tick)) @@ -1074,9 +1073,9 @@ /datum/reagent/chlorine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) - affected_mob.take_bodypart_damage(0.5*REM*seconds_per_tick, 0) - . = TRUE - ..() + . = ..() + if(affected_mob.take_bodypart_damage(0.5*REM*seconds_per_tick, 0)) + return UPDATE_MOB_HEALTH /datum/reagent/fluorine name = "Fluorine" @@ -1097,7 +1096,7 @@ /datum/reagent/fluorine/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() if(affected_mob.adjustToxLoss(0.5*REM*seconds_per_tick, updating_health = FALSE)) - . = TRUE + return UPDATE_MOB_HEALTH /datum/reagent/sodium name = "Sodium" @@ -1428,7 +1427,6 @@ /datum/reagent/impedrezene/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() affected_mob.adjust_jitter(-5 SECONDS * seconds_per_tick) - . = FALSE if(SPT_PROB(55, seconds_per_tick)) affected_mob.adjustOrganLoss(ORGAN_SLOT_BRAIN, 2) . = TRUE @@ -1595,6 +1593,7 @@ REMOVE_TRAIT(affected_mob, TRAIT_BLOODY_MESS, type) /datum/reagent/nitrous_oxide/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() affected_mob.adjust_drowsiness(4 SECONDS * REM * seconds_per_tick) if(!HAS_TRAIT(affected_mob, TRAIT_BLOODY_MESS) && !HAS_TRAIT(affected_mob, TRAIT_COAGULATING)) //So long as they do not have a coagulant, if they did not have the bloody mess trait, they do now @@ -1606,7 +1605,6 @@ if(SPT_PROB(10, seconds_per_tick)) affected_mob.losebreath += 2 affected_mob.adjust_confusion_up_to(2 SECONDS, 5 SECONDS) - ..() /////////////////////////Colorful Powder//////////////////////////// //For colouring in /proc/mix_color_from_reagents @@ -1851,8 +1849,8 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/stable_plasma/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() affected_mob.adjustPlasma(10 * REM * seconds_per_tick) - ..() /datum/reagent/iodine name = "Iodine" @@ -2179,9 +2177,9 @@ color = pick(random_color_list) /datum/reagent/colorful_reagent/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() if(can_colour_mobs) affected_mob.add_atom_colour(pick(random_color_list), WASHABLE_COLOUR_PRIORITY) - return ..() /// Colors anything it touches a random color. /datum/reagent/colorful_reagent/expose_atom(atom/exposed_atom, reac_volume) @@ -2583,12 +2581,12 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED|REAGENT_NO_RANDOM_RECIPE /datum/reagent/peaceborg/confuse/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() affected_mob.adjust_confusion_up_to(3 SECONDS * REM * seconds_per_tick, 5 SECONDS) affected_mob.adjust_dizzy_up_to(6 SECONDS * REM * seconds_per_tick, 12 SECONDS) if(SPT_PROB(10, seconds_per_tick)) to_chat(affected_mob, "You feel confused and disoriented.") - ..() /datum/reagent/peaceborg/tire name = "Tiring Solution" @@ -3074,7 +3072,6 @@ /datum/reagent/hauntium/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() - if(affected_mob.mob_biotypes & MOB_UNDEAD || HAS_MIND_TRAIT(affected_mob, TRAIT_MORBID)) //if morbid or undead,acts like an addiction-less drug affected_mob.remove_status_effect(/datum/status_effect/jitter) affected_mob.AdjustStun(-50 * REM * seconds_per_tick) diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm index 2db3682ef21..30757231625 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm @@ -279,13 +279,13 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/pyrosium/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() if(holder.has_reagent(/datum/reagent/oxygen)) holder.remove_reagent(/datum/reagent/oxygen, 0.5 * REM * seconds_per_tick) affected_mob.adjust_bodytemperature(15 * REM * seconds_per_tick) if(ishuman(affected_mob)) var/mob/living/carbon/human/affected_human = affected_mob affected_human.adjust_coretemperature(15 * REM * seconds_per_tick) - return ..() /datum/reagent/pyrosium/burn(datum/reagents/holder) if(holder.has_reagent(/datum/reagent/oxygen)) @@ -333,16 +333,15 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/teslium/energized_jelly/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) - . = ..() - if(isjellyperson(affected_mob)) - shock_timer = 0 //immune to shocks - affected_mob.AdjustAllImmobility(-40 *REM * seconds_per_tick) - if(affected_mob.adjustStaminaLoss(-2 * REM * seconds_per_tick, updating_stamina = FALSE)) - . = UPDATE_MOB_HEALTH - if(is_species(affected_mob, /datum/species/jelly/luminescent)) - var/mob/living/carbon/human/affected_human = affected_mob - var/datum/species/jelly/luminescent/slime_species = affected_human.dna.species - slime_species.extract_cooldown = max(slime_species.extract_cooldown - (2 SECONDS * REM * seconds_per_tick), 0) + if(!isjellyperson(affected_mob)) //everyone but jellypeople get shocked as normal. + return ..() + affected_mob.AdjustAllImmobility(-40 *REM * seconds_per_tick) + if(affected_mob.adjustStaminaLoss(-2 * REM * seconds_per_tick, updating_stamina = FALSE)) + . = UPDATE_MOB_HEALTH + if(is_species(affected_mob, /datum/species/jelly/luminescent)) + var/mob/living/carbon/human/affected_human = affected_mob + var/datum/species/jelly/luminescent/slime_species = affected_human.dna.species + slime_species.extract_cooldown = max(slime_species.extract_cooldown - (2 SECONDS * REM * seconds_per_tick), 0) /datum/reagent/firefighting_foam name = "Firefighting Foam" diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index f281bb3c852..7457acd0687 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -98,9 +98,9 @@ return ..() /datum/reagent/toxin/plasma/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() if(holder.has_reagent(/datum/reagent/medicine/epinephrine)) holder.remove_reagent(/datum/reagent/medicine/epinephrine, 2 * REM * seconds_per_tick) - . = ..() affected_mob.adjustPlasma(20 * REM * seconds_per_tick) /datum/reagent/toxin/plasma/on_mob_metabolize(mob/living/carbon/affected_mob) @@ -154,9 +154,9 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED /datum/reagent/toxin/hot_ice/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) + . = ..() if(holder.has_reagent(/datum/reagent/medicine/epinephrine)) holder.remove_reagent(/datum/reagent/medicine/epinephrine, 2 * REM * seconds_per_tick) - . = ..() affected_mob.adjustPlasma(20 * REM * seconds_per_tick) affected_mob.adjust_bodytemperature(-7 * TEMPERATURE_DAMAGE_COEFFICIENT * REM * seconds_per_tick, affected_mob.get_body_temp_normal()) if(ishuman(affected_mob)) @@ -679,7 +679,6 @@ // chance to either decay into histamine or go the normal route of toxin metabolization if(SPT_PROB(8, seconds_per_tick)) - current_cycle++ holder.add_reagent(/datum/reagent/toxin/histamine, pick(5, 10)) holder.remove_reagent(/datum/reagent/toxin/venom, 1.1) else @@ -799,26 +798,27 @@ /datum/reagent/toxin/initropidril/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() - if(SPT_PROB(13, seconds_per_tick)) - var/picked_option = rand(1,3) - var/need_mob_update - switch(picked_option) - if(1) - affected_mob.Paralyze(60) - if(2) + if(!SPT_PROB(13, seconds_per_tick)) + return + var/picked_option = rand(1,3) + var/need_mob_update + switch(picked_option) + if(1) + affected_mob.Paralyze(60) + if(2) + affected_mob.losebreath += 10 + affected_mob.adjustOxyLoss(rand(5,25), updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + need_mob_update = TRUE + if(3) + if(!affected_mob.undergoing_cardiac_arrest() && affected_mob.can_heartattack()) + affected_mob.set_heartattack(TRUE) + if(affected_mob.stat == CONSCIOUS) + 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 - affected_mob.adjustOxyLoss(rand(5,25), updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) - need_mob_update = TRUE - if(3) - if(!affected_mob.undergoing_cardiac_arrest() && affected_mob.can_heartattack()) - affected_mob.set_heartattack(TRUE) - if(affected_mob.stat == CONSCIOUS) - 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.adjustOxyLoss(rand(5,25), updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) - if(need_mob_update) - return UPDATE_MOB_HEALTH + need_mob_update = affected_mob.adjustOxyLoss(rand(5,25), updating_health = FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) + if(need_mob_update) + return UPDATE_MOB_HEALTH /datum/reagent/toxin/pancuronium name = "Pancuronium" @@ -1030,14 +1030,14 @@ /datum/reagent/toxin/rotatium/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() - if(affected_mob.hud_used) - if(current_cycle >= 20 && (current_cycle % 20) == 0) - var/atom/movable/plane_master_controller/pm_controller = affected_mob.hud_used.plane_master_controllers[PLANE_MASTERS_GAME] + if(!affected_mob.hud_used || (current_cycle < 20 || (current_cycle % 20) == 0)) + return + var/atom/movable/plane_master_controller/pm_controller = affected_mob.hud_used.plane_master_controllers[PLANE_MASTERS_GAME] - var/rotation = min(round(current_cycle/20), 89) // By this point the player is probably puking and quitting anyway - for(var/atom/movable/screen/plane_master/plane as anything in pm_controller.get_planes()) - animate(plane, transform = matrix(rotation, MATRIX_ROTATE), time = 5, easing = QUAD_EASING, loop = -1) - animate(transform = matrix(-rotation, MATRIX_ROTATE), time = 5, easing = QUAD_EASING) + var/rotation = min(round(current_cycle/20), 89) // By this point the player is probably puking and quitting anyway + for(var/atom/movable/screen/plane_master/plane as anything in pm_controller.get_planes()) + animate(plane, transform = matrix(rotation, MATRIX_ROTATE), time = 5, easing = QUAD_EASING, loop = -1) + animate(transform = matrix(-rotation, MATRIX_ROTATE), time = 5, easing = QUAD_EASING) /datum/reagent/toxin/rotatium/on_mob_end_metabolize(mob/living/affected_mob) . = ..() @@ -1164,13 +1164,14 @@ /datum/reagent/toxin/delayed/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() - if(current_cycle > delay) - if(holder) - holder.remove_reagent(type, actual_metaboliztion_rate * affected_mob.metabolism_efficiency * seconds_per_tick) - if(affected_mob.adjustToxLoss(actual_toxpwr * REM * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype)) - . = UPDATE_MOB_HEALTH - if(SPT_PROB(5, seconds_per_tick)) - affected_mob.Paralyze(20) + if(current_cycle <= delay) + return + if(holder) + holder.remove_reagent(type, actual_metaboliztion_rate * affected_mob.metabolism_efficiency * seconds_per_tick) + if(affected_mob.adjustToxLoss(actual_toxpwr * REM * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype)) + . = UPDATE_MOB_HEALTH + if(SPT_PROB(5, seconds_per_tick)) + affected_mob.Paralyze(20) /datum/reagent/toxin/mimesbane name = "Mime's Bane" @@ -1213,14 +1214,15 @@ . = ..() if(affected_mob.adjustStaminaLoss(7.5 * REM * seconds_per_tick, updating_stamina = FALSE)) . = UPDATE_MOB_HEALTH - if(SPT_PROB(10, seconds_per_tick)) - switch(rand(1, 3)) - if(1) - affected_mob.say(pick("oof.", "ouch.", "my bones.", "oof ouch.", "oof ouch my bones."), forced = /datum/reagent/toxin/bonehurtingjuice) - if(2) - affected_mob.manual_emote(pick("oofs silently.", "looks like [affected_mob.p_their()] bones hurt.", "grimaces, as though [affected_mob.p_their()] bones hurt.")) - if(3) - to_chat(affected_mob, span_warning("Your bones hurt!")) + if(!SPT_PROB(10, seconds_per_tick)) + return + switch(rand(1, 3)) + if(1) + affected_mob.say(pick("oof.", "ouch.", "my bones.", "oof ouch.", "oof ouch my bones."), forced = /datum/reagent/toxin/bonehurtingjuice) + if(2) + affected_mob.manual_emote(pick("oofs silently.", "looks like [affected_mob.p_their()] bones hurt.", "grimaces, as though [affected_mob.p_their()] bones hurt.")) + if(3) + to_chat(affected_mob, span_warning("Your bones hurt!")) /datum/reagent/toxin/bonehurtingjuice/overdose_process(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..()