Files
BatrachophrenoandGitHub 088a71aacd Bugfixes (#21460)
Fixes https://github.com/Aurorastation/Aurora.3/issues/14594
Fixes https://github.com/Aurorastation/Aurora.3/issues/19524
Fixes https://github.com/Aurorastation/Aurora.3/issues/19525
Fixes https://github.com/Aurorastation/Aurora.3/issues/19554
Fixes https://github.com/Aurorastation/Aurora.3/issues/19565
Fixes https://github.com/Aurorastation/Aurora.3/issues/19669
Fixes https://github.com/Aurorastation/Aurora.3/issues/19739
Fixes https://github.com/Aurorastation/Aurora.3/issues/19751
Fixes https://github.com/Aurorastation/Aurora.3/issues/20323
Fixes https://github.com/Aurorastation/Aurora.3/issues/20530
Fixes https://github.com/Aurorastation/Aurora.3/issues/21008
Fixes https://github.com/Aurorastation/Aurora.3/issues/21370
Fixes https://github.com/Aurorastation/Aurora.3/issues/21375
Fixes https://github.com/Aurorastation/Aurora.3/issues/21438
Fixes https://github.com/Aurorastation/Aurora.3/issues/21456

changes:
- balance: "Budget insulated gloves no longer able to be manually
restocked in YouTool (random insulation coefficient reroll exploit)."
- bugfix: "Replaces missing req_access values from D3 Medical Equipment
Storage."
- bugfix: "Emitters can be rotated again (alt-click lock toggling
disabled)."
  - bugfix: "Lights no longer explode when toggled off and on."
  - bugfix: "Langchat images now pop up for untranslated speech."
  - bugfix: "Cyborgs can no longer flip Plasteel Barricades remotely."
- bugfix: "Fixes ghost vision inconsistently toggling when Following
mobs."
- bugfix: "Removes deprecated 'Gender and Pronouns' section from
Appearance Changer (has been replaced by 'Pronouns' section)."
- bugfix: "Offship locations will not print Mining Yield Declarations
saying they're from SCCV Horizon."
- bugfix: "Simple mobs which target their surroundings (destroying
tables windows etc) will not do so if inside a container."
- bugfix: "Newscaster Announcements channel now logs announcements made
by heads of staff."
- bugfix: "Held phoron- or chlorine-contaminated items will respect if
you're wearing a sealed suit or thick gloves (that is to say, if the
gloves provide fire protection)."
  - bugfix: "Fixes runtime in Electrical Storm event."
- bugfix: "Fixes some bounties returning 0 credit reward due to rounding
issues."
  - bugfix: "Removes old fusion debug vars, fixed outdated maths."
- bugfix: "Fixes Horizon kitchen alt fridge being swapped w/ empty
freezer."
- bugfix: "Fixes chameleon projector sometimes turning user invisible."
- bugfix: "You are again able to push an object currently being pulled."
- bugfix: "Command Support roles which start with flash-protective
sunglasses can now also choose them in their loadout."
  - code_imp: "Updates more code comments to DMDocs."
  - code_imp: "Corrects poison/venom for greimorian variable naming."
  - rscadd: "Adds missing fire alarm to Paramedic Quarters."
  - rscadd: "Holomap now respects and displays outer hull structure."

---------

Signed-off-by: Batrachophreno <Batrochophreno@gmail.com>
2025-10-30 18:14:42 +00:00

112 lines
4.2 KiB
Plaintext

//Common breathing procs
/// START OF THE STANDARD BREATHING CHAIN. Just handles the timing to call breathe().
/mob/living/carbon/handle_breathing()
if(SSair.times_fired%4==2 || failed_last_breath || is_asystole()) //First, resolve location and get a breath
breathe()
/// If we're a species that needs to breathe, it checks current health effects and, if we CAN breathe, checks for air from internals -> envvironment -> then runs handle_breath() and handle_post_breath().
/mob/living/carbon/proc/breathe(var/volume_needed = BREATH_VOLUME)
if(species && (species.flags & NO_BREATHE))
return
if(HAS_TRAIT(src, TRAIT_PRESSURE_IMMUNITY))
return
volume_needed *= (species?.breath_vol_mul || 1)
var/datum/gas_mixture/breath = null
//First, check if we can breathe at all
if(is_asystole() && !(CE_STABLE in chem_effects)) //crit aka circulatory shock
losebreath = max(2, losebreath + 1)
if(losebreath>0) //Suffocating so do not take a breath
losebreath--
if (prob(10) && !isipc(src) && !is_asystole()) //Gasp per 10 ticks? Sounds about right.
emote("gasp")
else
//Okay, we can breathe, now check if we can get air
breath = get_breath_from_internal(volume_needed) //First, check for air from internals
if(!breath)
breath = get_breath_from_environment(volume_needed) //No breath from internals so let's try to get air from our location
// Passing the gas mixture to the lungs, if they exist.
handle_breath(breath)
// Handling exhalation.
handle_post_breath(breath)
/mob/living/carbon/proc/get_breath_from_internal(var/volume_needed=BREATH_VOLUME) //hopefully this will allow overrides to specify a different default volume without breaking any cases where volume is passed in.
if(internal)
if (!contents.Find(internal))
internal = null
if (!(wear_mask && (wear_mask.item_flags & ITEM_FLAG_AIRTIGHT)))
internal = null
if(internal)
if (internals)
internals.icon_state = "internal1"
return internal.remove_air_volume(volume_needed)
else
if (internals)
internals.icon_state = "internal0"
return null
/mob/living/carbon/proc/get_breath_from_environment(var/volume_needed=BREATH_VOLUME)
var/datum/gas_mixture/breath = null
var/datum/gas_mixture/environment
if(loc)
environment = loc.return_air_for_internal_lifeform(src)
if(environment)
breath = environment.remove_volume(volume_needed)
handle_chemical_smoke(environment) //handle chemical smoke while we're at it
if(breath && breath.total_moles)
//handle mask filtering
if(istype(wear_mask, /obj/item/clothing/mask) && breath)
var/obj/item/clothing/mask/M = wear_mask
var/datum/gas_mixture/filtered = M.filter_air(breath)
loc.assume_air(filtered)
return breath
return null
/mob/living/carbon/proc/handle_breath(datum/gas_mixture/breath)
return
/mob/living/carbon/proc/handle_post_breath(datum/gas_mixture/breath)
if(!breath)
return
loc.assume_air(breath) //exhale into the environment
// END OF THE STANDARD BREATHING CHAIN
/// Handles chemical inhalation effects (trans_to_mob(), also search CHEM_BREATHE).
/mob/living/carbon/proc/inhale(var/datum/reagents/from, var/datum/reagents/target, var/amount = 1, var/multiplier = 1, var/copy = 0, var/bypass_checks = FALSE)
if(species && (species.flags & NO_BREATHE)) //Check for species
return 0
if(!bypass_checks)
if(wear_mask && wear_mask.item_flags & ITEM_FLAG_BLOCK_GAS_SMOKE_EFFECT) //Check if the gasmask blocks an effect
return 0
if (internals && internals.icon_state == "internal1") //Check for internals
return 0
return from.trans_to_holder(target,amount,multiplier,copy) //complete transfer
//Handle possble chem smoke effect
/mob/living/carbon/proc/handle_chemical_smoke(var/datum/gas_mixture/environment)
if(species && environment.return_pressure() < species.breath_pressure/5)
return //pressure is too low to even breathe in.
if(wear_mask && (wear_mask.item_flags & ITEM_FLAG_BLOCK_GAS_SMOKE_EFFECT))
return
for(var/obj/effect/smoke/chem/smoke in view(1, src))
if(smoke.reagents.total_volume)
smoke.reagents.trans_to_mob(src, 5, CHEM_INGEST, copy = 1)
smoke.reagents.trans_to_mob(src, 5, CHEM_TOUCH, copy = 1)
smoke.reagents.trans_to_mob(src, 5, CHEM_BREATHE, copy = 1)
// I dunno, maybe the reagents enter the blood stream through the lungs?
// ^ HA HA HA HA
break