Refactor Lung Handling (#29280)

* Refactor Lung Handling

* fix ups

* fixes
This commit is contained in:
Fox McCloud
2017-07-18 10:58:23 -04:00
committed by Jordan Brown
parent 3e4d5139d9
commit c10c9442a5
12 changed files with 163 additions and 83 deletions
@@ -36,6 +36,8 @@
adjustCloneLoss(damage * hit_percent)
if(STAMINA)
adjustStaminaLoss(damage * hit_percent)
if(BRAIN)
adjustBrainLoss(damage * hit_percent)
return 1
+3 -1
View File
@@ -98,11 +98,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
@@ -1331,6 +1331,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)
+6 -7
View File
@@ -110,7 +110,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
@@ -141,14 +141,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
@@ -171,11 +171,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"])
+9 -1
View File
@@ -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
+1 -1
View File
@@ -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)