From 6c21fc71b7651c9c8bc94cfa9d8429459fff1503 Mon Sep 17 00:00:00 2001 From: Geeves Date: Sat, 3 Apr 2021 06:18:19 +0200 Subject: [PATCH] Explosions for the Deaf (#11454) --- code/controllers/subsystems/explosives.dm | 13 ++++++------- code/game/sound.dm | 3 +-- html/changelogs/geeves-explosions_for_the_deaf.yml | 7 +++++++ 3 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 html/changelogs/geeves-explosions_for_the_deaf.yml diff --git a/code/controllers/subsystems/explosives.dm b/code/controllers/subsystems/explosives.dm index 25c206fe89a..ebbad2cb581 100644 --- a/code/controllers/subsystems/explosives.dm +++ b/code/controllers/subsystems/explosives.dm @@ -150,17 +150,16 @@ var/datum/controller/subsystem/explosives/SSexplosives continue var/dist = get_dist(M_turf, epicenter) + var/explosion_dir = get_dir(M_turf, epicenter) if (reception == 2 && (M.ear_deaf <= 0 || !M.ear_deaf))//Dont play sounds to deaf people // If inside the blast radius + world.view - 2 if(dist <= closedist) + to_chat(M, FONT_LARGE(SPAN_WARNING("You hear the sound of a nearby explosion coming from \the [dir2text(explosion_dir)]."))) M.playsound_simple(epicenter, get_sfx(/decl/sound_category/explosion_sound), min(100, volume), use_random_freq = TRUE, falloff = 5) - //You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station. - - else - volume = M.playsound_simple(epicenter, 'sound/effects/explosionfar.ogg', volume, use_random_freq = TRUE, falloff = 1000, use_pressure = FALSE) - //Playsound local will return the final volume the sound is actually played at - //It will return 0 if the sound volume falls to 0 due to falloff or pressure - //Also return zero if sound playing failed for some other reason + else //You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station. + volume = M.playsound_simple(epicenter, 'sound/effects/explosionfar.ogg', volume, use_random_freq = TRUE, falloff = 1000, use_pressure = TRUE) + if(volume) + to_chat(M, FONT_LARGE(SPAN_NOTICE("You hear the sound of a distant explosion coming from \the [dir2text(explosion_dir)]."))) //Deaf people will feel vibrations though if (volume > 0)//Only shake camera if someone was close enough to hear it diff --git a/code/game/sound.dm b/code/game/sound.dm index 14c7ef8b139..e77352430ae 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -229,8 +229,7 @@ /mob/proc/playsound_simple(source, soundin, volume, use_random_freq = FALSE, frequency = 0, falloff = 0, use_pressure = TRUE, required_preferences = 0, required_asfx_toggles = 0) var/sound/S = playsound_get_sound(soundin, volume, falloff, frequency) - - playsound_to(source ? get_turf(source) : null, S, use_random_freq, use_pressure = use_pressure, required_preferences = required_preferences, required_asfx_toggles = required_asfx_toggles) + return playsound_to(source ? get_turf(source) : null, S, use_random_freq, use_pressure = use_pressure, required_preferences = required_preferences, required_asfx_toggles = required_asfx_toggles) /client/proc/playtitlemusic() if(!SSticker.login_music) diff --git a/html/changelogs/geeves-explosions_for_the_deaf.yml b/html/changelogs/geeves-explosions_for_the_deaf.yml new file mode 100644 index 00000000000..2d503001728 --- /dev/null +++ b/html/changelogs/geeves-explosions_for_the_deaf.yml @@ -0,0 +1,7 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Added a text output to explosions, they will now state if it's near or far, and from which direction it's coming. Sorry it took so long, deaf people." + - tweak: "Distant explosions now take pressure into account. Dropping a drill outside the station will no longer play an explosion sound for people inside." \ No newline at end of file