Merge pull request #3721 from CHOMPStation2/upstream-merge-11700

[MIRROR] [MIRROR] Minor bodytemp warning refactor.
This commit is contained in:
Razgriz
2022-02-28 22:50:55 -07:00
committed by GitHub
6 changed files with 72 additions and 44 deletions

View File

@@ -191,6 +191,11 @@ The box in your backpack has an oxygen tank and gas mask in it."
desc = "Your battery is about to die! Charge it ASAP!"
icon_state = "c_starving"
/obj/screen/alert/warm
name = "Too Warm"
desc = "You're uncomfortably warm. Take off some clothes or tweak the thermostat a few degrees cooler."
icon_state = "mildhot"
/obj/screen/alert/hot
name = "Too Hot"
desc = "You're flaming hot! Get somewhere cooler and take off any insulating clothing like a fire suit."
@@ -199,6 +204,11 @@ The box in your backpack has an oxygen tank and gas mask in it."
/obj/screen/alert/hot/robot
desc = "The air around you is too hot for a humanoid. Be careful to avoid exposing them to this enviroment."
/obj/screen/alert/chilly
name = "Too Chilly"
desc = "You're uncomfortably cold. Rug up or tweak the thermostat a few degrees higher."
icon_state = "mildcold"
/obj/screen/alert/cold
name = "Too Cold"
desc = "You're freezing cold! Get somewhere warmer and take off any insulating clothing like a space suit."

View File

@@ -21,6 +21,16 @@
#define COLD_GAS_DAMAGE_LEVEL_2 1.5 //Amount of damage applied when the current breath's temperature passes the 200K point
#define COLD_GAS_DAMAGE_LEVEL_3 3 //Amount of damage applied when the current breath's temperature passes the 120K point
#define COLD_ALERT_SEVERITY_LOW 1 // Constants passed to the cold and heat alerts.
#define COLD_ALERT_SEVERITY_MODERATE 2
#define COLD_ALERT_SEVERITY_MAX 3
#define ENVIRONMENT_COMFORT_MARKER_COLD 1
#define HOT_ALERT_SEVERITY_LOW 1
#define HOT_ALERT_SEVERITY_MODERATE 2
#define HOT_ALERT_SEVERITY_MAX 3
#define ENVIRONMENT_COMFORT_MARKER_HOT 2
#define RADIATION_SPEED_COEFFICIENT 0.1
#define HUMAN_COMBUSTION_TEMP 524 //524k is the sustained combustion temperature of human fat
@@ -564,7 +574,7 @@
// Hot air hurts :(
if((breath.temperature < species.breath_cold_level_1 || breath.temperature > species.breath_heat_level_1) && !(COLD_RESISTANCE in mutations))
if((breath.temperature <= species.cold_discomfort_level || breath.temperature >= species.heat_discomfort_level) && !(COLD_RESISTANCE in mutations))
if(breath.temperature <= species.breath_cold_level_1)
if(prob(20))
@@ -573,27 +583,37 @@
if(prob(20))
to_chat(src, "<span class='danger'>You feel your face burning and a searing heat in your lungs!</span>")
if(breath.temperature >= species.breath_heat_level_1)
if(breath.temperature < species.breath_heat_level_2)
apply_damage(HEAT_GAS_DAMAGE_LEVEL_1, BURN, BP_HEAD, used_weapon = "Excessive Heat")
throw_alert("temp", /obj/screen/alert/hot, 1)
else if(breath.temperature < species.breath_heat_level_3)
apply_damage(HEAT_GAS_DAMAGE_LEVEL_2, BURN, BP_HEAD, used_weapon = "Excessive Heat")
throw_alert("temp", /obj/screen/alert/hot, 2)
else
if(breath.temperature >= species.heat_discomfort_level)
if(breath.temperature >= species.breath_heat_level_3)
apply_damage(HEAT_GAS_DAMAGE_LEVEL_3, BURN, BP_HEAD, used_weapon = "Excessive Heat")
throw_alert("temp", /obj/screen/alert/hot, 3)
else if(breath.temperature <= species.breath_cold_level_1)
if(breath.temperature > species.breath_cold_level_2)
apply_damage(COLD_GAS_DAMAGE_LEVEL_1, BURN, BP_HEAD, used_weapon = "Excessive Cold")
throw_alert("temp", /obj/screen/alert/cold, 1)
else if(breath.temperature > species.breath_cold_level_3)
apply_damage(COLD_GAS_DAMAGE_LEVEL_2, BURN, BP_HEAD, used_weapon = "Excessive Cold")
throw_alert("temp", /obj/screen/alert/cold, 2)
throw_alert("temp", /obj/screen/alert/hot, HOT_ALERT_SEVERITY_MAX)
else if(breath.temperature >= species.breath_heat_level_2)
apply_damage(HEAT_GAS_DAMAGE_LEVEL_2, BURN, BP_HEAD, used_weapon = "Excessive Heat")
throw_alert("temp", /obj/screen/alert/hot, HOT_ALERT_SEVERITY_MODERATE)
else if(breath.temperature >= species.breath_heat_level_1)
apply_damage(HEAT_GAS_DAMAGE_LEVEL_1, BURN, BP_HEAD, used_weapon = "Excessive Heat")
throw_alert("temp", /obj/screen/alert/hot, HOT_ALERT_SEVERITY_LOW)
else if(species.get_environment_discomfort(src, ENVIRONMENT_COMFORT_MARKER_HOT))
throw_alert("temp", /obj/screen/alert/warm, HOT_ALERT_SEVERITY_LOW)
else
clear_alert("temp")
else if(breath.temperature <= species.cold_discomfort_level)
if(breath.temperature <= species.breath_cold_level_3)
apply_damage(COLD_GAS_DAMAGE_LEVEL_3, BURN, BP_HEAD, used_weapon = "Excessive Cold")
throw_alert("temp", /obj/screen/alert/cold, 3)
throw_alert("temp", /obj/screen/alert/cold, COLD_ALERT_SEVERITY_MAX)
else if(breath.temperature <= species.breath_cold_level_2)
apply_damage(COLD_GAS_DAMAGE_LEVEL_1, BURN, BP_HEAD, used_weapon = "Excessive Cold")
throw_alert("temp", /obj/screen/alert/cold, COLD_ALERT_SEVERITY_LOW)
else if(breath.temperature <= species.breath_cold_level_1)
apply_damage(COLD_GAS_DAMAGE_LEVEL_2, BURN, BP_HEAD, used_weapon = "Excessive Cold")
throw_alert("temp", /obj/screen/alert/cold, COLD_ALERT_SEVERITY_MODERATE)
else if(species.get_environment_discomfort(src, ENVIRONMENT_COMFORT_MARKER_COLD))
throw_alert("temp", /obj/screen/alert/chilly, COLD_ALERT_SEVERITY_LOW)
else
clear_alert("temp")
//breathing in hot/cold air also heats/cools you a bit
var/temp_adj = breath.temperature - bodytemperature
@@ -605,15 +625,12 @@
var/relative_density = breath.total_moles / (MOLES_CELLSTANDARD * BREATH_PERCENTAGE)
temp_adj *= relative_density
if (temp_adj > BODYTEMP_HEATING_MAX) temp_adj = BODYTEMP_HEATING_MAX
if (temp_adj < BODYTEMP_COOLING_MAX) temp_adj = BODYTEMP_COOLING_MAX
//to_world("Breath: [breath.temperature], [src]: [bodytemperature], Adjusting: [temp_adj]")
bodytemperature += temp_adj
if(temp_adj > BODYTEMP_HEATING_MAX)
temp_adj = BODYTEMP_HEATING_MAX
if(temp_adj < BODYTEMP_COOLING_MAX)
temp_adj = BODYTEMP_COOLING_MAX
else if(breath.temperature >= species.heat_discomfort_level)
species.get_environment_discomfort(src,"heat")
else if(breath.temperature <= species.cold_discomfort_level)
species.get_environment_discomfort(src,"cold")
bodytemperature += temp_adj
else
clear_alert("temp")
@@ -690,13 +707,13 @@
if(bodytemperature >= species.heat_level_2)
if(bodytemperature >= species.heat_level_3)
burn_dam = HEAT_DAMAGE_LEVEL_3
throw_alert("temp", /obj/screen/alert/hot, 3)
throw_alert("temp", /obj/screen/alert/hot, HOT_ALERT_SEVERITY_MAX)
else
burn_dam = HEAT_DAMAGE_LEVEL_2
throw_alert("temp", /obj/screen/alert/hot, 2)
throw_alert("temp", /obj/screen/alert/hot, HOT_ALERT_SEVERITY_MODERATE)
else
burn_dam = HEAT_DAMAGE_LEVEL_1
throw_alert("temp", /obj/screen/alert/hot, 1)
throw_alert("temp", /obj/screen/alert/hot, HOT_ALERT_SEVERITY_LOW)
take_overall_damage(burn=burn_dam, used_weapon = "High Body Temperature")

View File

@@ -79,9 +79,6 @@
/datum/species/proc/get_environment_discomfort(var/mob/living/carbon/human/H, var/msg_type)
if(!prob(10))
return
/* // Commented out because clothes should not prevent you from feeling cold if your body temperature has already dropped. You can absolutely feel cold through clothing, and feel too warm without clothing. ???
var/covered = 0 // Basic coverage can help.
for(var/obj/item/clothing/clothes in H)
@@ -92,11 +89,15 @@
break
*/
switch(msg_type)
if("cold")
to_chat(H, "<span class='danger'>[pick(cold_discomfort_strings)]</span>")
if("heat")
to_chat(H, "<span class='danger'>[pick(heat_discomfort_strings)]</span>")
var/discomfort_message
if(msg_type == ENVIRONMENT_COMFORT_MARKER_COLD && length(cold_discomfort_strings) /*&& !covered*/)
discomfort_message = pick(cold_discomfort_strings)
else if(msg_type == ENVIRONMENT_COMFORT_MARKER_HOT && length(heat_discomfort_strings) /*&& covered*/)
discomfort_message = pick(heat_discomfort_strings)
if(discomfort_message && prob(5))
to_chat(H, SPAN_DANGER(discomfort_message))
return !!discomfort_message
/datum/species/proc/get_random_name(var/gender)
if(!name_language)

View File

@@ -263,15 +263,15 @@
if(environment)
switch(environment.temperature) //310.055 optimal body temp
if(400 to INFINITY)
throw_alert("temp", /obj/screen/alert/hot/robot, 2)
throw_alert("temp", /obj/screen/alert/hot/robot, HOT_ALERT_SEVERITY_MODERATE)
if(360 to 400)
throw_alert("temp", /obj/screen/alert/hot/robot, 1)
throw_alert("temp", /obj/screen/alert/hot/robot, HOT_ALERT_SEVERITY_LOW)
if(260 to 360)
clear_alert("temp")
if(200 to 260)
throw_alert("temp", /obj/screen/alert/cold/robot, 1)
throw_alert("temp", /obj/screen/alert/cold/robot, COLD_ALERT_SEVERITY_LOW)
else
throw_alert("temp", /obj/screen/alert/cold/robot, 2)
throw_alert("temp", /obj/screen/alert/cold/robot, COLD_ALERT_SEVERITY_MODERATE)
//Oxygen and fire does nothing yet!!
// if (src.oxygen) src.oxygen.icon_state = "oxy[src.oxygen_alert ? 1 : 0]"

View File

@@ -156,10 +156,10 @@
//Atmos effect
if(bodytemperature < minbodytemp)
adjustFireLoss(cold_damage_per_tick)
throw_alert("temp", /obj/screen/alert/cold, 3)
throw_alert("temp", /obj/screen/alert/cold, COLD_ALERT_SEVERITY_MAX)
else if(bodytemperature > maxbodytemp)
adjustFireLoss(heat_damage_per_tick)
throw_alert("temp", /obj/screen/alert/hot, 3)
throw_alert("temp", /obj/screen/alert/hot, HOT_ALERT_SEVERITY_MAX)
else
clear_alert("temp")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 110 KiB