Temperature Refactor and Fixes
This commit is contained in:
committed by
CitadelStationBot
parent
c6f227fc18
commit
7a16f0a3ef
@@ -1623,24 +1623,29 @@ GLOBAL_LIST_EMPTY(roundstart_races)
|
||||
|
||||
var/loc_temp = H.get_temperature(environment)
|
||||
|
||||
//Body temperature is adjusted in two steps. First, your body tries to stabilize itself a bit.
|
||||
if(H.stat != DEAD)
|
||||
H.natural_bodytemperature_stabilization()
|
||||
|
||||
//Then, it reacts to the surrounding atmosphere based on your thermal protection
|
||||
//Body temperature is adjusted in two parts: first there your body tries to naturally preserve homeostasis (shivering/sweating), then it reacts to the surrounding environment
|
||||
//Thermal protection (insulation) has mixed benefits in two situations (hot in hot places, cold in hot places)
|
||||
if(!H.on_fire) //If you're on fire, you do not heat up or cool down based on surrounding gases
|
||||
if(loc_temp < H.bodytemperature)
|
||||
//Place is colder than we are
|
||||
var/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(thermal_protection < 1)
|
||||
H.bodytemperature += min((1-thermal_protection) * ((loc_temp - H.bodytemperature) / BODYTEMP_COLD_DIVISOR), BODYTEMP_COOLING_MAX)
|
||||
else
|
||||
//Place is hotter than we are
|
||||
var/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(thermal_protection < 1)
|
||||
H.bodytemperature += min((1-thermal_protection) * ((loc_temp - H.bodytemperature) / BODYTEMP_HEAT_DIVISOR), BODYTEMP_HEATING_MAX)
|
||||
if((abs(BODYTEMP_NORMAL - H.bodytemperature) <= 5) && (abs(BODYTEMP_NORMAL - loc_temp) <= 25))
|
||||
return //Performance saver
|
||||
var/natural = 0
|
||||
if(H.stat != DEAD)
|
||||
natural = H.natural_bodytemperature_stabilization()
|
||||
var/thermal_protection = 1
|
||||
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)
|
||||
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
|
||||
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)
|
||||
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)
|
||||
|
||||
// +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt.
|
||||
// +/- 50 degrees from 310K is the 'safe' zone, where no damage is dealt.
|
||||
if(H.bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT && !(RESISTHOT in species_traits))
|
||||
//Body temperature is too hot.
|
||||
var/burn_damage
|
||||
|
||||
@@ -396,15 +396,14 @@
|
||||
/mob/living/carbon/proc/natural_bodytemperature_stabilization()
|
||||
var/body_temperature_difference = BODYTEMP_NORMAL - bodytemperature
|
||||
switch(bodytemperature)
|
||||
if(-INFINITY to BODYTEMP_COLD_DAMAGE_LIMIT) //BODYTEMP_COLD_DAMAGE_LIMIT is BODYTEMP_NORMAL(310.15) - 50, the temperature where you start to feel effects.
|
||||
bodytemperature += max((body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM)
|
||||
if(-INFINITY to BODYTEMP_COLD_DAMAGE_LIMIT) //Cold damage limit is 50 below the default, the temperature where you start to feel effects.
|
||||
return max((body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM)
|
||||
if(BODYTEMP_COLD_DAMAGE_LIMIT to BODYTEMP_NORMAL)
|
||||
bodytemperature += max(body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, min(body_temperature_difference, BODYTEMP_AUTORECOVERY_MINIMUM/4))
|
||||
if(BODYTEMP_NORMAL to BODYTEMP_HEAT_DAMAGE_LIMIT)
|
||||
bodytemperature += min(body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, max(body_temperature_difference, -BODYTEMP_AUTORECOVERY_MINIMUM/4))
|
||||
if(BODYTEMP_HEAT_DAMAGE_LIMIT to INFINITY) //BODYTEMP_HEAT_DAMAGE_LIMIT is BODYTEMP_NORMAL(310.15) + 50, the temperature where you start to feel effects.
|
||||
//We totally need a sweat system cause it totally makes sense...~
|
||||
bodytemperature += min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers
|
||||
return max(body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, min(body_temperature_difference, BODYTEMP_AUTORECOVERY_MINIMUM/4))
|
||||
if(BODYTEMP_NORMAL to BODYTEMP_HEAT_DAMAGE_LIMIT) // Heat damage limit is 50 above the default, the temperature where you start to feel effects.
|
||||
return min(body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, max(body_temperature_difference, -BODYTEMP_AUTORECOVERY_MINIMUM/4))
|
||||
if(BODYTEMP_HEAT_DAMAGE_LIMIT to INFINITY)
|
||||
return min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers
|
||||
/////////
|
||||
//LIVER//
|
||||
/////////
|
||||
@@ -460,4 +459,8 @@
|
||||
death()
|
||||
var/obj/item/organ/brain/B = getorganslot(ORGAN_SLOT_BRAIN)
|
||||
if(B)
|
||||
<<<<<<< HEAD
|
||||
B.damaged_brain = TRUE
|
||||
=======
|
||||
B.damaged_brain = TRUE
|
||||
>>>>>>> 15864dc... Temperature Refactor and Fixes (#34133)
|
||||
|
||||
@@ -66,13 +66,13 @@
|
||||
var/loc_temp = get_temperature(environment)
|
||||
|
||||
if(stat != DEAD)
|
||||
natural_bodytemperature_stabilization()
|
||||
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 += min(((loc_temp - bodytemperature) / BODYTEMP_COLD_DIVISOR), BODYTEMP_COOLING_MAX)
|
||||
else
|
||||
bodytemperature += min(((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR), BODYTEMP_HEATING_MAX)
|
||||
bodytemperature += max(((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR), BODYTEMP_HEATING_MAX)
|
||||
|
||||
if(bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT)
|
||||
switch(bodytemperature)
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
var/atom/A = src.loc
|
||||
if(isturf(A))
|
||||
var/areatemp = get_temperature(environment)
|
||||
if( abs(areatemp - bodytemperature) > 40 )
|
||||
if( abs(areatemp - bodytemperature) > 5)
|
||||
var/diff = areatemp - bodytemperature
|
||||
diff = diff / 5
|
||||
bodytemperature += diff
|
||||
|
||||
@@ -213,29 +213,31 @@
|
||||
taste_description = "mint"
|
||||
|
||||
/datum/reagent/consumable/frostoil/on_mob_life(mob/living/M)
|
||||
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)
|
||||
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)
|
||||
..()
|
||||
|
||||
/datum/reagent/consumable/frostoil/reaction_turf(turf/T, reac_volume)
|
||||
|
||||
Reference in New Issue
Block a user