Minor bodytemp warning refactor.

This commit is contained in:
MistakeNot4892
2022-01-04 18:46:32 -08:00
committed by atermonera
parent 170c1a50ad
commit b868789cd4
6 changed files with 73 additions and 47 deletions
+47 -30
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
@@ -556,7 +566,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))
@@ -565,27 +575,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
@@ -597,15 +617,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")
@@ -683,13 +700,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")
@@ -79,24 +79,23 @@
/datum/species/proc/get_environment_discomfort(var/mob/living/carbon/human/H, var/msg_type)
if(!prob(5))
return
var/covered = 0 // Basic coverage can help.
for(var/obj/item/clothing/clothes in H)
if(H.item_is_in_hands(clothes))
continue
if((clothes.body_parts_covered & UPPER_TORSO) && (clothes.body_parts_covered & LOWER_TORSO))
covered = 1
covered = TRUE
break
switch(msg_type)
if("cold")
if(!covered)
to_chat(H, "<span class='danger'>[pick(cold_discomfort_strings)]</span>")
if("heat")
if(covered)
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)
@@ -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]"
+2 -2
View File
@@ -127,10 +127,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")