Skip to content

Commit

Permalink
Todos
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMelbert committed Sep 3, 2024
1 parent d57249f commit e83c0bb
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 17 deletions.
24 changes: 20 additions & 4 deletions code/datums/mood_events/generic_negative_events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,29 @@
mood_change = -1
timeout = 2 MINUTES

/datum/mood_event/chilly
description = "I'm feeling a bit chilly."
mood_change = -2

/datum/mood_event/cold
description = "It's way too cold in here."
mood_change = -5
description = "It's way too cold."
mood_change = -3

/datum/mood_event/freezing
description = "It's freezing cold!"
mood_change = -6

/datum/mood_event/warm
description = "I'm feeling a bit warm."
mood_change = -2

/datum/mood_event/hot
description = "It's getting hot in here."
mood_change = -5
description = "It's way too hot."
mood_change = -3

/datum/mood_event/overhot
description = "It's scorching hot!"
mood_change = -6

/datum/mood_event/creampie
description = "I've been creamed. Tastes like pie flavor."
Expand Down
15 changes: 12 additions & 3 deletions code/modules/mob/living/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,17 @@
// Body temperature is too hot, and we do not have resist traits
if(feels_like > hot_threshold_low && !HAS_TRAIT(src, TRAIT_RESISTHEAT))
clear_mood_event("cold")
add_mood_event("hot", /datum/mood_event/hot)
// Clear cold once we return to warm
remove_movespeed_modifier(/datum/movespeed_modifier/cold)
if(feels_like > hot_threshold_high)
throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/hot, 3)
add_mood_event("hot", /datum/mood_event/overhot)
else if(feels_like > hot_threshold_medium)
throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/hot, 2)
add_mood_event("hot", /datum/mood_event/hot)
else
throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/hot, 1)
add_mood_event("hot", /datum/mood_event/warm)
temp_alerts = TRUE

var/cold_diff = bodytemp_cold_damage_limit - standard_body_temperature
Expand All @@ -166,16 +168,18 @@
// 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")
add_mood_event("cold", /datum/mood_event/cold)
// Only apply slowdown if the body is cold rather than the skin
if(body_temperature < cold_threshold_medium)
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/cold, multiplicative_slowdown = ((BODYTEMP_COLD_WARNING_2 - body_temperature) / 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)
else if(feels_like < cold_threshold_medium)
throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/cold, 2)
add_mood_event("cold", /datum/mood_event/cold)
else
throw_alert(ALERT_TEMPERATURE, /atom/movable/screen/alert/cold, 1)
add_mood_event("cold", /datum/mood_event/chilly)
temp_alerts = TRUE

// We are not to hot or cold, remove status and moods
Expand Down Expand Up @@ -225,13 +229,15 @@
// we are overheating and sweaty - insulation is not as good reducing thermal protection
protection_modifier = 0.7

// melbert todo : temp / this needs to scale exponentially or logarithmically - slow for small changes, fast for large changes
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
// Cap increase and decrease
temp_change = temp_change < 0 ? max(temp_change, BODYTEMP_COOLING_MAX) : min(temp_change, BODYTEMP_HEATING_MAX)
adjust_body_temperature(temp_change * seconds_per_tick) // no use_insulation beacuse we account for it manually

/mob/living/silicon/handle_environment(datum/gas_mixture/environment, seconds_per_tick, times_fired)
return // Not yet

/**
* Handles this mob internally managing its body temperature (sweating or generating heat)
*
Expand Down Expand Up @@ -278,6 +284,9 @@
if(!(sigreturn & HOMEOSTASIS_NO_HUNGER))
adjust_nutrition(-1 * HOMEOSTASIS_HUNGER_MULTIPLIER * HUNGER_FACTOR * nutrition_per_kelvin * abs(natural_change) * seconds_per_tick)

/mob/living/silicon/temperature_homeostasis(seconds_per_tick, times_fired)
return // Not yet

/**
* Get the fullness of the mob
*
Expand Down
6 changes: 4 additions & 2 deletions code/modules/mod/mod_activation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,16 @@
part.clothing_flags |= part.visor_flags
part.flags_inv |= part.visor_flags_inv
part.flags_cover |= part.visor_flags_cover
// melbert todo : temp / needs to give heat/cold prot
part.min_cold_protection_temperature = theme.min_cold_protection_temperature
part.max_heat_protection_temperature = theme.max_heat_protection_temperature
part.alternate_worn_layer = null
else
part.icon_state = "[skin]-[part.base_icon_state]"
part.flags_cover &= ~part.visor_flags_cover
part.flags_inv &= ~part.visor_flags_inv
part.clothing_flags &= ~part.visor_flags
// melbert todo : temp / needs to clear heat/cold prot
part.min_cold_protection_temperature = null
part.max_heat_protection_temperature = null
part.alternate_worn_layer = mod_parts[part]
if(part == boots)
wearer.update_worn_shoes()
Expand Down
16 changes: 8 additions & 8 deletions code/modules/reagents/chemistry/reagents/medicine_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@

/datum/reagent/medicine/pyroxadone/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired)
. = ..()
if(affected_mob.body_temperature > BODYTEMP_HEAT_DAMAGE_LIMIT)
if(affected_mob.body_temperature > affected_mob.bodytemp_heat_damage_limit)
var/power = 0
switch(affected_mob.body_temperature)
if(BODYTEMP_HEAT_DAMAGE_LIMIT to 400) // melbert todo : temp
power = 2
if(400 to 460)
power = 3
else
power = 5
// melbert todo : temp / doesn't scale with the limit (ie magic numbers)
if(affected_mob.body_temperature < 400 KELVIN)
power = 2
else if (affected_mob.body_temperature < 450 KELVIN)
power = 3
else
power = 5
if(affected_mob.on_fire)
power *= 2

Expand Down

0 comments on commit e83c0bb

Please sign in to comment.