Adds sensitive hearing (#12151)

This commit is contained in:
Casper3667
2021-10-15 19:02:12 +02:00
committed by GitHub
parent 781ca0dd26
commit fb13f6615f
46 changed files with 330 additions and 59 deletions
+26 -5
View File
@@ -150,16 +150,37 @@ 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
var/explosion_dir = angle2text(Get_Angle(M_turf, epicenter))
if (reception == 2 && (M.ear_deaf <= 0 || !M.ear_deaf)) //Dont play sounds to deaf people
// Anyone with sensitive hearing gets a bonus to hearing explosions
var/extendeddist = closedist
if(ishuman(M))
var/mob/living/carbon/human/H = M
var/hearing_sensitivity = H.get_hearing_sensitivity()
if (hearing_sensitivity)
if(H.is_listening())
if (hearing_sensitivity == HEARING_VERY_SENSITIVE)
extendeddist *= 2
else
extendeddist = round(closedist *= 1.5, 1)
else
if (hearing_sensitivity == HEARING_VERY_SENSITIVE)
extendeddist *= 1.5
else
extendeddist = round(closedist *= 1.2, 1)
// 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)].")))
if (dist <= closedist)
to_chat(M, FONT_LARGE(SPAN_WARNING("You hear the sound of a nearby explosion coming from \the [explosion_dir].")))
M.playsound_simple(epicenter, get_sfx(/decl/sound_category/explosion_sound), min(100, volume), use_random_freq = TRUE, falloff = 5)
else if (dist > closedist && dist <= extendeddist) // People with sensitive hearing get a better idea of how far it is
to_chat(M, FONT_LARGE(SPAN_WARNING("You hear the sound of a semi-close explosion coming from \the [explosion_dir].")))
M.playsound_simple(epicenter, get_sfx(/decl/sound_category/explosion_sound), min(100, volume), use_random_freq = TRUE, falloff = 5)
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)].")))
to_chat(M, FONT_LARGE(SPAN_NOTICE("You hear the sound of a distant explosion coming from \the [explosion_dir].")))
//Deaf people will feel vibrations though
if (volume > 0)//Only shake camera if someone was close enough to hear it