Skip to content

Commit

Permalink
some more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasint committed Sep 21, 2024
1 parent 538a659 commit 34d1c30
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
3 changes: 2 additions & 1 deletion code/__DEFINES/atmospherics/atmos_mob_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
#define BODYTEMP_COLD_DAMAGE_LIMIT CELCIUS_TO_KELVIN(-0.5 CELCIUS)

/// The maximum temperature of Lavaland
#define LAVALAND_MAX_TEMPERATURE 350
#define LAVALAND_MAX_TEMPERATURE CELCIUS_TO_KELVIN(76.85 CELCIUS)// 350 KELVIN
#define ICEBOX_MIN_TEMPERATURE CELCIUS_TO_KELVIN(-93.15 CELCIUS)

/// A temperature limit which is above the maximum lavaland temperature
#define BODYTEMP_HEAT_LAVALAND_SAFE (LAVALAND_MAX_TEMPERATURE + 5 KELVIN)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/atmosphere/planetary.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
minimum_pressure = HAZARD_LOW_PRESSURE + 10
maximum_pressure = LAVALAND_EQUIPMENT_EFFECT_PRESSURE - 1

minimum_temp = 180
maximum_temp = 180
minimum_temp = ICEBOX_MIN_TEMPERATURE
maximum_temp = ICEBOX_MIN_TEMPERATURE

/datum/atmosphere/oshan
id = OSHAN_DEFAULT_ATMOS
Expand Down
17 changes: 11 additions & 6 deletions code/modules/mob/living/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,26 @@
var/temp_delta = loc_temp - bodytemperature
if(temp_delta == 0)
return
if(temp_delta < 0 && on_fire) // do not reduce body temp when on fire
if(temp_delta < 0 && on_fire)
return

// Get the insulation value based on the area's temp
var/thermal_protection = get_insulation(loc_temp)
var/protection_modifier = 1
if(bodytemperature > standard_body_temperature + 2 KELVIN)
// we are overheating and sweaty - insulation is not as good reducing thermal protection
protection_modifier = 0.7

var/temp_sign = SIGN(temp_delta)
var/temp_change = temp_sign * (1 - (thermal_protection * protection_modifier)) * ((0.1 * max(1, abs(temp_delta))) ** 1.8) * temperature_normalization_speed
// Calculate the equilibrium temperature considering insulation
var/equilibrium_temp = get_insulated_equilibrium_temperature(loc_temp, thermal_protection * protection_modifier)

var/temp_change = (equilibrium_temp - bodytemperature) * temperature_normalization_speed * seconds_per_tick

// Cap increase and decrease
temp_change = temp_change < 0 ? max(temp_change, BODYTEMP_HOMEOSTASIS_COOLING_MAX) : min(temp_change, BODYTEMP_HOMEOSTASIS_HEATING_MAX)
adjust_bodytemperature(temp_change * seconds_per_tick) // no use_insulation beacuse we account for it manually

adjust_bodytemperature(temp_change * seconds_per_tick) // No use_insulation because we manually account for it

/mob/living/proc/get_insulated_equilibrium_temperature(environment_temp, insulation)
return environment_temp + (standard_body_temperature - environment_temp) * insulation

/mob/living/silicon/handle_environment(datum/gas_mixture/environment, seconds_per_tick, times_fired)
return // Not yet
Expand Down
10 changes: 5 additions & 5 deletions monkestation/code/modules/temperature_overhaul/living_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@
// Body temperature is too cold, and we do not have resist traits
if(feels_like < cold_threshold_low && !HAS_TRAIT(src, TRAIT_RESISTCOLD))
clear_mood_event("hot")
// Only apply slowdown if the body is cold rather than the skin
if(bodytemperature < cold_threshold_medium)
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/cold, multiplicative_slowdown = ((BODYTEMP_COLD_WARNING_2 - bodytemperature) / COLD_SLOWDOWN_FACTOR))
if(feels_like < cold_threshold_high)
throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/cold, 3)
add_mood_event("cold", /datum/mood_event/freezing)
Expand All @@ -104,12 +101,15 @@
throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/cold, 1)
add_mood_event("cold", /datum/mood_event/chilly)
temp_alerts = TRUE
// Only apply slowdown if the body is cold rather than the skin
if(bodytemperature < cold_threshold_medium && !HAS_TRAIT(src, TRAIT_RESISTCOLD))
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/cold, multiplicative_slowdown = ((cold_threshold_medium - bodytemperature) / COLD_SLOWDOWN_FACTOR))
else if(LAZYACCESS(movespeed_modification, /datum/movespeed_modifier/cold))
remove_movespeed_modifier(/datum/movespeed_modifier/cold)

// We are not to hot or cold, remove status and moods
if(temp_alerts && (feels_like < hot_threshold_low || HAS_TRAIT(src, TRAIT_RESISTHEAT)) && (feels_like > cold_threshold_low || HAS_TRAIT(src, TRAIT_RESISTCOLD)))
clear_alert(ALERT_TEMPERATURE)
if(bodytemperature > cold_threshold_medium)
remove_movespeed_modifier(/datum/movespeed_modifier/cold)
clear_mood_event("cold")
clear_mood_event("hot")
temp_alerts = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
amount *= (1 - get_insulation(bodytemperature + amount))
if(amount == 0)
return FALSE
amount = round(amount, 0.01)

if(amount == 0)
return 0
amount = round(amount, 0.01)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
retrieved_var = vars[mainvar]
if(retrieved_var)
return retrieved_var
stack_trace("return_color called with a bad varname.")
return default_color

return retrieved_var
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/datum/color_palette/ornithids/apply_prefs(datum/preferences/incoming)
feather_main = incoming.read_preference(/datum/preference/color/feather_color)
feather_secondary = incoming.read_preference(/datum/preference/color/feather_color_secondary)
feather_tri = incoming.read_preference(/datum/preferences/color/feather_color_tri)
feather_tri = incoming.read_preference(/datum/preference/color/feather_color_tri)
plummage = incoming.read_preference(/datum/preference/color/plummage_color)
tail = incoming.read_preference(/datum/preference/color/feather_tail_color)

0 comments on commit 34d1c30

Please sign in to comment.