diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 0a8e0b44dd..c8d17cd63b 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -19,6 +19,7 @@ var/can_defib = 1 //Horrible damage (like beheadings) will prevent defibbing organics. var/active_regen = FALSE //Used for the regenerate proc in human_powers.dm var/active_regen_delay = 300 + var/last_breath_sound // Feels weird doing this, but allows us to store the value across proc calls per-mob. /mob/living/carbon/human/Initialize(mapload, var/new_species = null) if(!dna) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 124401844d..dcf1b26176 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -563,6 +563,16 @@ else failed_last_breath = 0 adjustOxyLoss(-5) + + if(!does_not_breathe && client) // If we breathe, and have an active client, check if we have synthetic lungs. + var/obj/item/organ/internal/lungs/L = internal_organs_by_name[O_LUNGS] + var/turf = get_turf(src) + var/mob/living/carbon/human/M = src + if(L.robotic < ORGAN_ROBOT && is_below_sound_pressure(turf) && M.internal) // Only non-synthetic lungs, please, and only play these while the pressure is below that which we can hear sounds normally AND we're on internals. + if(!failed_inhale && (world.time >= (last_breath_sound + 7 SECONDS))) // Were we able to inhale successfully? Play inhale. + var/exhale = failed_exhale // Pass through if we passed exhale or not + play_inhale(M, exhale) + last_breath_sound = world.time // Hot air hurts :( @@ -629,6 +639,26 @@ breath.update_values() return 1 + +/mob/living/carbon/human/proc/play_inhale(var/mob/living/M, var/exhale) + var/suit_inhale_sound + if(species.suit_inhale_sound) + suit_inhale_sound = species.suit_inhale_sound + else // Failsafe + suit_inhale_sound = 'sound/effects/mob_effects/suit_breathe_in.ogg' + + playsound_local(get_turf(src), suit_inhale_sound, 100, pressure_affected = FALSE, volume_channel = VOLUME_CHANNEL_AMBIENCE) + if(!exhale) // Did we fail exhale? If no, play it after inhale finishes. + addtimer(CALLBACK(src, .proc/play_exhale, M), 5 SECONDS) + +/mob/living/carbon/human/proc/play_exhale(var/mob/living/M) + var/suit_exhale_sound + if(species.suit_exhale_sound) + suit_exhale_sound = species.suit_exhale_sound + else // Failsafe + suit_exhale_sound = 'sound/effects/mob_effects/suit_breathe_out.ogg' + + playsound_local(get_turf(src), suit_exhale_sound, 100, pressure_affected = FALSE, volume_channel = VOLUME_CHANNEL_AMBIENCE) /mob/living/carbon/human/handle_environment(datum/gas_mixture/environment) if(!environment) diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 7639edcf70..0a7189e54b 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -129,6 +129,8 @@ var/breath_type = "oxygen" // Non-oxygen gas breathed, if any. var/poison_type = "phoron" // Poisonous air. var/exhale_type = "carbon_dioxide" // Exhaled gas type. + var/suit_inhale_sound = 'sound/effects/mob_effects/suit_breathe_in.ogg' + var/suit_exhale_sound = 'sound/effects/mob_effects/suit_breathe_out.ogg' var/body_temperature = 310.15 // Species will try to stabilize at this temperature. (also affects temperature processing) diff --git a/sound/effects/mob_effects/suit_breathe_in.ogg b/sound/effects/mob_effects/suit_breathe_in.ogg new file mode 100644 index 0000000000..945959e0ab Binary files /dev/null and b/sound/effects/mob_effects/suit_breathe_in.ogg differ diff --git a/sound/effects/mob_effects/suit_breathe_out.ogg b/sound/effects/mob_effects/suit_breathe_out.ogg new file mode 100644 index 0000000000..14f444b71e Binary files /dev/null and b/sound/effects/mob_effects/suit_breathe_out.ogg differ