Refactor Lung Handling
This commit is contained in:
@@ -67,8 +67,8 @@
|
||||
#define PLASMA_MINIMUM_OXYGEN_NEEDED 2
|
||||
#define PLASMA_MINIMUM_OXYGEN_PLASMA_RATIO 30
|
||||
#define PLASMA_OXYGEN_FULLBURN 10
|
||||
#define MIN_PLASMA_DAMAGE 1
|
||||
#define MAX_PLASMA_DAMAGE 10
|
||||
#define MIN_TOXIC_GAS_DAMAGE 1
|
||||
#define MAX_TOXIC_GAS_DAMAGE 10
|
||||
#define MOLES_PLASMA_VISIBLE 0.5 //Moles in a standard cell after which plasma is visible
|
||||
//Plasma fusion properties
|
||||
#define PLASMA_BINDING_ENERGY 3000000
|
||||
|
||||
9
code/__DEFINES/combat.dm.rej
Normal file
9
code/__DEFINES/combat.dm.rej
Normal file
@@ -0,0 +1,9 @@
|
||||
diff a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm (rejected hunks)
|
||||
@@ -9,6 +9,7 @@
|
||||
#define OXY "oxy"
|
||||
#define CLONE "clone"
|
||||
#define STAMINA "stamina"
|
||||
+#define BRAIN "brain"
|
||||
|
||||
//bitflag damage defines used for suicide_act
|
||||
#define BRUTELOSS 1
|
||||
@@ -109,17 +109,26 @@
|
||||
|
||||
|
||||
//Gas alerts
|
||||
/obj/screen/alert/oxy
|
||||
/obj/screen/alert/not_enough_oxy
|
||||
name = "Choking (No O2)"
|
||||
desc = "You're not getting enough oxygen. Find some good air before you pass out! \
|
||||
The box in your backpack has an oxygen tank and breath mask in it."
|
||||
icon_state = "oxy"
|
||||
desc = "You're not getting enough oxygen. Find some good air before you pass out! The box in your backpack has an oxygen tank and breath mask in it."
|
||||
icon_state = "not_enough_oxy"
|
||||
|
||||
/obj/screen/alert/too_much_oxy
|
||||
name = "Choking (O2)"
|
||||
desc = "There's too much oxygen in the air, and you're breathing it in! Find some good air before you pass out!"
|
||||
icon_state = "too_much_oxy"
|
||||
|
||||
/obj/screen/alert/not_enough_nitro
|
||||
name = "Choking (No N2)"
|
||||
desc = "You're not getting enough nitrogen. Find some good air before you pass out!"
|
||||
icon_state = "not_enough_nitro"
|
||||
|
||||
/obj/screen/alert/too_much_nitro
|
||||
name = "Choking (N2)"
|
||||
desc = "There's too much nitrogen in the air, and you're breathing it in! Find some good air before you pass out!"
|
||||
icon_state = "too_much_nitro"
|
||||
|
||||
/obj/screen/alert/not_enough_co2
|
||||
name = "Choking (No CO2)"
|
||||
desc = "You're not getting enough carbon dioxide. Find some good air before you pass out!"
|
||||
@@ -135,11 +144,10 @@ The box in your backpack has an oxygen tank and breath mask in it."
|
||||
desc = "You're not getting enough plasma. Find some good air before you pass out!"
|
||||
icon_state = "not_enough_tox"
|
||||
|
||||
/obj/screen/alert/tox_in_air
|
||||
/obj/screen/alert/too_much_tox
|
||||
name = "Choking (Plasma)"
|
||||
desc = "There's highly flammable, toxic plasma in the air and you're breathing it in. Find some fresh air. \
|
||||
The box in your backpack has an oxygen tank and gas mask in it."
|
||||
icon_state = "tox_in_air"
|
||||
desc = "There's highly flammable, toxic plasma in the air and you're breathing it in. Find some fresh air. The box in your backpack has an oxygen tank and gas mask in it."
|
||||
icon_state = "too_much_tox"
|
||||
//End gas alerts
|
||||
|
||||
|
||||
|
||||
@@ -874,12 +874,12 @@ Gunshots/explosions/opening doors/less rare audio (done)
|
||||
hal_screwyhud = 0
|
||||
|
||||
if("fake_alert")
|
||||
var/alert_type = pick("oxy","not_enough_tox","not_enough_co2","too_much_oxy","too_much_co2","tox_in_air","newlaw","nutrition","charge","weightless","fire","locked","hacked","temp","pressure")
|
||||
var/alert_type = pick("not_enough_oxy","not_enough_tox","not_enough_co2","too_much_oxy","too_much_co2","too_much_tox","newlaw","nutrition","charge","weightless","fire","locked","hacked","temp","pressure")
|
||||
if(specific)
|
||||
alert_type = specific
|
||||
switch(alert_type)
|
||||
if("oxy")
|
||||
throw_alert("oxy", /obj/screen/alert/oxy, override = TRUE)
|
||||
if("not_enough_oxy")
|
||||
throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy, override = TRUE)
|
||||
if("not_enough_tox")
|
||||
throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox, override = TRUE)
|
||||
if("not_enough_co2")
|
||||
@@ -888,8 +888,8 @@ Gunshots/explosions/opening doors/less rare audio (done)
|
||||
throw_alert("too_much_oxy", /obj/screen/alert/too_much_oxy, override = TRUE)
|
||||
if("too_much_co2")
|
||||
throw_alert("too_much_co2", /obj/screen/alert/too_much_co2, override = TRUE)
|
||||
if("tox_in_air")
|
||||
throw_alert("tox_in_air", /obj/screen/alert/tox_in_air, override = TRUE)
|
||||
if("too_much_tox")
|
||||
throw_alert("too_much_tox", /obj/screen/alert/too_much_tox, override = TRUE)
|
||||
if("nutrition")
|
||||
if(prob(50))
|
||||
throw_alert("nutrition", /obj/screen/alert/fat, override = TRUE)
|
||||
|
||||
10
code/modules/mob/living/carbon/damage_procs.dm.rej
Normal file
10
code/modules/mob/living/carbon/damage_procs.dm.rej
Normal file
@@ -0,0 +1,10 @@
|
||||
diff a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm (rejected hunks)
|
||||
@@ -36,6 +36,8 @@
|
||||
adjustCloneLoss(damage * hit_percent)
|
||||
if(STAMINA)
|
||||
adjustStaminaLoss(damage * hit_percent)
|
||||
+ if(BRAIN)
|
||||
+ adjustBrainLoss(damage * hit_percent)
|
||||
return 1
|
||||
|
||||
|
||||
@@ -103,11 +103,13 @@
|
||||
var/datum/species/S = dna.species
|
||||
|
||||
if(S.breathid == "o2")
|
||||
throw_alert("oxy", /obj/screen/alert/oxy)
|
||||
throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy)
|
||||
else if(S.breathid == "tox")
|
||||
throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox)
|
||||
else if(S.breathid == "co2")
|
||||
throw_alert("not_enough_co2", /obj/screen/alert/not_enough_co2)
|
||||
else if(S.breathid == "n2")
|
||||
throw_alert("not_enough_nitro", /obj/screen/alert/not_enough_nitro)
|
||||
|
||||
return 0
|
||||
else
|
||||
|
||||
@@ -1502,6 +1502,8 @@
|
||||
H.adjustCloneLoss(damage * hit_percent)
|
||||
if(STAMINA)
|
||||
H.adjustStaminaLoss(damage * hit_percent)
|
||||
if(BRAIN)
|
||||
H.adjustBrainLoss(damage * hit_percent)
|
||||
return 1
|
||||
|
||||
/datum/species/proc/on_hit(obj/item/projectile/P, mob/living/carbon/human/H)
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
return
|
||||
adjustOxyLoss(1)
|
||||
failed_last_breath = 1
|
||||
throw_alert("oxy", /obj/screen/alert/oxy)
|
||||
throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy)
|
||||
return 0
|
||||
|
||||
var/safe_oxy_min = 16
|
||||
@@ -144,14 +144,14 @@
|
||||
else
|
||||
adjustOxyLoss(3)
|
||||
failed_last_breath = 1
|
||||
throw_alert("oxy", /obj/screen/alert/oxy)
|
||||
throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy)
|
||||
|
||||
else //Enough oxygen
|
||||
failed_last_breath = 0
|
||||
if(oxyloss)
|
||||
adjustOxyLoss(-5)
|
||||
oxygen_used = breath_gases["o2"][MOLES]
|
||||
clear_alert("oxy")
|
||||
clear_alert("not_enough_oxy")
|
||||
|
||||
breath_gases["o2"][MOLES] -= oxygen_used
|
||||
breath_gases["co2"][MOLES] += oxygen_used
|
||||
@@ -174,11 +174,10 @@
|
||||
//TOXINS/PLASMA
|
||||
if(Toxins_partialpressure > safe_tox_max)
|
||||
var/ratio = (breath_gases["plasma"][MOLES]/safe_tox_max) * 10
|
||||
if(reagents)
|
||||
reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
|
||||
throw_alert("tox_in_air", /obj/screen/alert/tox_in_air)
|
||||
adjustToxLoss(Clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE))
|
||||
throw_alert("too_much_tox", /obj/screen/alert/too_much_tox)
|
||||
else
|
||||
clear_alert("tox_in_air")
|
||||
clear_alert("too_much_tox")
|
||||
|
||||
//NITROUS OXIDE
|
||||
if(breath_gases["n2o"])
|
||||
|
||||
41
code/modules/mob/living/damage_procs.dm.rej
Normal file
41
code/modules/mob/living/damage_procs.dm.rej
Normal file
@@ -0,0 +1,41 @@
|
||||
diff a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm (rejected hunks)
|
||||
@@ -25,6 +25,8 @@
|
||||
adjustCloneLoss(damage * hit_percent)
|
||||
if(STAMINA)
|
||||
adjustStaminaLoss(damage * hit_percent)
|
||||
+ if(BRAIN)
|
||||
+ adjustBrainLoss(damage * hit_percent)
|
||||
return 1
|
||||
|
||||
/mob/living/proc/apply_damage_type(damage = 0, damagetype = BRUTE) //like apply damage except it always uses the damage procs
|
||||
@@ -41,6 +43,8 @@
|
||||
return adjustCloneLoss(damage)
|
||||
if(STAMINA)
|
||||
return adjustStaminaLoss(damage)
|
||||
+ if(BRAIN)
|
||||
+ return adjustBrainLoss(damage)
|
||||
|
||||
/mob/living/proc/get_damage_amount(damagetype = BRUTE)
|
||||
switch(damagetype)
|
||||
@@ -56,9 +60,11 @@
|
||||
return getCloneLoss()
|
||||
if(STAMINA)
|
||||
return getStaminaLoss()
|
||||
+ if(BRAIN)
|
||||
+ return getBrainLoss()
|
||||
|
||||
|
||||
-/mob/living/proc/apply_damages(brute = 0, burn = 0, tox = 0, oxy = 0, clone = 0, def_zone = null, blocked = FALSE, stamina = 0)
|
||||
+/mob/living/proc/apply_damages(brute = 0, burn = 0, tox = 0, oxy = 0, clone = 0, def_zone = null, blocked = FALSE, stamina = 0, brain = 0)
|
||||
if(blocked >= 100)
|
||||
return 0
|
||||
if(brute)
|
||||
@@ -73,6 +79,8 @@
|
||||
apply_damage(clone, CLONE, def_zone, blocked)
|
||||
if(stamina)
|
||||
apply_damage(stamina, STAMINA, def_zone, blocked)
|
||||
+ if(brain)
|
||||
+ apply_damage(brain, BRAIN, def_zone, blocked)
|
||||
return 1
|
||||
|
||||
|
||||
@@ -357,7 +357,7 @@
|
||||
updatehealth() //then we check if the mob should wake up.
|
||||
update_canmove()
|
||||
update_sight()
|
||||
clear_alert("oxy")
|
||||
clear_alert("not_enough_oxy")
|
||||
reload_fullscreen()
|
||||
. = 1
|
||||
if(mind)
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
slot = "lungs"
|
||||
gender = PLURAL
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
var/list/breathlevels = list("safe_oxygen_min" = 16,"safe_oxygen_max" = 0,"safe_co2_min" = 0,"safe_co2_max" = 10,
|
||||
"safe_toxins_min" = 0,"safe_toxins_max" = 0.05,"SA_para_min" = 1,"SA_sleep_min" = 5,"BZ_trip_balls_min" = 1)
|
||||
|
||||
//Breath damage
|
||||
|
||||
var/safe_oxygen_min = 16 // Minimum safe partial pressure of O2, in kPa
|
||||
var/safe_oxygen_max = 0
|
||||
var/safe_nitro_min = 0
|
||||
var/safe_nitro_max = 0
|
||||
var/safe_co2_min = 0
|
||||
var/safe_co2_max = 10 // Yes it's an arbitrary value who cares?
|
||||
var/safe_toxins_min = 0
|
||||
@@ -30,16 +30,41 @@
|
||||
var/SA_sleep_min = 5 //Sleeping agent
|
||||
var/BZ_trip_balls_min = 1 //BZ gas.
|
||||
|
||||
var/oxy_breath_dam_min = 1
|
||||
var/oxy_breath_dam_max = 10
|
||||
var/co2_breath_dam_min = 1
|
||||
var/co2_breath_dam_max = 10
|
||||
var/tox_breath_dam_min = MIN_PLASMA_DAMAGE
|
||||
var/tox_breath_dam_max = MAX_PLASMA_DAMAGE
|
||||
var/oxy_breath_dam_min = MIN_TOXIC_GAS_DAMAGE
|
||||
var/oxy_breath_dam_max = MAX_TOXIC_GAS_DAMAGE
|
||||
var/oxy_damage_type = OXY
|
||||
var/nitro_breath_dam_min = MIN_TOXIC_GAS_DAMAGE
|
||||
var/nitro_breath_dam_max = MAX_TOXIC_GAS_DAMAGE
|
||||
var/nitro_damage_type = OXY
|
||||
var/co2_breath_dam_min = MIN_TOXIC_GAS_DAMAGE
|
||||
var/co2_breath_dam_max = MAX_TOXIC_GAS_DAMAGE
|
||||
var/co2_damage_type = OXY
|
||||
var/tox_breath_dam_min = MIN_TOXIC_GAS_DAMAGE
|
||||
var/tox_breath_dam_max = MAX_TOXIC_GAS_DAMAGE
|
||||
var/tox_damage_type = TOX
|
||||
|
||||
var/cold_message = "your face freezing and an icicle forming"
|
||||
var/cold_level_1_threshold = 260
|
||||
var/cold_level_2_threshold = 200
|
||||
var/cold_level_3_threshold = 120
|
||||
var/cold_level_1_damage = COLD_GAS_DAMAGE_LEVEL_1 //Keep in mind with gas damage levels, you can set these to be negative, if you want someone to heal, instead.
|
||||
var/cold_level_2_damage = COLD_GAS_DAMAGE_LEVEL_2
|
||||
var/cold_level_3_damage = COLD_GAS_DAMAGE_LEVEL_3
|
||||
var/cold_damage_type = BURN
|
||||
|
||||
var/hot_message = "your face burning and a searing heat"
|
||||
var/heat_level_1_threshold = 360
|
||||
var/heat_level_2_threshold = 400
|
||||
var/heat_level_3_threshold = 1000
|
||||
var/heat_level_1_damage = HEAT_GAS_DAMAGE_LEVEL_1
|
||||
var/heat_level_2_damage = HEAT_GAS_DAMAGE_LEVEL_2
|
||||
var/heat_level_3_damage = HEAT_GAS_DAMAGE_LEVEL_3
|
||||
var/heat_damage_type = BURN
|
||||
|
||||
var/crit_stabilizing_reagent = "epinephrine"
|
||||
|
||||
|
||||
|
||||
/obj/item/organ/lungs/proc/check_breath(datum/gas_mixture/breath, var/mob/living/carbon/human/H)
|
||||
/obj/item/organ/lungs/proc/check_breath(datum/gas_mixture/breath, mob/living/carbon/human/H)
|
||||
if((H.status_flags & GODMODE))
|
||||
return
|
||||
|
||||
@@ -48,30 +73,33 @@
|
||||
species_traits = H.dna.species.species_traits
|
||||
|
||||
if(!breath || (breath.total_moles() == 0))
|
||||
if(H.reagents.has_reagent("epinephrine"))
|
||||
if(H.reagents.has_reagent(crit_stabilizing_reagent))
|
||||
return
|
||||
if(H.health >= HEALTH_THRESHOLD_CRIT)
|
||||
H.adjustOxyLoss(HUMAN_MAX_OXYLOSS)
|
||||
else if(!(NOCRITDAMAGE in species_traits))
|
||||
H.adjustOxyLoss(HUMAN_CRIT_MAX_OXYLOSS)
|
||||
|
||||
H.failed_last_breath = 1
|
||||
H.failed_last_breath = TRUE
|
||||
if(safe_oxygen_min)
|
||||
H.throw_alert("oxy", /obj/screen/alert/oxy)
|
||||
H.throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy)
|
||||
else if(safe_toxins_min)
|
||||
H.throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox)
|
||||
else if(safe_co2_min)
|
||||
H.throw_alert("not_enough_co2", /obj/screen/alert/not_enough_co2)
|
||||
return 0
|
||||
else if(safe_nitro_min)
|
||||
H.throw_alert("not_enough_nitro", /obj/screen/alert/not_enough_nitro)
|
||||
return FALSE
|
||||
|
||||
var/gas_breathed = 0
|
||||
|
||||
var/list/breath_gases = breath.gases
|
||||
|
||||
breath.assert_gases("o2", "plasma", "co2", "n2o", "bz")
|
||||
breath.assert_gases("o2", "n2", "plasma", "co2", "n2o", "bz")
|
||||
|
||||
//Partial pressures in our breath
|
||||
var/O2_pp = breath.get_breath_partial_pressure(breath_gases["o2"][MOLES])
|
||||
var/N2_pp = breath.get_breath_partial_pressure(breath_gases["n2"][MOLES])
|
||||
var/Toxins_pp = breath.get_breath_partial_pressure(breath_gases["plasma"][MOLES])
|
||||
var/CO2_pp = breath.get_breath_partial_pressure(breath_gases["co2"][MOLES])
|
||||
|
||||
@@ -82,7 +110,7 @@
|
||||
if(safe_oxygen_max)
|
||||
if(O2_pp > safe_oxygen_max)
|
||||
var/ratio = (breath_gases["o2"][MOLES]/safe_oxygen_max) * 10
|
||||
H.adjustOxyLoss(Clamp(ratio,oxy_breath_dam_min,oxy_breath_dam_max))
|
||||
H.apply_damage_type(Clamp(ratio, oxy_breath_dam_min, oxy_breath_dam_max), oxy_damage_type)
|
||||
H.throw_alert("too_much_oxy", /obj/screen/alert/too_much_oxy)
|
||||
else
|
||||
H.clear_alert("too_much_oxy")
|
||||
@@ -90,20 +118,45 @@
|
||||
//Too little oxygen!
|
||||
if(safe_oxygen_min)
|
||||
if(O2_pp < safe_oxygen_min)
|
||||
gas_breathed = handle_too_little_breath(H,O2_pp,safe_oxygen_min,breath_gases["o2"][MOLES])
|
||||
H.throw_alert("oxy", /obj/screen/alert/oxy)
|
||||
gas_breathed = handle_too_little_breath(H, O2_pp, safe_oxygen_min, breath_gases["o2"][MOLES])
|
||||
H.throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy)
|
||||
else
|
||||
H.failed_last_breath = 0
|
||||
if(H.getOxyLoss())
|
||||
H.adjustOxyLoss(-5)
|
||||
H.failed_last_breath = FALSE
|
||||
H.adjustOxyLoss(-5)
|
||||
gas_breathed = breath_gases["o2"][MOLES]
|
||||
H.clear_alert("oxy")
|
||||
H.clear_alert("not_enough_oxy")
|
||||
|
||||
//Exhale
|
||||
breath_gases["o2"][MOLES] -= gas_breathed
|
||||
breath_gases["co2"][MOLES] += gas_breathed
|
||||
gas_breathed = 0
|
||||
|
||||
//-- Nitrogen --//
|
||||
|
||||
//Too much nitrogen!
|
||||
if(safe_nitro_max)
|
||||
if(N2_pp > safe_nitro_max)
|
||||
var/ratio = (breath_gases["n2"][MOLES]/safe_nitro_max) * 10
|
||||
H.apply_damage_type(Clamp(ratio, nitro_breath_dam_min, nitro_breath_dam_max), nitro_damage_type)
|
||||
H.throw_alert("too_much_nitro", /obj/screen/alert/too_much_nitro)
|
||||
else
|
||||
H.clear_alert("too_much_nitro")
|
||||
|
||||
//Too little nitrogen!
|
||||
if(safe_nitro_min)
|
||||
if(N2_pp < safe_nitro_min)
|
||||
gas_breathed = handle_too_little_breath(H, N2_pp, safe_nitro_min, breath_gases["n2"][MOLES])
|
||||
H.throw_alert("nitro", /obj/screen/alert/not_enough_nitro)
|
||||
else
|
||||
H.failed_last_breath = FALSE
|
||||
H.adjustOxyLoss(-5)
|
||||
gas_breathed = breath_gases["n2"][MOLES]
|
||||
H.clear_alert("nitro")
|
||||
|
||||
//Exhale
|
||||
breath_gases["n2"][MOLES] -= gas_breathed
|
||||
breath_gases["co2"][MOLES] += gas_breathed
|
||||
gas_breathed = 0
|
||||
|
||||
//-- CO2 --//
|
||||
|
||||
@@ -114,9 +167,9 @@
|
||||
H.co2overloadtime = world.time
|
||||
else if(world.time - H.co2overloadtime > 120)
|
||||
H.Unconscious(60)
|
||||
H.adjustOxyLoss(3) // Lets hurt em a little, let them know we mean business
|
||||
H.apply_damage_type(3, co2_damage_type) // Lets hurt em a little, let them know we mean business
|
||||
if(world.time - H.co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good!
|
||||
H.adjustOxyLoss(8)
|
||||
H.apply_damage_type(8, co2_damage_type)
|
||||
H.throw_alert("too_much_co2", /obj/screen/alert/too_much_co2)
|
||||
if(prob(20)) // Lets give them some chance to know somethings not right though I guess.
|
||||
H.emote("cough")
|
||||
@@ -126,12 +179,12 @@
|
||||
H.clear_alert("too_much_co2")
|
||||
|
||||
//Too little CO2!
|
||||
if(breathlevels["safe_co2_min"])
|
||||
if(safe_co2_min)
|
||||
if(CO2_pp < safe_co2_min)
|
||||
gas_breathed = handle_too_little_breath(H,CO2_pp, safe_co2_min,breath_gases["co2"][MOLES])
|
||||
gas_breathed = handle_too_little_breath(H, CO2_pp, safe_co2_min, breath_gases["co2"][MOLES])
|
||||
H.throw_alert("not_enough_co2", /obj/screen/alert/not_enough_co2)
|
||||
else
|
||||
H.failed_last_breath = 0
|
||||
H.failed_last_breath = FALSE
|
||||
H.adjustOxyLoss(-5)
|
||||
gas_breathed = breath_gases["co2"][MOLES]
|
||||
H.clear_alert("not_enough_co2")
|
||||
@@ -148,20 +201,19 @@
|
||||
if(safe_toxins_max)
|
||||
if(Toxins_pp > safe_toxins_max)
|
||||
var/ratio = (breath_gases["plasma"][MOLES]/safe_toxins_max) * 10
|
||||
if(H.reagents)
|
||||
H.reagents.add_reagent("plasma", Clamp(ratio, tox_breath_dam_min, tox_breath_dam_max))
|
||||
H.throw_alert("tox_in_air", /obj/screen/alert/tox_in_air)
|
||||
H.apply_damage_type(Clamp(ratio, tox_breath_dam_min, tox_breath_dam_max), tox_damage_type)
|
||||
H.throw_alert("too_much_tox", /obj/screen/alert/too_much_tox)
|
||||
else
|
||||
H.clear_alert("tox_in_air")
|
||||
H.clear_alert("too_much_tox")
|
||||
|
||||
|
||||
//Too little toxins!
|
||||
if(safe_toxins_min)
|
||||
if(Toxins_pp < safe_toxins_min)
|
||||
gas_breathed = handle_too_little_breath(H,Toxins_pp, safe_toxins_min, breath_gases["plasma"][MOLES])
|
||||
gas_breathed = handle_too_little_breath(H, Toxins_pp, safe_toxins_min, breath_gases["plasma"][MOLES])
|
||||
H.throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox)
|
||||
else
|
||||
H.failed_last_breath = 0
|
||||
H.failed_last_breath = FALSE
|
||||
H.adjustOxyLoss(-5)
|
||||
gas_breathed = breath_gases["plasma"][MOLES]
|
||||
H.clear_alert("not_enough_tox")
|
||||
@@ -199,50 +251,56 @@
|
||||
handle_breath_temperature(breath, H)
|
||||
breath.garbage_collect()
|
||||
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/organ/lungs/proc/handle_too_little_breath(mob/living/carbon/human/H = null,breath_pp = 0, safe_breath_min = 0, true_pp = 0)
|
||||
/obj/item/organ/lungs/proc/handle_too_little_breath(mob/living/carbon/human/H = null, breath_pp = 0, safe_breath_min = 0, true_pp = 0)
|
||||
. = 0
|
||||
if(!H || !safe_breath_min) //the other args are either: Ok being 0 or Specifically handled.
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(prob(20))
|
||||
H.emote("gasp")
|
||||
if(breath_pp > 0)
|
||||
var/ratio = safe_breath_min/breath_pp
|
||||
H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all!
|
||||
H.failed_last_breath = 1
|
||||
H.failed_last_breath = TRUE
|
||||
. = true_pp*ratio/6
|
||||
else
|
||||
H.adjustOxyLoss(HUMAN_MAX_OXYLOSS)
|
||||
H.failed_last_breath = 1
|
||||
H.failed_last_breath = TRUE
|
||||
|
||||
|
||||
/obj/item/organ/lungs/proc/handle_breath_temperature(datum/gas_mixture/breath, mob/living/carbon/human/H) // called by human/life, handles temperatures
|
||||
if(abs(310.15 - breath.temperature) > 50)
|
||||
var/breath_temperature = breath.temperature
|
||||
|
||||
var/species_traits = list()
|
||||
if(H && H.dna && H.dna.species && H.dna.species.species_traits)
|
||||
species_traits = H.dna.species.species_traits
|
||||
var/species_traits = list()
|
||||
if(H && H.dna && H.dna.species && H.dna.species.species_traits)
|
||||
species_traits = H.dna.species.species_traits
|
||||
|
||||
if(!(GLOB.mutations_list[COLDRES] in H.dna.mutations) && !(RESISTCOLD in species_traits)) // COLD DAMAGE
|
||||
switch(breath.temperature)
|
||||
if(-INFINITY to 120)
|
||||
H.apply_damage(COLD_GAS_DAMAGE_LEVEL_3, BURN, "head")
|
||||
if(120 to 200)
|
||||
H.apply_damage(COLD_GAS_DAMAGE_LEVEL_2, BURN, "head")
|
||||
if(200 to 260)
|
||||
H.apply_damage(COLD_GAS_DAMAGE_LEVEL_1, BURN, "head")
|
||||
if(!(GLOB.mutations_list[COLDRES] in H.dna.mutations) && !(RESISTCOLD in species_traits)) // COLD DAMAGE
|
||||
var/cold_modifier = H.dna.species.coldmod
|
||||
if(breath_temperature < cold_level_3_threshold)
|
||||
H.apply_damage_type(cold_level_3_damage*cold_modifier, cold_damage_type)
|
||||
if(breath_temperature > cold_level_3_threshold && breath_temperature < cold_level_2_threshold)
|
||||
H.apply_damage_type(cold_level_2_damage*cold_modifier, cold_damage_type)
|
||||
if(breath_temperature > cold_level_2_threshold && breath_temperature < cold_level_1_threshold)
|
||||
H.apply_damage_type(cold_level_1_damage*cold_modifier, cold_damage_type)
|
||||
if(breath_temperature < cold_level_1_threshold)
|
||||
if(prob(20))
|
||||
to_chat(H, "<span class='warning'>You feel [cold_message] in your [name]!</span>")
|
||||
|
||||
if(!(RESISTHOT in species_traits)) // HEAT DAMAGE
|
||||
switch(breath.temperature)
|
||||
if(360 to 400)
|
||||
H.apply_damage(HEAT_GAS_DAMAGE_LEVEL_1, BURN, "head")
|
||||
if(400 to 1000)
|
||||
H.apply_damage(HEAT_GAS_DAMAGE_LEVEL_2, BURN, "head")
|
||||
if(1000 to INFINITY)
|
||||
H.apply_damage(HEAT_GAS_DAMAGE_LEVEL_3, BURN, "head")
|
||||
if(!(RESISTHOT in species_traits)) // HEAT DAMAGE
|
||||
var/heat_modifier = H.dna.species.heatmod
|
||||
if(breath_temperature > heat_level_1_threshold && breath_temperature < heat_level_2_threshold)
|
||||
H.apply_damage_type(heat_level_1_damage*heat_modifier, heat_damage_type)
|
||||
if(breath_temperature > heat_level_2_threshold && breath_temperature < heat_level_3_threshold)
|
||||
H.apply_damage_type(heat_level_2_damage*heat_modifier, heat_damage_type)
|
||||
if(breath_temperature > heat_level_3_threshold)
|
||||
H.apply_damage_type(heat_level_3_damage*heat_modifier, heat_damage_type)
|
||||
if(breath_temperature > heat_level_1_threshold)
|
||||
if(prob(20))
|
||||
to_chat(H, "<span class='warning'>You feel [hot_message] in your [name]!</span>")
|
||||
|
||||
/obj/item/organ/lungs/prepare_eat()
|
||||
var/obj/S = ..()
|
||||
|
||||
Reference in New Issue
Block a user