Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spicy #3

Open
wants to merge 2 commits into
base: rylie-temp
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

/// The natural temperature for a body
#define HUMAN_BODYTEMP_NORMAL 310.15
/// The room temperature, aka what most humans are comfortable at
#define HUMAN_TEMP_COMFORTABLE 293.15
/// This is the divisor which handles how much of the temperature difference between the current body temperature and 310.15K (optimal temperature) humans auto-regenerate each tick. The higher the number, the slower the recovery. This is applied each tick, so long as the mob is alive.
#define HUMAN_BODYTEMP_AUTORECOVERY_DIVISOR 11
/// Minimum amount of kelvin moved toward 310K per tick. So long as abs(310.15 - bodytemp) is more than 50.
Expand Down
23 changes: 19 additions & 4 deletions code/_onclick/hud/alert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,30 @@ Override makes it so the alert is not replaced until cleared by a clear_alert wi
icon_state = "gross3"

/atom/movable/screen/alert/hot
name = "Too Hot"
desc = "You're flaming hot! Get somewhere cooler and take off any insulating clothing like a fire suit."
name = "Hot"
desc = "It's quite warm. Get somewhere cooler and take off any insulating clothing like a fire suit."
icon_state = "hot"

/atom/movable/screen/alert/cold
name = "Too Cold"
desc = "You're freezing cold! Get somewhere warmer and take off any insulating clothing like a space suit."
name = "Cold"
desc = "It's quite cold. Get somewhere warmer and take off any insulating clothing like a space suit."
icon_state = "cold"

/atom/movable/screen/alert/sweat
name = "Sweating"
desc = "You're sweating and are likely overheating! Get somewhere cooler and take off any insulating clothing like a fire suit."
icon_state = "sweat"

/atom/movable/screen/alert/shiver
name = "Shivering"
desc = "You're shivering and very likely frezzing. Get somewhere warmer and take off any insulating clothing like a space suit."
icon_state = "shiver"

/atom/movable/screen/alert/fans
name = "High Fan Speed"
desc = "Your fans are spinning quite fast! Get somewhere cooler and take off any insulating clothing like a fire suit."
icon_state = "fans"

/atom/movable/screen/alert/lowpressure
name = "Low Pressure"
desc = "The air around you is hazardously thin. A space suit would protect you."
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/turf_fire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define TURF_FIRE_VOLUME 150
#define TURF_FIRE_MAX_POWER 50

#define TURF_FIRE_ENERGY_PER_BURNED_OXY_MOL 12000
#define TURF_FIRE_ENERGY_PER_BURNED_OXY_MOL 38000
#define TURF_FIRE_BURN_RATE_BASE 0.12
#define TURF_FIRE_BURN_RATE_PER_POWER 0.02
#define TURF_FIRE_BURN_CARBON_DIOXIDE_MULTIPLIER 0.75
Expand Down
84 changes: 63 additions & 21 deletions code/modules/mob/living/carbon/human/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ GLOBAL_LIST_EMPTY(roundstart_races)

/// The natural temperature for a body
var/bodytemp_normal = HUMAN_BODYTEMP_NORMAL
/// The maximum temperature the species is comfortable at. Going above this does not apply any effects, but warns players that the temperture is hot
var/max_temp_comfortable = (HUMAN_TEMP_COMFORTABLE + 7)
/// The minimum temperature the species is comfortable at. Going below this does not apply any effects, but warns players that the temperture is chilly
var/min_temp_comfortable = (HUMAN_TEMP_COMFORTABLE - 5)
/// Minimum amount of kelvin moved toward normal body temperature per tick.
var/bodytemp_autorecovery_min = HUMAN_BODYTEMP_AUTORECOVERY_MINIMUM
/// This is the divisor which handles how much of the temperature difference between the current body temperature and 310.15K (optimal temperature) humans auto-regenerate each tick. The higher the number, the slower the recovery.
Expand Down Expand Up @@ -1831,7 +1835,32 @@ GLOBAL_LIST_EMPTY(roundstart_races)
*/
/datum/species/proc/handle_environment(datum/gas_mixture/environment, mob/living/carbon/human/H)
var/areatemp = H.get_temperature(environment)

//tempature is no longer comfy, throw alert
if(areatemp > max_temp_comfortable && !HAS_TRAIT(H, TRAIT_RESISTHEAT))
SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "cold")
if(H.bodytemperature > bodytemp_heat_damage_limit)
var/burn_damage = calculate_burn_damage(H)
if(burn_damage < 2)
H.throw_alert("tempfeel", /atom/movable/screen/alert/hot, 3)
else
H.throw_alert("tempfeel", /atom/movable/screen/alert/hot, 2)
else
if(areatemp > (max_temp_comfortable + 10))
H.throw_alert("tempfeel", /atom/movable/screen/alert/hot, 1)
else
H.throw_alert("tempfeel", /atom/movable/screen/alert/hot)
else if (areatemp < min_temp_comfortable && !HAS_TRAIT(H, TRAIT_RESISTCOLD))
SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "hot")
if(H.bodytemperature < 200)
H.throw_alert("tempfeel", /atom/movable/screen/alert/cold, 3)
else if(H.bodytemperature < bodytemp_cold_damage_limit)
H.throw_alert("tempfeel", /atom/movable/screen/alert/cold, 2)
else if(areatemp < (min_temp_comfortable - 10))
H.throw_alert("tempfeel", /atom/movable/screen/alert/cold, 1)
else
H.throw_alert("tempfeel", /atom/movable/screen/alert/cold)
else
H.clear_alert("tempfeel")
if(H.stat != DEAD) // If you are dead your body does not stabilize naturally
natural_bodytemperature_stabilization(environment, H)

Expand All @@ -1850,23 +1879,26 @@ GLOBAL_LIST_EMPTY(roundstart_races)
//Remove any slowdown from the cold.
H.remove_movespeed_modifier(/datum/movespeed_modifier/cold)

var/burn_damage = 0
var/firemodifier = H.fire_stacks / 50
if (!H.on_fire) // We are not on fire, reduce the modifier
firemodifier = min(firemodifier, 0)

// this can go below 5 at log 2.5
burn_damage = max(log(2 - firemodifier, (H.bodytemperature - H.get_body_temp_normal(apply_change=FALSE))) - 5,0)

// Display alerts based on the amount of fire damage being taken
if (burn_damage)
switch(burn_damage)
if(1 to 2)
H.throw_alert("temp", /atom/movable/screen/alert/hot, 1)
if(2 to 4)
H.throw_alert("temp", /atom/movable/screen/alert/hot, 2)
else
H.throw_alert("temp", /atom/movable/screen/alert/hot, 3)
var/burn_damage = calculate_burn_damage(H)

// sweats depending on burn damage, not actually a mechanic but a alternative to pinpoint when you are taking damage
if(burn_damage)
if(H.mob_biotypes & MOB_ROBOTIC) //robors have a alternative cooling fan graphic
switch(burn_damage)
if(0 to 2)
H.throw_alert("temp", /atom/movable/screen/alert/fans, 1)
if(2 to 4)
H.throw_alert("temp", /atom/movable/screen/alert/fans, 2)
else
H.throw_alert("temp", /atom/movable/screen/alert/fans, 3)
else
switch(burn_damage)
if(0 to 2)
H.throw_alert("temp", /atom/movable/screen/alert/sweat, 1)
if(2 to 4)
H.throw_alert("temp", /atom/movable/screen/alert/sweat, 2)
else
H.throw_alert("temp", /atom/movable/screen/alert/sweat, 3)

// Apply species and physiology modifiers to heat damage
burn_damage = burn_damage * heatmod * H.physiology.heat_mod
Expand All @@ -1889,13 +1921,13 @@ GLOBAL_LIST_EMPTY(roundstart_races)
// Apply more damage based on how cold you are
switch(H.bodytemperature)
if(200 to bodytemp_cold_damage_limit)
H.throw_alert("temp", /atom/movable/screen/alert/cold, 1)
H.throw_alert("temp", /atom/movable/screen/alert/shiver, 1)
H.apply_damage(COLD_DAMAGE_LEVEL_1 * coldmod * H.physiology.cold_mod, BURN)
if(120 to 200)
H.throw_alert("temp", /atom/movable/screen/alert/cold, 2)
H.throw_alert("temp", /atom/movable/screen/alert/shiver, 2)
H.apply_damage(COLD_DAMAGE_LEVEL_2 * coldmod * H.physiology.cold_mod, BURN)
else
H.throw_alert("temp", /atom/movable/screen/alert/cold, 3)
H.throw_alert("temp", /atom/movable/screen/alert/shiver, 3)
H.apply_damage(COLD_DAMAGE_LEVEL_3 * coldmod * H.physiology.cold_mod, BURN)

// We are not to hot or cold, remove status and moods
Expand All @@ -1905,6 +1937,16 @@ GLOBAL_LIST_EMPTY(roundstart_races)
SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "cold")
SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "hot")

/datum/species/proc/calculate_burn_damage(mob/living/carbon/human/current_human)
var/burn_damage = 0
var/firemodifier = current_human.fire_stacks / 50
if (!current_human.on_fire) // We are not on fire, reduce the modifier
firemodifier = min(firemodifier, 0)

// this can go below 5 at log 2.5
burn_damage = max(log(2 - firemodifier, (current_human.bodytemperature - current_human.get_body_temp_normal(apply_change=FALSE))) - 5,0)
return burn_damage

/// Handle the air pressure of the environment
/datum/species/proc/handle_environment_pressure(datum/gas_mixture/environment, mob/living/carbon/human/H)
var/pressure = environment.return_pressure()
Expand Down
Binary file modified icons/hud/screen_alert.dmi
Binary file not shown.
Loading