[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
This commit is contained in:
CitadelStationBot
2018-02-23 17:42:57 -06:00
committed by Poojawa
parent f3b42842ad
commit 567c7fad8d
29 changed files with 114 additions and 130 deletions
@@ -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.
+1 -1
View File
@@ -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
@@ -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)
@@ -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)
@@ -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)
@@ -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
+5 -1
View File
@@ -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)