Adds Asthma (#4723)

Sprinting no longer deals oxygen damage unless you have lung damage or asthma. Sprinting is now based off of both halloss and oxyloss.

Lung damage now causes both oxygen damage and halloss when you sprint past your threshold.

Coughing disability now causes halloss when you sprint past your threshold.

Adds asthma, which causes oxygen damage when you sprint past your threshold, and inhibits your ability to recover from oxygen naturally. It also makes you cough harmlessly when you have more than 10 oxygen damage.
This commit is contained in:
LordFowl
2018-05-26 16:54:25 -04:00
committed by Erki
parent ada64e7aeb
commit 33b46e8b14
5 changed files with 79 additions and 7 deletions

View File

@@ -54,4 +54,14 @@
desc = "You are unable to percieve sound."
/datum/character_disabilities/deaf/apply_self(var/mob/living/carbon/human/H)
H.sdisabilities |= DEAF
H.sdisabilities |= DEAF
/datum/character_disabilities/asthma
name = "Asthma"
desc = "You are prone to inflammation in the lungs."
/datum/character_disabilities/asthma/apply_self(var/mob/living/carbon/human/H)
H.disabilities |= ASTHMA
if(H.max_stamina)
H.max_stamina *= 0.8
H.stamina = H.max_stamina

View File

@@ -202,6 +202,11 @@
spawn( 0 )
emote("cough")
return
if((disabilities & ASTHMA) && getOxyLoss() >= 10)
if(prob(5))
emote("cough")
if (disabilities & TOURETTES)
speech_problem_flag = 1
if ((prob(10) && paralysis <= 1))
@@ -549,7 +554,10 @@
failed_last_breath = 1
else
failed_last_breath = 0
adjustOxyLoss(-5)
if(disabilities & ASTHMA)
adjustOxyLoss(rand(-5,0))
else
adjustOxyLoss(-5)
// Hot air hurts :(
@@ -1627,7 +1635,8 @@
if (!exhaust_threshold) // Also quit if there's no exhaust threshold specified, because division by 0 is amazing.
return
if (failed_last_breath || oxyloss > exhaust_threshold)//Can't catch our breath if we're suffocating
if (failed_last_breath || (oxyloss + halloss) > exhaust_threshold)//Can't catch our breath if we're suffocating
flash_pain()
return
if (nutrition <= 0)
@@ -1638,7 +1647,7 @@
if (stamina != max_stamina)
//Any suffocation damage slows stamina regen.
//This includes oxyloss from low blood levels
var/regen = stamina_recovery * (1 - min(((oxyloss*2) / exhaust_threshold), 1))
var/regen = stamina_recovery * (1 - min(((oxyloss) / exhaust_threshold) + ((halloss) / exhaust_threshold), 1))
if (regen > 0)
stamina = min(max_stamina, stamina+regen)
nutrition = max(0, nutrition - stamina_recovery*0.18)

View File

@@ -450,16 +450,30 @@
else
remainder = cost
H.adjustOxyLoss(remainder*0.25)
if(H.disabilities & ASTHMA)
H.adjustOxyLoss(remainder*0.15)
if(H.disabilities & COUGHING)
H.adjustHalLoss(remainder*0.1)
if (breathing_organ && has_organ[breathing_organ])
var/obj/item/organ/O = H.internal_organs_by_name[breathing_organ]
if(O.is_bruised())
H.adjustOxyLoss(remainder*0.15)
H.adjustHalLoss(remainder*0.25)
H.adjustHalLoss(remainder*0.25)
H.updatehealth()
H.update_oxy_overlay()
if((H.halloss >= 10) && prob(H.halloss*2))
H.flash_pain()
if (H.oxyloss >= (exhaust_threshold * 0.8))
if ((H.halloss + H.oxyloss) >= (exhaust_threshold * 0.8))
H.m_intent = "walk"
H.hud_used.move_intent.update_move_icon(H)
H << span("danger", "You're too exhausted to run anymore!")
H.flash_pain()
return 0
H.hud_used.move_intent.update_move_icon(H)
return 1