Refactor Lung Handling
This commit is contained in:
@@ -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"])
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user