Merge pull request #2335 from Yoshax/lungfix

Actually fixes lung rupturing and does so with less runtimes
This commit is contained in:
Neerti
2016-08-16 15:06:15 -04:00
committed by GitHub
6 changed files with 65 additions and 6 deletions

View File

@@ -24,6 +24,11 @@
breath = get_breath_from_internal() //First, check for air from internals
if(!breath)
breath = get_breath_from_environment() //No breath from internals so let's try to get air from our location
if(!breath)
var/static/datum/gas_mixture/vacuum //avoid having to create a new gas mixture for each breath in space
if(!vacuum) vacuum = new
breath = vacuum //still nothing? must be vacuum
handle_breath(breath)
handle_post_breath(breath)

View File

@@ -932,9 +932,8 @@
/mob/living/carbon/human/proc/rupture_lung()
var/obj/item/organ/internal/lungs/L = internal_organs_by_name[O_LUNGS]
if(L && !L.is_bruised())
src.custom_pain("You feel a stabbing pain in your chest!", 1)
L.damage = L.min_bruised_damage
if(L)
L.rupture()
/*
/mob/living/carbon/human/verb/simulate()

View File

@@ -343,12 +343,22 @@
else
adjustOxyLoss(HUMAN_CRIT_MAX_OXYLOSS)
if(should_have_organ(O_LUNGS))
var/obj/item/organ/internal/lungs/L = internal_organs_by_name[O_LUNGS]
if(!L.is_bruised() && prob(5))
if(breath.total_moles)
if(breath.total_moles < BREATH_MOLES / 5 || breath.total_moles > BREATH_MOLES * 5)
rupture_lung()
else
rupture_lung()
oxygen_alert = max(oxygen_alert, 1)
return 0
var/safe_pressure_min = 16 // Minimum safe partial pressure of breathable gas in kPa
// Lung damage increases the minimum safe pressure.
if(should_have_organ(O_LUNGS))
var/obj/item/organ/internal/lungs/L = internal_organs_by_name[O_LUNGS]

View File

@@ -18,9 +18,15 @@
owner.emote("cough") //respitory tract infection
if(is_bruised())
if(prob(2))
if(prob(4))
spawn owner.emote("me", 1, "coughs up blood!")
owner.drip(10)
if(prob(4))
if(prob(8))
spawn owner.emote("me", 1, "gasps for air!")
owner.losebreath += 15
owner.losebreath += 15
/obj/item/organ/internal/lungs/proc/rupture()
var/obj/item/organ/external/parent = owner.get_organ(parent_organ)
if(istype(parent))
owner.custom_pain("You feel a stabbing pain in your [parent.name]!", 1)
bruise()

View File

@@ -247,6 +247,9 @@ var/list/organ_cache = list()
if(parent && !silent)
owner.custom_pain("Something inside your [parent.name] hurts a lot.", 1)
/obj/item/organ/proc/bruise()
damage = max(damage, min_bruised_damage)
/obj/item/organ/proc/robotize() //Being used to make robutt hearts, etc
robotic = ORGAN_ROBOT
src.status &= ~ORGAN_BROKEN