Skip to content

Commit

Permalink
better checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kalazus committed Apr 1, 2022
1 parent 0c125b6 commit d51faf9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions code/modules/mob/living/carbon/carbon.dm
Expand Up @@ -30,10 +30,17 @@
var/adjusted_pressure = calculate_affecting_pressure(pressure) //Returns how much pressure actually affects the mob.

if(!on_fire)
if(affecting_temp > BODYTEMP_SIGNIFICANT_CHANGE)
bodytemperature += affecting_temp / BODYTEMP_HEAT_DIVISOR
else if (affecting_temp < -BODYTEMP_SIGNIFICANT_CHANGE)
bodytemperature += affecting_temp / BODYTEMP_COLD_DIVISOR
if(abs(affecting_temp) >= BODYTEMP_SIGNIFICANT_CHANGE)
var/temp_adj
if(affecting_temp < 0)
temp_adj = affecting_temp / BODYTEMP_COLD_DIVISOR
temp_adj = max(temp_adj, BODYTEMP_COOLING_MAX)
else
temp_adj = affecting_temp / BODYTEMP_HEAT_DIVISOR
temp_adj = min(temp_adj, BODYTEMP_HEATING_MAX)

bodytemperature += temp_adj

if(stat != DEAD)
bodytemperature += (BODYTEMP_NORMAL - bodytemperature) / BODYTEMP_AUTORECOVERY_DIVISOR

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/human/life.dm
Expand Up @@ -583,13 +583,13 @@
var/thermal_protection = 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)
temp_adj = (1 - thermal_protection) * (affecting_temp / BODYTEMP_COLD_DIVISOR) //this will be negative
temp_adj = max(temp_adj, BODYTEMP_COOLING_MAX)
else //Place is hotter than we are
var/thermal_protection = 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)
temp_adj = (1 - thermal_protection) * (affecting_temp / BODYTEMP_HEAT_DIVISOR)
temp_adj = min(temp_adj, BODYTEMP_HEATING_MAX)

temp_adj = clamp(temp_adj, BODYTEMP_COOLING_MAX, BODYTEMP_HEATING_MAX)
//world << "Environment: [loc_temp], [src]: [bodytemperature], Adjusting: [temp_adj]"
bodytemperature += temp_adj

else if(!species.flags[IS_SYNTHETIC] && !species.flags[RAD_IMMUNE])
Expand Down

0 comments on commit d51faf9

Please sign in to comment.