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

Temperature Feedback #3358

Merged
merged 8 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
33 changes: 29 additions & 4 deletions code/_onclick/hud/alert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,40 @@ 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/warm
name = "Warm"
desc = "It's a bit warm, but not unbearably so."
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/cool
name = "Cool"
desc = "It's a bit cold, but not unbearably so."
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 30000
#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
95 changes: 70 additions & 25 deletions code/modules/mob/living/carbon/human/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ GLOBAL_LIST_EMPTY(roundstart_races)
var/bodytemp_normal = HUMAN_BODYTEMP_NORMAL
/// Minimum amount of kelvin moved toward normal body temperature per tick.
var/bodytemp_autorecovery_min = HUMAN_BODYTEMP_AUTORECOVERY_MINIMUM
/// 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_BODYTEMP_NORMAL + 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_BODYTEMP_NORMAL - 5)
/// 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.
var/bodytemp_autorecovery_divisor = HUMAN_BODYTEMP_AUTORECOVERY_DIVISOR
///Similar to the autorecovery_divsor, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is higher than their body temperature. Make it lower to lose bodytemp faster.
Expand Down Expand Up @@ -1853,32 +1857,64 @@ GLOBAL_LIST_EMPTY(roundstart_races)
/// Handle the body temperature status effects for the species
/// Traits for resitance to heat or cold are handled here.
/datum/species/proc/handle_body_temperature(mob/living/carbon/human/H)
var/body_temp = H.bodytemperature

//tempature is no longer comfy, throw alert
if(body_temp > max_temp_comfortable && !HAS_TRAIT(H, TRAIT_RESISTHEAT))
SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "cold")
if(body_temp > 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(body_temp > (max_temp_comfortable + 10))
H.throw_alert("tempfeel", /atom/movable/screen/alert/hot, 1)
else
H.throw_alert("tempfeel", /atom/movable/screen/alert/warm)
else if (body_temp < min_temp_comfortable && !HAS_TRAIT(H, TRAIT_RESISTCOLD))
SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "hot")
if(body_temp < 200)
H.throw_alert("tempfeel", /atom/movable/screen/alert/cold, 3)
else if(body_temp < bodytemp_cold_damage_limit)
H.throw_alert("tempfeel", /atom/movable/screen/alert/cold, 2)
else if(body_temp < (min_temp_comfortable - 10))
H.throw_alert("tempfeel", /atom/movable/screen/alert/cold, 1)
else
H.throw_alert("tempfeel", /atom/movable/screen/alert/cool)
else
H.clear_alert("tempfeel")

// Body temperature is too hot, and we do not have resist traits
if(H.bodytemperature > bodytemp_heat_damage_limit && !HAS_TRAIT(H, TRAIT_RESISTHEAT))
if(body_temp > bodytemp_heat_damage_limit && !HAS_TRAIT(H, TRAIT_RESISTHEAT))
// Clear cold mood and apply hot mood
SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "cold")
SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "hot", /datum/mood_event/hot)

//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 @@ -1891,7 +1927,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
H.apply_damage(burn_damage, BURN, spread_damage = TRUE)

// Body temperature is too cold, and we do not have resist traits
else if(H.bodytemperature < bodytemp_cold_damage_limit && !HAS_TRAIT(H, TRAIT_RESISTCOLD))
else if(body_temp < bodytemp_cold_damage_limit && !HAS_TRAIT(H, TRAIT_RESISTCOLD))
// clear any hot moods and apply cold mood
SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "hot")
SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "cold", /datum/mood_event/cold)
Expand All @@ -1900,17 +1936,16 @@ GLOBAL_LIST_EMPTY(roundstart_races)
// Display alerts based on the amount of cold damage being taken
// Apply more damage based on how cold you are

var/bodytemp = H.bodytemperature
if(bodytemp < 120)
H.throw_alert("temp", /atom/movable/screen/alert/cold, 3)
if(body_temp < 120)
H.throw_alert("temp", /atom/movable/screen/alert/shiver, 3)
H.apply_damage(COLD_DAMAGE_LEVEL_3 * coldmod * H.physiology.cold_mod, BURN)

else if(bodytemp < 200)
H.throw_alert("temp", /atom/movable/screen/alert/cold, 2)
else if(body_temp < 200)
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, 1)
H.throw_alert("temp", /atom/movable/screen/alert/shiver, 1)
H.apply_damage(COLD_DAMAGE_LEVEL_1 * coldmod * H.physiology.cold_mod, BURN)

// We are not to hot or cold, remove status and moods
Expand All @@ -1920,6 +1955,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
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
bodytemp_heat_damage_limit = FIRE_MINIMUM_TEMPERATURE_TO_SPREAD // about 150C
// Cold temperatures hurt faster as it is harder to move with out the heat energy
bodytemp_cold_damage_limit = (T20C - 10) // about 10c

max_temp_comfortable = HUMAN_BODYTEMP_NORMAL + 100

hair_color = "fixedmutcolor"
hair_alpha = 140
mutant_bodyparts = list("elzu_horns", "tail_elzu")
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/carbon/human/species_types/kepori.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
bodytemp_normal = HUMAN_BODYTEMP_NORMAL + 30
bodytemp_heat_damage_limit = HUMAN_BODYTEMP_HEAT_DAMAGE_LIMIT + 30
bodytemp_cold_damage_limit = HUMAN_BODYTEMP_COLD_DAMAGE_LIMIT + 30
max_temp_comfortable = HUMAN_BODYTEMP_NORMAL + 40
min_temp_comfortable = HUMAN_BODYTEMP_NORMAL - 3
mutanttongue = /obj/item/organ/tongue/kepori
species_language_holder = /datum/language_holder/kepori
var/datum/action/innate/keptackle/keptackle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
// Lizards are coldblooded and can stand a greater temperature range than humans
bodytemp_heat_damage_limit = HUMAN_BODYTEMP_HEAT_DAMAGE_LIMIT + 20 // This puts lizards 10 above lavaland max heat for ash lizards.
bodytemp_cold_damage_limit = HUMAN_BODYTEMP_COLD_DAMAGE_LIMIT - 10

max_temp_comfortable = HUMAN_BODYTEMP_NORMAL + 25
min_temp_comfortable = HUMAN_BODYTEMP_NORMAL - 3
loreblurb = "The Sarathi are a cold-blooded reptilian species originating from the planet Kalixcis, where they evolved alongside the Elzuosa. Kalixcian culture places no importance on blood-bonds, and those from it tend to consider their family anyone they are sufficiently close to, and choose their own names."

ass_image = 'icons/ass/asslizard.png'
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/human/species_types/vox.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
bodytemp_cold_divisor = VOX_BODYTEMP_COLD_DIVISOR
bodytemp_autorecovery_min = VOX_BODYTEMP_AUTORECOVERY_MIN

max_temp_comfortable = HUMAN_BODYTEMP_NORMAL + 20
min_temp_comfortable = HUMAN_BODYTEMP_NORMAL - 20

bodytype = BODYTYPE_VOX

species_chest = /obj/item/bodypart/chest/vox
Expand Down
Binary file modified icons/hud/screen_alert.dmi
Binary file not shown.
10 changes: 5 additions & 5 deletions shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@
#include "code\__DEFINES\wires.dm"
#include "code\__DEFINES\dcs\flags.dm"
#include "code\__DEFINES\dcs\helpers.dm"
#include "code\__DEFINES\dcs\signals\signals.dm"
#include "code\__DEFINES\dcs\signals\signals_mod.dm"
#include "code\__DEFINES\dcs\signals\signals_storage.dm"
#include "code\__DEFINES\dcs\signals\signals_mob\signals_mob_carbon.dm"
#include "code\__DEFINES\dcs\signals\signals.dm"
#include "code\__DEFINES\dcs\signals\signals_obj\signals_object.dm"
#include "code\__DEFINES\dcs\signals\signals_obj\signals_item\signals_clothing.dm"
#include "code\__DEFINES\dcs\signals\signals_obj\signals_item\signals_food.dm"
Expand Down Expand Up @@ -2811,6 +2811,10 @@
#include "code\modules\mob\living\simple_animal\slime\slime.dm"
#include "code\modules\mob\living\simple_animal\slime\slime_say.dm"
#include "code\modules\mob\living\simple_animal\slime\subtypes.dm"
#include "code\modules\mob_spawner\burrow.dm"
#include "code\modules\mob_spawner\hivebot.dm"
#include "code\modules\mob_spawner\spawner.dm"
#include "code\modules\mob_spawner\spawner_componet.dm"
#include "code\modules\mod\mod_actions.dm"
#include "code\modules\mod\mod_activation.dm"
#include "code\modules\mod\mod_ai.dm"
Expand All @@ -2835,10 +2839,6 @@
#include "code\modules\mod\modules\modules_storage.dm"
#include "code\modules\mod\modules\modules_supply.dm"
#include "code\modules\mod\modules\modules_visor.dm"
#include "code\modules\mob_spawner\burrow.dm"
#include "code\modules\mob_spawner\hivebot.dm"
#include "code\modules\mob_spawner\spawner.dm"
#include "code\modules\mob_spawner\spawner_componet.dm"
#include "code\modules\modular_computers\laptop_vendor.dm"
#include "code\modules\modular_computers\computers\_modular_computer_shared.dm"
#include "code\modules\modular_computers\computers\item\computer.dm"
Expand Down
Loading