diff --git a/code/game/machinery/bots/medbot.dm b/code/game/machinery/bots/medbot.dm index be4d32be6b2..7b53d58c808 100644 --- a/code/game/machinery/bots/medbot.dm +++ b/code/game/machinery/bots/medbot.dm @@ -29,7 +29,7 @@ var/last_found = 0 var/last_newpatient_speak = 0 //Don't spam the "HEY I'M COMING" messages var/currently_healing = 0 - var/injection_amount = 15 //How much reagent do we inject at a time? + var/injection_amount = 5 //How much reagent do we inject at a time? var/heal_threshold = 15 //Start healing when they have this much damage in a category var/use_beaker = 1 //Use reagents in beaker instead of default treatment agents. //Setting which reagents to use to treat what by default. By id. @@ -375,25 +375,21 @@ if((src.use_beaker) && (src.reagent_glass) && (src.reagent_glass.reagents.total_volume)) if(always_inject) reagent_id = "internal_beaker" - else if (C.getBruteLoss() >= heal_threshold) - if(C.reagents.has_reagent(src.treatment_brute)) - reagent_id = "internal_beaker" + else if (C.getBruteLoss() >= heal_threshold && reagent_glass.reagents.has_reagent(src.treatment_brute)) + reagent_id = "internal_beaker" - else if (C.getOxyLoss() >= (15 + heal_threshold)) - if(C.reagents.has_reagent(src.treatment_oxy)) - reagent_id = "internal_beaker" + else if (C.getOxyLoss() >= (15 + heal_threshold) && reagent_glass.reagents.has_reagent(src.treatment_oxy)) + reagent_id = "internal_beaker" - else if (C.getFireLoss() >= heal_threshold) - if(C.reagents.has_reagent(src.treatment_fire)) - reagent_id = "internal_beaker" + else if (C.getFireLoss() >= heal_threshold && reagent_glass.reagents.has_reagent(src.treatment_fire)) + reagent_id = "internal_beaker" - else if (C.getToxLoss() >= heal_threshold) - if(C.reagents.has_reagent(src.treatment_tox)) - reagent_id = "internal_beaker" + else if (C.getToxLoss() >= heal_threshold && reagent_glass.reagents.has_reagent(src.treatment_tox)) + reagent_id = "internal_beaker" + + else if (100 - C.health >= heal_threshold && reagent_glass.reagents.has_reagent("tricordrazine")) + reagent_id = "internal_beaker" - else if (100 - C.health >= heal_threshold) - if(C.reagents.has_reagent("tricordrazine")) - reagent_id = "internal_beaker" if(src.emagged) //Emagged! Time to poison everybody. reagent_id = "toxin" @@ -425,8 +421,6 @@ reagent_id = "inaprovaline" return -// src.speak(reagent_id) - reagent_id = null return diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index c04042c9066..5c505b5fcd4 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -317,6 +317,15 @@ //As close as I could find to where to put it grav_delay = max(grav_delay-3,0) + /** Overview of breathing code: + - first it's determined whether the human is capable of breathing + - then it's determined whether the human is holding his breath intentionally + - the isbreathing variable is set according to this + + - next, we look for any air that the mob could breathe, first internals, then in the air around him + - if the human isn't breathing, it counts as vacuum + - then we check if the air we found is breathable, if not, we inflict oxygen damage + **/ breathe() if(reagents.has_reagent("lexorin")) return @@ -324,25 +333,15 @@ var/datum/gas_mixture/environment = loc.return_air() var/datum/air_group/breath + // HACK NEED CHANGING LATER - if(health < config.health_threshold_dead) - losebreath++ - isbreathing = 0 + if(isbreathing && health < config.health_threshold_crit) spawn emote("stopbreath") + isbreathing = 0 if(holdbreath) isbreathing = 0 - if(losebreath > 0) - // inaprovaline prevents the need to breathe for a while - if(reagents.has_reagent("inaprovaline")) - losebreath = 0 - else - losebreath-- - // we're running out of air, gasp for it! - if (prob(25)) //High chance of gasping for air - spawn emote("gasp") - isbreathing = 0 - else if(health >= 0 && !isbreathing) + else if(health >= config.health_threshold_crit && !isbreathing) if(holdbreath) // we're simply holding our breath, see if we can hold it longer if(health < 30) @@ -434,6 +433,8 @@ oxygen_alert = max(oxygen_alert, 1) + if(isbreathing && prob(20)) spawn(0) emote("gasp") + return 0 var/safe_oxygen_min = 16 // Minimum safe partial pressure of O2, in kPa @@ -454,7 +455,7 @@ //var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*0.5 // The default pressure value if(O2_pp < safe_oxygen_min) // Too little oxygen - if(prob(20)) + if(prob(20) && isbreathing) spawn(0) emote("gasp") if(O2_pp > 0) var/ratio = safe_oxygen_min/O2_pp @@ -485,7 +486,7 @@ oxyloss += 3 // Lets hurt em a little, let them know we mean business if(world.time - co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good! oxyloss += 8 - if(prob(20)) // Lets give them some chance to know somethings not right though I guess. + if(prob(20) && isbreathing) // Lets give them some chance to know somethings not right though I guess. spawn(0) emote("cough") else @@ -506,7 +507,7 @@ if(SA_pp > SA_sleep_min) // Enough to make us sleep as well sleeping = max(sleeping, 2) else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning - if(prob(20)) + if(prob(20) && isbreathing) spawn(0) emote(pick("giggle", "laugh")) SA.moles = 0 //Hack to stop the damned surgeon from giggling. @@ -830,9 +831,6 @@ else if(health < config.health_threshold_crit) if(health <= 20 && prob(1)) spawn(0) emote("gasp") - //if(!rejuv) oxyloss++ - if(!reagents.has_reagent("inaprovaline")) oxyloss++ - if(stat != 2) stat = 1 Paralyse(5)