mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-21 07:32:35 +00:00
Breathing Sounds While in Space
Upstream port of https://github.com/CHOMPStation2/CHOMPStation2/pull/3831 Plays a breathing sound akin to Bay's breathing sound while you're in space. Major difference (codewise) is the ability to set an inhale + exhale sound, and it is currently designed SOLELY to be heard while in space. Keep inhale + exhale combined to 7 seconds or less if you add custom sounds. The code DOES support custom breathing per-species, if you see fit to add that for w/e reason. Any internals playing breathing sounds later on may be looked at, but for now, this gets breathing working. Does not come with a pref currently, as it's quiet - and intended to be an audible indicator of if you're breathing or not. (IE if you don't hear it, be concerned.)
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
var/can_defib = 1 //Horrible damage (like beheadings) will prevent defibbing organics.
|
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 = FALSE //Used for the regenerate proc in human_powers.dm
|
||||||
var/active_regen_delay = 300
|
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)
|
/mob/living/carbon/human/Initialize(mapload, var/new_species = null)
|
||||||
if(!dna)
|
if(!dna)
|
||||||
|
|||||||
@@ -564,6 +564,15 @@
|
|||||||
failed_last_breath = 0
|
failed_last_breath = 0
|
||||||
adjustOxyLoss(-5)
|
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]
|
||||||
|
if(L.robotic < ORGAN_ROBOT && (istype(get_turf(src), /turf/space))) // Only non-synthetic lungs, please, and only play these while we're in space.
|
||||||
|
if(!failed_inhale && (world.time >= (last_breath_sound + 7 SECONDS))) // Were we able to inhale successfully? Play inhale.
|
||||||
|
var/mob/living/carbon/human/M = src
|
||||||
|
var/exhale = failed_exhale // Pass through if we passed exhale or not
|
||||||
|
play_inhale(M, exhale)
|
||||||
|
last_breath_sound = world.time
|
||||||
|
|
||||||
|
|
||||||
// Hot air hurts :(
|
// Hot air hurts :(
|
||||||
if((breath.temperature <= species.cold_discomfort_level || breath.temperature >= species.heat_discomfort_level) && !(COLD_RESISTANCE in mutations))
|
if((breath.temperature <= species.cold_discomfort_level || breath.temperature >= species.heat_discomfort_level) && !(COLD_RESISTANCE in mutations))
|
||||||
@@ -630,6 +639,26 @@
|
|||||||
breath.update_values()
|
breath.update_values()
|
||||||
return 1
|
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'
|
||||||
|
|
||||||
|
M << sound(suit_inhale_sound,0,0,0,100)
|
||||||
|
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'
|
||||||
|
|
||||||
|
M << sound(suit_exhale_sound,0,0,0,100)
|
||||||
|
|
||||||
/mob/living/carbon/human/handle_environment(datum/gas_mixture/environment)
|
/mob/living/carbon/human/handle_environment(datum/gas_mixture/environment)
|
||||||
if(!environment)
|
if(!environment)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -129,6 +129,8 @@
|
|||||||
var/breath_type = "oxygen" // Non-oxygen gas breathed, if any.
|
var/breath_type = "oxygen" // Non-oxygen gas breathed, if any.
|
||||||
var/poison_type = "phoron" // Poisonous air.
|
var/poison_type = "phoron" // Poisonous air.
|
||||||
var/exhale_type = "carbon_dioxide" // Exhaled gas type.
|
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)
|
var/body_temperature = 310.15 // Species will try to stabilize at this temperature. (also affects temperature processing)
|
||||||
|
|
||||||
|
|||||||
BIN
sound/effects/mob_effects/suit_breathe_in.ogg
Normal file
BIN
sound/effects/mob_effects/suit_breathe_in.ogg
Normal file
Binary file not shown.
BIN
sound/effects/mob_effects/suit_breathe_out.ogg
Normal file
BIN
sound/effects/mob_effects/suit_breathe_out.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user