From 567c7fad8d5263c429dddb336db081f9eb58f7d2 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Fri, 23 Feb 2018 17:42:57 -0600 Subject: [PATCH] [MIRROR] Fixes negative bodytemp in some cases and shivering not doing anything unless you're already very cold (#5674) * Fixes negative bodytemp in some cases and shivering not doing anything unless you're already very cold (#35796) * - Stop subtracting from bodytemp please - Also fixes shivering * - Jesus christ why did you make me do this * - missed one * Fixes negative bodytemp in some cases and shivering not doing anything unless you're already very cold --- .../datums/diseases/advance/symptoms/fever.dm | 4 +- code/datums/diseases/advance/symptoms/heal.dm | 4 +- .../diseases/advance/symptoms/shivering.dm | 10 +-- code/datums/diseases/cold9.dm | 4 +- code/datums/diseases/fluspanish.dm | 4 +- code/datums/diseases/tuberculosis.dm | 2 +- code/datums/status_effects/gas.dm | 2 +- .../weather/weather_types/snow_storm.dm | 2 +- .../objects/items/grenades/syndieminibomb.dm | 2 +- code/game/objects/structures/traps.dm | 2 +- code/game/objects/structures/watercloset.dm | 4 +- .../antagonists/wizard/equipment/artefact.dm | 2 +- .../components/unary_devices/cryo.dm | 2 +- .../awaymissions/mission_code/snowdin.dm | 2 +- code/modules/hydroponics/grown/chili.dm | 2 +- code/modules/mob/living/carbon/alien/alien.dm | 4 +- code/modules/mob/living/carbon/alien/life.dm | 2 +- .../mob/living/carbon/human/species.dm | 12 +-- code/modules/mob/living/carbon/monkey/life.dm | 8 +- .../mob/living/simple_animal/simple_animal.dm | 4 +- .../mob/living/simple_animal/slime/life.dm | 2 +- code/modules/mob/status_procs.dm | 6 +- .../chemistry/reagents/alcohol_reagents.dm | 15 ++-- .../chemistry/reagents/drink_reagents.dm | 51 +++++-------- .../chemistry/reagents/food_reagents.dm | 76 +++++++++---------- .../chemistry/reagents/medicine_reagents.dm | 6 +- .../reagents/pyrotechnic_reagents.dm | 4 +- .../spells/spell_types/construct_spells.dm | 2 +- code/modules/surgery/organs/vocal_cords.dm | 4 +- 29 files changed, 114 insertions(+), 130 deletions(-) diff --git a/code/datums/diseases/advance/symptoms/fever.dm b/code/datums/diseases/advance/symptoms/fever.dm index 5b0b851ca0..5424e28502 100644 --- a/code/datums/diseases/advance/symptoms/fever.dm +++ b/code/datums/diseases/advance/symptoms/fever.dm @@ -54,7 +54,7 @@ Bonus /datum/symptom/fever/proc/Heat(mob/living/M, datum/disease/advance/A) var/get_heat = 6 * power if(!unsafe) - M.bodytemperature = min(M.bodytemperature + (get_heat * A.stage), BODYTEMP_HEAT_DAMAGE_LIMIT - 1) + M.adjust_bodytemperature(get_heat * A.stage, 0, BODYTEMP_HEAT_DAMAGE_LIMIT - 1) else - M.bodytemperature += (get_heat * A.stage) + M.adjust_bodytemperature(get_heat * A.stage) return 1 diff --git a/code/datums/diseases/advance/symptoms/heal.dm b/code/datums/diseases/advance/symptoms/heal.dm index 8c884f409c..02e0546201 100644 --- a/code/datums/diseases/advance/symptoms/heal.dm +++ b/code/datums/diseases/advance/symptoms/heal.dm @@ -384,11 +384,11 @@ to_chat(M, "You feel yourself absorbing plasma inside and around you...") if(M.bodytemperature > BODYTEMP_NORMAL) - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (20 * temp_rate * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(-20 * temp_rate * TEMPERATURE_DAMAGE_COEFFICIENT,BODYTEMP_NORMAL) if(prob(5)) to_chat(M, "You feel less hot.") else if(M.bodytemperature < (BODYTEMP_NORMAL + 1)) - M.bodytemperature = min(BODYTEMP_NORMAL, M.bodytemperature + (20 * temp_rate * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(20 * temp_rate * TEMPERATURE_DAMAGE_COEFFICIENT,0,BODYTEMP_NORMAL) if(prob(5)) to_chat(M, "You feel warmer.") diff --git a/code/datums/diseases/advance/symptoms/shivering.dm b/code/datums/diseases/advance/symptoms/shivering.dm index 591626e530..c67bf7798a 100644 --- a/code/datums/diseases/advance/symptoms/shivering.dm +++ b/code/datums/diseases/advance/symptoms/shivering.dm @@ -47,13 +47,13 @@ Bonus to_chat(M, "[pick("You feel cold.", "You shiver.")]") else to_chat(M, "[pick("You feel your blood run cold.", "You feel ice in your veins.", "You feel like you can't heat up.", "You shiver violently." )]") - if(M.bodytemperature < BODYTEMP_COLD_DAMAGE_LIMIT || unsafe) + if(M.bodytemperature > BODYTEMP_COLD_DAMAGE_LIMIT || unsafe) Chill(M, A) /datum/symptom/shivering/proc/Chill(mob/living/M, datum/disease/advance/A) var/get_cold = 6 * power - if(!unsafe) - M.bodytemperature = min(M.bodytemperature - (get_cold * A.stage), BODYTEMP_COLD_DAMAGE_LIMIT + 1) - else - M.bodytemperature -= (get_cold * A.stage) + var/limit = BODYTEMP_COLD_DAMAGE_LIMIT + 1 + if(unsafe) + limit = 0 + M.adjust_bodytemperature(-get_cold * A.stage, limit) return 1 \ No newline at end of file diff --git a/code/datums/diseases/cold9.dm b/code/datums/diseases/cold9.dm index 6a21dbfd54..c68ee196c1 100644 --- a/code/datums/diseases/cold9.dm +++ b/code/datums/diseases/cold9.dm @@ -14,7 +14,7 @@ ..() switch(stage) if(2) - affected_mob.bodytemperature -= 10 + affected_mob.adjust_bodytemperature(-10) if(prob(1) && prob(10)) to_chat(affected_mob, "You feel better.") cure() @@ -28,7 +28,7 @@ if(prob(5)) to_chat(affected_mob, "You feel stiff.") if(3) - affected_mob.bodytemperature -= 20 + affected_mob.adjust_bodytemperature(-20) if(prob(1)) affected_mob.emote("sneeze") if(prob(1)) diff --git a/code/datums/diseases/fluspanish.dm b/code/datums/diseases/fluspanish.dm index da75ef1db6..22787cc23a 100644 --- a/code/datums/diseases/fluspanish.dm +++ b/code/datums/diseases/fluspanish.dm @@ -15,7 +15,7 @@ ..() switch(stage) if(2) - affected_mob.bodytemperature += 10 + affected_mob.adjust_bodytemperature(10) if(prob(5)) affected_mob.emote("sneeze") if(prob(5)) @@ -25,7 +25,7 @@ affected_mob.take_bodypart_damage(0,5) if(3) - affected_mob.bodytemperature += 20 + affected_mob.adjust_bodytemperature(20) if(prob(5)) affected_mob.emote("sneeze") if(prob(5)) diff --git a/code/datums/diseases/tuberculosis.dm b/code/datums/diseases/tuberculosis.dm index d8f1a41c76..c8524fd038 100644 --- a/code/datums/diseases/tuberculosis.dm +++ b/code/datums/diseases/tuberculosis.dm @@ -55,6 +55,6 @@ affected_mob.nutrition = max(affected_mob.nutrition - 100, 0) if(prob(15)) to_chat(affected_mob, "[pick("You feel uncomfortably hot...", "You feel like unzipping your jumpsuit", "You feel like taking off some clothes...")]") - affected_mob.bodytemperature += 40 + affected_mob.adjust_bodytemperature(40) return diff --git a/code/datums/status_effects/gas.dm b/code/datums/status_effects/gas.dm index 0e18b01cf8..65cfb85179 100644 --- a/code/datums/status_effects/gas.dm +++ b/code/datums/status_effects/gas.dm @@ -28,7 +28,7 @@ if(!owner.stat) to_chat(owner, "The cube melts!") owner.cut_overlay(cube) - owner.bodytemperature += 100 + owner.adjust_bodytemperature(100) owner.update_canmove() /datum/status_effect/freon/watcher diff --git a/code/datums/weather/weather_types/snow_storm.dm b/code/datums/weather/weather_types/snow_storm.dm index a8d627bbca..db29f49098 100644 --- a/code/datums/weather/weather_types/snow_storm.dm +++ b/code/datums/weather/weather_types/snow_storm.dm @@ -24,5 +24,5 @@ /datum/weather/snow_storm/weather_act(mob/living/L) - L.bodytemperature -=(rand(5,15)) + L.adjust_bodytemperature(-rand(5,15)) diff --git a/code/game/objects/items/grenades/syndieminibomb.dm b/code/game/objects/items/grenades/syndieminibomb.dm index 723c578a68..d63216a2a0 100644 --- a/code/game/objects/items/grenades/syndieminibomb.dm +++ b/code/game/objects/items/grenades/syndieminibomb.dm @@ -47,5 +47,5 @@ addtimer(CALLBACK(F, /turf/open/floor.proc/MakeDry, TURF_WET_PERMAFROST), rand(3000, 3100)) for(var/mob/living/carbon/L in T) L.adjustStaminaLoss(stamina_damage) - L.bodytemperature -= 230 + L.adjust_bodytemperature(-230) qdel(src) diff --git a/code/game/objects/structures/traps.dm b/code/game/objects/structures/traps.dm index 7c5c9f1635..ffc2c344f9 100644 --- a/code/game/objects/structures/traps.dm +++ b/code/game/objects/structures/traps.dm @@ -105,7 +105,7 @@ /obj/structure/trap/chill/trap_effect(mob/living/L) to_chat(L, "You're frozen solid!") L.Knockdown(20) - L.bodytemperature -= 300 + L.adjust_bodytemperature(-300) L.apply_status_effect(/datum/status_effect/freon) diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 29a98c5554..ab9a6334a0 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -421,10 +421,10 @@ /obj/machinery/shower/proc/check_heat(mob/living/carbon/C) if(watertemp == "freezing") - C.bodytemperature = max(80, C.bodytemperature - 80) + C.adjust_bodytemperature(-80, 80) to_chat(C, "The water is freezing!") else if(watertemp == "boiling") - C.bodytemperature = min(500, C.bodytemperature + 35) + C.adjust_bodytemperature(35, 0, 500) C.adjustFireLoss(5) to_chat(C, "The water is searing!") diff --git a/code/modules/antagonists/wizard/equipment/artefact.dm b/code/modules/antagonists/wizard/equipment/artefact.dm index 8f82b2737b..5a88607d55 100644 --- a/code/modules/antagonists/wizard/equipment/artefact.dm +++ b/code/modules/antagonists/wizard/equipment/artefact.dm @@ -232,7 +232,7 @@ if(target && cooldown < world.time) if(I.is_hot()) to_chat(target, "You suddenly feel very hot") - target.bodytemperature += 50 + target.adjust_bodytemperature(50) GiveHint(target) else if(is_pointed(I)) to_chat(target, "You feel a stabbing pain in [parse_zone(user.zone_selected)]!") diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index e0f89a374e..d48f0d1f93 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -219,7 +219,7 @@ var/heat = ((1 - cold_protection) * 0.1 + conduction_coefficient) * temperature_delta * (air_heat_capacity * heat_capacity / (air_heat_capacity + heat_capacity)) air1.temperature = max(air1.temperature - heat / air_heat_capacity, TCMB) - mob_occupant.bodytemperature = max(mob_occupant.bodytemperature + heat / heat_capacity, TCMB) + mob_occupant.adjust_bodytemperature(heat / heat_capacity, TCMB) air1.gases[/datum/gas/oxygen][MOLES] = max(0,air1.gases[/datum/gas/oxygen][MOLES] - 0.5 / efficiency) // Magically consume gas? Why not, we run on cryo magic. air1.garbage_collect() diff --git a/code/modules/awaymissions/mission_code/snowdin.dm b/code/modules/awaymissions/mission_code/snowdin.dm index 21c19fab5e..7205f9cda4 100644 --- a/code/modules/awaymissions/mission_code/snowdin.dm +++ b/code/modules/awaymissions/mission_code/snowdin.dm @@ -218,7 +218,7 @@ L.adjustFireLoss(2) if(L) L.adjust_fire_stacks(20) //dipping into a stream of plasma would probably make you more flammable than usual - L.bodytemperature -=(rand(50,65)) //its cold, man + L.adjust_bodytemperature(-rand(50,65)) //its cold, man if(ishuman(L))//are they a carbon? var/list/plasma_parts = list()//a list of the organic parts to be turned into plasma limbs var/list/robo_parts = list()//keep a reference of robotic parts so we know if we can turn them into a plasmaman diff --git a/code/modules/hydroponics/grown/chili.dm b/code/modules/hydroponics/grown/chili.dm index 88cb95dedd..419ab3abad 100644 --- a/code/modules/hydroponics/grown/chili.dm +++ b/code/modules/hydroponics/grown/chili.dm @@ -88,7 +88,7 @@ if(held_mob.is_holding(src)) if(istype(held_mob) && held_mob.gloves) return - held_mob.bodytemperature += 15 * TEMPERATURE_DAMAGE_COEFFICIENT + held_mob.adjust_bodytemperature(15 * TEMPERATURE_DAMAGE_COEFFICIENT) if(prob(10)) to_chat(held_mob, "Your hand holding [src] burns!") else diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 18f8543a6a..0a0c46bffc 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -65,9 +65,9 @@ //Place is hotter than we are var/thermal_protection = heat_protection //This returns a 0 - 1 value, which corresponds to the percentage of heat protection. if(thermal_protection < 1) - bodytemperature += (1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR) + adjust_bodytemperature((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR)) else - bodytemperature += 1 * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR) + adjust_bodytemperature(1 * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR)) if(bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT) //Body temperature is too hot. diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index 1543d6b716..543fda9fd0 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -50,5 +50,5 @@ /mob/living/carbon/alien/handle_fire()//Aliens on fire code if(..()) return - bodytemperature += BODYTEMP_HEATING_MAX //If you're on fire, you heat up! + adjust_bodytemperature(BODYTEMP_HEATING_MAX) //If you're on fire, you heat up! return diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 1822525ab0..3978811236 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1633,15 +1633,15 @@ GLOBAL_LIST_EMPTY(roundstart_races) if(loc_temp < H.bodytemperature) //Place is colder than we are thermal_protection -= H.get_cold_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to. if(H.bodytemperature < BODYTEMP_NORMAL) //we're cold, insulation helps us retain body heat and will reduce the heat we lose to the environment - H.bodytemperature += (thermal_protection+1)*natural + max(thermal_protection * (loc_temp - H.bodytemperature) / BODYTEMP_COLD_DIVISOR, BODYTEMP_COOLING_MAX) + H.adjust_bodytemperature((thermal_protection+1)*natural + max(thermal_protection * (loc_temp - H.bodytemperature) / BODYTEMP_COLD_DIVISOR, BODYTEMP_COOLING_MAX)) else //we're sweating, insulation hinders our ability to reduce heat - and it will reduce the amount of cooling you get from the environment - H.bodytemperature += natural*(1/(thermal_protection+1)) + max((thermal_protection * (loc_temp - H.bodytemperature) + BODYTEMP_NORMAL - H.bodytemperature) / BODYTEMP_COLD_DIVISOR , BODYTEMP_COOLING_MAX) //Extra calculation for hardsuits to bleed off heat + H.adjust_bodytemperature(natural*(1/(thermal_protection+1)) + max((thermal_protection * (loc_temp - H.bodytemperature) + BODYTEMP_NORMAL - H.bodytemperature) / BODYTEMP_COLD_DIVISOR , BODYTEMP_COOLING_MAX)) //Extra calculation for hardsuits to bleed off heat else //Place is hotter than we are thermal_protection -= H.get_heat_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to. if(H.bodytemperature < BODYTEMP_NORMAL) //and we're cold, insulation enhances our ability to retain body heat but reduces the heat we get from the environment - H.bodytemperature += (thermal_protection+1)*natural + min(thermal_protection * (loc_temp - H.bodytemperature) / BODYTEMP_HEAT_DIVISOR, BODYTEMP_HEATING_MAX) + H.adjust_bodytemperature((thermal_protection+1)*natural + min(thermal_protection * (loc_temp - H.bodytemperature) / BODYTEMP_HEAT_DIVISOR, BODYTEMP_HEATING_MAX)) else //we're sweating, insulation hinders out ability to reduce heat - but will reduce the amount of heat we get from the environment - H.bodytemperature += natural*(1/(thermal_protection+1)) + min(thermal_protection * (loc_temp - H.bodytemperature) / BODYTEMP_HEAT_DIVISOR, BODYTEMP_HEATING_MAX) + H.adjust_bodytemperature(natural*(1/(thermal_protection+1)) + min(thermal_protection * (loc_temp - H.bodytemperature) / BODYTEMP_HEAT_DIVISOR, BODYTEMP_HEATING_MAX)) // +/- 50 degrees from 310K is the 'safe' zone, where no damage is dealt. if(H.bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT && !(RESISTHOT in species_traits)) @@ -1768,9 +1768,9 @@ GLOBAL_LIST_EMPTY(roundstart_races) if(thermal_protection >= FIRE_IMMUNITY_SUIT_MAX_TEMP_PROTECT && !no_protection) return if(thermal_protection >= FIRE_SUIT_MAX_TEMP_PROTECT && !no_protection) - H.bodytemperature += 11 + H.adjust_bodytemperature(11) else - H.bodytemperature += (BODYTEMP_HEATING_MAX + (H.fire_stacks * 12)) + H.adjust_bodytemperature(BODYTEMP_HEATING_MAX + (H.fire_stacks * 12)) /datum/species/proc/CanIgniteMob(mob/living/carbon/human/H) if(NOFIRE in species_traits) diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index 58edac0eaf..a8f2e282ed 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -65,13 +65,13 @@ var/loc_temp = get_temperature(environment) if(stat != DEAD) - bodytemperature += natural_bodytemperature_stabilization() + adjust_bodytemperature(natural_bodytemperature_stabilization()) if(!on_fire) //If you're on fire, you do not heat up or cool down based on surrounding gases if(loc_temp < bodytemperature) - bodytemperature += max((loc_temp - bodytemperature) / BODYTEMP_COLD_DIVISOR, BODYTEMP_COOLING_MAX) + adjust_bodytemperature(max((loc_temp - bodytemperature) / BODYTEMP_COLD_DIVISOR, BODYTEMP_COOLING_MAX)) else - bodytemperature += min((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR, BODYTEMP_HEATING_MAX) + adjust_bodytemperature(min((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR, BODYTEMP_HEATING_MAX)) if(bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT) @@ -161,5 +161,5 @@ if(!(I.resistance_flags & FIRE_PROOF)) I.take_damage(fire_stacks, BURN, "fire", 0) - bodytemperature += BODYTEMP_HEATING_MAX + adjust_bodytemperature(BODYTEMP_HEATING_MAX) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 9f6b80677d..09eb099ae7 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -89,7 +89,7 @@ //domestication var/tame = 0 - var/my_z // I don't want to confuse this with client registered_z + var/my_z // I don't want to confuse this with client registered_z /mob/living/simple_animal/Initialize() . = ..() @@ -234,7 +234,7 @@ if( abs(areatemp - bodytemperature) > 5) var/diff = areatemp - bodytemperature diff = diff / 5 - bodytemperature += diff + adjust_bodytemperature(diff) if(!environment_is_safe(environment)) adjustHealth(unsuitable_atmos_damage) diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index d46715ccdc..574a8a1e7c 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -112,7 +112,7 @@ var/loc_temp = get_temperature(environment) - bodytemperature += adjust_body_temperature(bodytemperature, loc_temp, 1) + adjust_bodytemperature(adjust_body_temperature(bodytemperature, loc_temp, 1)) //Account for massive pressure differences diff --git a/code/modules/mob/status_procs.dm b/code/modules/mob/status_procs.dm index 87eddde125..cdb79c43c6 100644 --- a/code/modules/mob/status_procs.dm +++ b/code/modules/mob/status_procs.dm @@ -238,7 +238,11 @@ /mob/proc/set_disgust(amount) return - +/////////////////////////////////// TEMPERATURE //////////////////////////////////// + +/mob/proc/adjust_bodytemperature(amount,min_temp=0,max_temp=INFINITY) + if(bodytemperature > min_temp && bodytemperature < max_temp) + bodytemperature = CLAMP(bodytemperature + amount,min_temp,max_temp) diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index a2596ea6cc..2767512f0d 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -149,8 +149,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/thirteenloko/on_mob_life(mob/living/M) M.drowsyness = max(0,M.drowsyness-7) M.AdjustSleeping(-40) - if (M.bodytemperature > BODYTEMP_NORMAL) - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) M.Jitter(5) return ..() @@ -541,8 +540,7 @@ All effects don't start immediately, but rather get worse over time; the rate is shot_glass_icon_state = "toxinsspecialglass" /datum/reagent/consumable/ethanol/toxins_special/on_mob_life(var/mob/living/M as mob) - if (M.bodytemperature < (BODYTEMP_NORMAL + 20)) - M.bodytemperature = min((BODYTEMP_NORMAL + 20), M.bodytemperature + (15 * TEMPERATURE_DAMAGE_COEFFICIENT)) //310.15 is the normal bodytemp. + M.adjust_bodytemperature(15 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, BODYTEMP_NORMAL + 20) //310.15 is the normal bodytemp. return ..() /datum/reagent/consumable/ethanol/beepsky_smash @@ -721,8 +719,7 @@ All effects don't start immediately, but rather get worse over time; the rate is glass_desc = "The ultimate refreshment." /datum/reagent/consumable/ethanol/antifreeze/on_mob_life(mob/living/M) - if (M.bodytemperature < (BODYTEMP_NORMAL + 20)) - M.bodytemperature = min((BODYTEMP_NORMAL + 20), M.bodytemperature + (20 * TEMPERATURE_DAMAGE_COEFFICIENT)) //310.15 is the normal bodytemp. + M.adjust_bodytemperature(20 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, BODYTEMP_NORMAL + 20) //310.15 is the normal bodytemp. return ..() /datum/reagent/consumable/ethanol/barefoot @@ -835,8 +832,7 @@ All effects don't start immediately, but rather get worse over time; the rate is glass_desc = "A spicy mix of Vodka and Spice. Very hot." /datum/reagent/consumable/ethanol/sbiten/on_mob_life(mob/living/M) - if (M.bodytemperature < BODYTEMP_HEAT_DAMAGE_LIMIT) - M.bodytemperature = min(BODYTEMP_HEAT_DAMAGE_LIMIT, M.bodytemperature + (50 * TEMPERATURE_DAMAGE_COEFFICIENT)) //310.15 is the normal bodytemp. + M.adjust_bodytemperature(50 * TEMPERATURE_DAMAGE_COEFFICIENT, 0 ,BODYTEMP_HEAT_DAMAGE_LIMIT) //310.15 is the normal bodytemp. return ..() /datum/reagent/consumable/ethanol/red_mead @@ -874,8 +870,7 @@ All effects don't start immediately, but rather get worse over time; the rate is glass_desc = "A beer so frosty, the air around it freezes." /datum/reagent/consumable/ethanol/iced_beer/on_mob_life(mob/living/M) - if(M.bodytemperature > T0C) - M.bodytemperature = max(T0C, M.bodytemperature - (20 * TEMPERATURE_DAMAGE_COEFFICIENT)) //310.15 is the normal bodytemp. + M.adjust_bodytemperature(-20 * TEMPERATURE_DAMAGE_COEFFICIENT, T0C) //310.15 is the normal bodytemp. return ..() /datum/reagent/consumable/ethanol/grog diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index c56d10c3c9..673b6e7059 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -280,8 +280,8 @@ M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) M.AdjustSleeping(-40, FALSE) - if (M.bodytemperature < BODYTEMP_NORMAL)//310.15 is the normal bodytemp. - M.bodytemperature = min(BODYTEMP_NORMAL, M.bodytemperature + (25 * TEMPERATURE_DAMAGE_COEFFICIENT)) + //310.15 is the normal bodytemp. + M.adjust_bodytemperature(25 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, BODYTEMP_NORMAL) if(holder.has_reagent("frostoil")) holder.remove_reagent("frostoil", 5) ..() @@ -305,8 +305,7 @@ M.AdjustSleeping(-20, FALSE) if(M.getToxLoss() && prob(20)) M.adjustToxLoss(-1, 0) - if (M.bodytemperature < BODYTEMP_NORMAL) //310.15 is the normal bodytemp. - M.bodytemperature = min(BODYTEMP_NORMAL, M.bodytemperature + (20 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(20 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, BODYTEMP_NORMAL) ..() . = 1 @@ -342,8 +341,7 @@ M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) M.AdjustSleeping(-40, FALSE) - if (M.bodytemperature > BODYTEMP_NORMAL)//310.15 is the normal bodytemp. - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) M.Jitter(5) ..() . = 1 @@ -365,8 +363,7 @@ M.AdjustSleeping(-40, FALSE) if(M.getToxLoss() && prob(20)) M.adjustToxLoss(-1, 0) - if (M.bodytemperature > BODYTEMP_NORMAL)//310.15 is the normal bodytemp. - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) ..() . = 1 @@ -382,8 +379,7 @@ /datum/reagent/consumable/space_cola/on_mob_life(mob/living/M) M.drowsyness = max(0,M.drowsyness-5) - if (M.bodytemperature > BODYTEMP_NORMAL)//310.15 is the normal bodytemp. - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) ..() /datum/reagent/consumable/nuka_cola @@ -414,8 +410,7 @@ M.dizziness +=5 M.drowsyness = 0 M.AdjustSleeping(-40, FALSE) - if (M.bodytemperature > BODYTEMP_NORMAL)//310.15 is the normal bodytemp. - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) ..() . = 1 @@ -432,8 +427,7 @@ /datum/reagent/consumable/spacemountainwind/on_mob_life(mob/living/M) M.drowsyness = max(0,M.drowsyness-7) M.AdjustSleeping(-20, FALSE) - if (M.bodytemperature > BODYTEMP_NORMAL) - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) M.Jitter(5) ..() . = 1 @@ -450,8 +444,7 @@ /datum/reagent/consumable/dr_gibb/on_mob_life(mob/living/M) M.drowsyness = max(0,M.drowsyness-6) - if (M.bodytemperature > BODYTEMP_NORMAL) - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) //310.15 is the normal bodytemp. + M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) ..() /datum/reagent/consumable/space_up @@ -466,8 +459,7 @@ /datum/reagent/consumable/space_up/on_mob_life(mob/living/M) - if (M.bodytemperature > BODYTEMP_NORMAL) - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (8 * TEMPERATURE_DAMAGE_COEFFICIENT)) //310.15 is the normal bodytemp. + M.adjust_bodytemperature(-8 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) ..() /datum/reagent/consumable/lemon_lime @@ -482,8 +474,7 @@ /datum/reagent/consumable/lemon_lime/on_mob_life(mob/living/M) - if (M.bodytemperature > BODYTEMP_NORMAL) - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (8 * TEMPERATURE_DAMAGE_COEFFICIENT)) //310.15 is the normal bodytemp. + M.adjust_bodytemperature(-8 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) ..() /datum/reagent/consumable/pwr_game @@ -497,8 +488,7 @@ glass_desc = "Goes well with a Vlad's salad." /datum/reagent/consumable/pwr_game/on_mob_life(mob/living/M) - if (M.bodytemperature > BODYTEMP_NORMAL) - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (8 * TEMPERATURE_DAMAGE_COEFFICIENT)) //310.15 is the normal bodytemp. + M.adjust_bodytemperature(-8 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) ..() /datum/reagent/consumable/shamblers @@ -512,8 +502,7 @@ glass_desc = "Mmm mm, shambly." /datum/reagent/consumable/shamblers/on_mob_life(mob/living/M) - if (M.bodytemperature > BODYTEMP_NORMAL) - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (8 * TEMPERATURE_DAMAGE_COEFFICIENT)) //310.15 is the normal bodytemp. + M.adjust_bodytemperature(-8 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) ..() /datum/reagent/consumable/sodawater name = "Soda Water" @@ -528,8 +517,7 @@ /datum/reagent/consumable/sodawater/on_mob_life(mob/living/M) M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) - if (M.bodytemperature > BODYTEMP_NORMAL) - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) ..() /datum/reagent/consumable/tonic @@ -546,8 +534,7 @@ M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) M.AdjustSleeping(-40, FALSE) - if (M.bodytemperature > BODYTEMP_NORMAL) - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) ..() . = 1 @@ -563,7 +550,7 @@ glass_desc = "Generally, you're supposed to put something else in there too..." /datum/reagent/consumable/ice/on_mob_life(mob/living/M) - M.bodytemperature = max( M.bodytemperature - 5 * TEMPERATURE_DAMAGE_COEFFICIENT, 0) + M.adjust_bodytemperature(-5 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) ..() /datum/reagent/consumable/soy_latte @@ -580,8 +567,7 @@ M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) M.SetSleeping(0, FALSE) - if (M.bodytemperature < BODYTEMP_NORMAL)//310.15 is the normal bodytemp. - M.bodytemperature = min(BODYTEMP_NORMAL, M.bodytemperature + (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(5 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, BODYTEMP_NORMAL) M.Jitter(5) if(M.getBruteLoss() && prob(20)) M.heal_bodypart_damage(1,0, 0) @@ -602,8 +588,7 @@ M.dizziness = max(0,M.dizziness-5) M.drowsyness = max(0,M.drowsyness-3) M.SetSleeping(0, FALSE) - if (M.bodytemperature < BODYTEMP_NORMAL)//310.15 is the normal bodytemp. - M.bodytemperature = min(BODYTEMP_NORMAL, M.bodytemperature + (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(5 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, BODYTEMP_NORMAL) M.Jitter(5) if(M.getBruteLoss() && prob(20)) M.heal_bodypart_damage(1,0, 0) diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index 3eddb66713..3dcf29f15e 100644 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -184,25 +184,27 @@ taste_mult = 1.5 /datum/reagent/consumable/capsaicin/on_mob_life(mob/living/M) + var/heating = 0 switch(current_cycle) if(1 to 15) - M.bodytemperature += 5 * TEMPERATURE_DAMAGE_COEFFICIENT + heating = 5 * TEMPERATURE_DAMAGE_COEFFICIENT if(holder.has_reagent("cryostylane")) holder.remove_reagent("cryostylane", 5) if(isslime(M)) - M.bodytemperature += rand(5,20) + heating = rand(5,20) if(15 to 25) - M.bodytemperature += 10 * TEMPERATURE_DAMAGE_COEFFICIENT + heating = 10 * TEMPERATURE_DAMAGE_COEFFICIENT if(isslime(M)) - M.bodytemperature += rand(10,20) + heating = rand(10,20) if(25 to 35) - M.bodytemperature += 15 * TEMPERATURE_DAMAGE_COEFFICIENT + heating = 15 * TEMPERATURE_DAMAGE_COEFFICIENT if(isslime(M)) - M.bodytemperature += rand(15,20) + heating = rand(15,20) if(35 to INFINITY) - M.bodytemperature += 20 * TEMPERATURE_DAMAGE_COEFFICIENT + heating = 20 * TEMPERATURE_DAMAGE_COEFFICIENT if(isslime(M)) - M.bodytemperature += rand(20,25) + heating = rand(20,25) + M.adjust_bodytemperature(heating) ..() /datum/reagent/consumable/frostoil @@ -213,31 +215,31 @@ taste_description = "mint" /datum/reagent/consumable/frostoil/on_mob_life(mob/living/M) - if(M.bodytemperature > 50) - switch(current_cycle) - if(1 to 15) - M.bodytemperature -= 10 * TEMPERATURE_DAMAGE_COEFFICIENT - if(holder.has_reagent("capsaicin")) - holder.remove_reagent("capsaicin", 5) - if(isslime(M)) - M.bodytemperature -= rand(5,20) - if(15 to 25) - M.bodytemperature -= 20 * TEMPERATURE_DAMAGE_COEFFICIENT - if(isslime(M)) - M.bodytemperature -= rand(10,20) - if(25 to 35) - M.bodytemperature -= 30 * TEMPERATURE_DAMAGE_COEFFICIENT - if(prob(1)) - M.emote("shiver") - if(isslime(M)) - M.bodytemperature -= rand(15,20) - if(35 to INFINITY) - M.bodytemperature -= 40 * TEMPERATURE_DAMAGE_COEFFICIENT - if(prob(5)) - M.emote("shiver") - if(isslime(M)) - M.bodytemperature -= rand(20,25) - M.bodytemperature = max(50, M.bodytemperature) + var/cooling = 0 + switch(current_cycle) + if(1 to 15) + cooling = -10 * TEMPERATURE_DAMAGE_COEFFICIENT + if(holder.has_reagent("capsaicin")) + holder.remove_reagent("capsaicin", 5) + if(isslime(M)) + cooling = -rand(5,20) + if(15 to 25) + cooling = -20 * TEMPERATURE_DAMAGE_COEFFICIENT + if(isslime(M)) + cooling = -rand(10,20) + if(25 to 35) + cooling = -30 * TEMPERATURE_DAMAGE_COEFFICIENT + if(prob(1)) + M.emote("shiver") + if(isslime(M)) + cooling = -rand(15,20) + if(35 to INFINITY) + cooling = -40 * TEMPERATURE_DAMAGE_COEFFICIENT + if(prob(5)) + M.emote("shiver") + if(isslime(M)) + cooling = -rand(20,25) + M.adjust_bodytemperature(cooling, 50) ..() /datum/reagent/consumable/frostoil/reaction_turf(turf/T, reac_volume) @@ -373,8 +375,7 @@ glass_desc = "Tasty." /datum/reagent/consumable/hot_coco/on_mob_life(mob/living/M) - if (M.bodytemperature < BODYTEMP_NORMAL)//310.15 is the normal bodytemp. - M.bodytemperature = min(BODYTEMP_NORMAL, M.bodytemperature + (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(5 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, BODYTEMP_NORMAL) ..() /datum/reagent/mushroomhallucinogen @@ -465,8 +466,7 @@ taste_description = "wet and cheap noodles" /datum/reagent/consumable/hot_ramen/on_mob_life(mob/living/M) - if (M.bodytemperature < BODYTEMP_NORMAL)//310.15 is the normal bodytemp. - M.bodytemperature = min(BODYTEMP_NORMAL, M.bodytemperature + (10 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(10 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, BODYTEMP_NORMAL) ..() /datum/reagent/consumable/hell_ramen @@ -478,7 +478,7 @@ taste_description = "wet and cheap noodles on fire" /datum/reagent/consumable/hell_ramen/on_mob_life(mob/living/M) - M.bodytemperature += 10 * TEMPERATURE_DAMAGE_COEFFICIENT + M.adjust_bodytemperature(10 * TEMPERATURE_DAMAGE_COEFFICIENT) ..() /datum/reagent/consumable/flour diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index dabbec25a8..7752d70486 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -22,9 +22,9 @@ /datum/reagent/medicine/leporazine/on_mob_life(mob/living/M) if(M.bodytemperature > BODYTEMP_NORMAL) - M.bodytemperature = max(BODYTEMP_NORMAL, M.bodytemperature - (40 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(-40 * TEMPERATURE_DAMAGE_COEFFICIENT, BODYTEMP_NORMAL) else if(M.bodytemperature < (BODYTEMP_NORMAL + 1)) - M.bodytemperature = min(BODYTEMP_NORMAL, M.bodytemperature + (40 * TEMPERATURE_DAMAGE_COEFFICIENT)) + M.adjust_bodytemperature(40 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, BODYTEMP_NORMAL) ..() /datum/reagent/medicine/adminordrazine //An OP chemical for admins @@ -1272,4 +1272,4 @@ M.adjustStaminaLoss(1.5*REM, 0) ..() . = 1 - + diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm index a361499bae..6438a82276 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm @@ -187,7 +187,7 @@ /datum/reagent/cryostylane/on_mob_life(mob/living/M) //TODO: code freezing into an ice cube if(M.reagents.has_reagent("oxygen")) M.reagents.remove_reagent("oxygen", 0.5) - M.bodytemperature = max(M.bodytemperature - 15,0) + M.adjust_bodytemperature(-15) ..() /datum/reagent/cryostylane/reaction_turf(turf/T, reac_volume) @@ -206,7 +206,7 @@ /datum/reagent/pyrosium/on_mob_life(mob/living/M) if(M.reagents.has_reagent("oxygen")) M.reagents.remove_reagent("oxygen", 0.5) - M.bodytemperature += 15 + M.adjust_bodytemperature(15) ..() /datum/reagent/teslium //Teslium. Causes periodic shocks, and makes shocks against the target much more effective. diff --git a/code/modules/spells/spell_types/construct_spells.dm b/code/modules/spells/spell_types/construct_spells.dm index 7e22a1d36b..087a2a2793 100644 --- a/code/modules/spells/spell_types/construct_spells.dm +++ b/code/modules/spells/spell_types/construct_spells.dm @@ -207,7 +207,7 @@ user.playsound_local(get_turf(user), 'sound/effects/ghost2.ogg', 50, 1) target.become_blind(ABYSSAL_GAZE_BLIND) addtimer(CALLBACK(src, .proc/cure_blindness, target), 40) - target.bodytemperature -= 200 + target.adjust_bodytemperature(-200) /obj/effect/proc_holder/spell/targeted/abyssal_gaze/proc/cure_blindness(mob/target) if(isliving(target)) diff --git a/code/modules/surgery/organs/vocal_cords.dm b/code/modules/surgery/organs/vocal_cords.dm index cc0324ab6a..496647acfa 100644 --- a/code/modules/surgery/organs/vocal_cords.dm +++ b/code/modules/surgery/organs/vocal_cords.dm @@ -333,14 +333,14 @@ cooldown = COOLDOWN_DAMAGE for(var/V in listeners) var/mob/living/L = V - L.bodytemperature += (50 * power_multiplier) + L.adjust_bodytemperature(50 * power_multiplier) //COLD else if((findtext(message, cold_words))) cooldown = COOLDOWN_DAMAGE for(var/V in listeners) var/mob/living/L = V - L.bodytemperature -= (50 * power_multiplier) + L.adjust_bodytemperature(-50 * power_multiplier) //REPULSE else if((findtext(message, repulse_words)))