mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 12:29:46 +01:00
Makes sounds with a low enough volume only audible within line of sight (#6515)
It has been posited that it doesn't make sense to hear certain sounds through walls. So, I proceeded to go and change that. All sounds with a volume of 50 or less will now be played only to the "hearers" list. This is basically people within line of sight. I also rewrote the lower levels of the sound API with this. The code is now more modular, while retaining the same main API entry point playsound. This needs a test merge to see how badly I broke shit.
This commit is contained in:
@@ -108,7 +108,6 @@ var/datum/controller/subsystem/explosives/SSexplosives
|
||||
// 3/7/14 will calculate to 80 + 35
|
||||
var/volume = 10 + (power * 20)
|
||||
|
||||
var/frequency = get_rand_frequency()
|
||||
var/closedist = round(max_range + world.view - 2, 1)
|
||||
|
||||
//Whether or not this explosion causes enough vibration to send sound or shockwaves through the station
|
||||
@@ -150,11 +149,11 @@ var/datum/controller/subsystem/explosives/SSexplosives
|
||||
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)
|
||||
M.playsound_local(epicenter, get_sfx("explosion"), min(100, volume), 1, frequency, falloff = 5) // get_sfx() is so that everyone gets the same sound
|
||||
M.playsound_simple(epicenter, get_sfx("explosion"), 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_local(epicenter, 'sound/effects/explosionfar.ogg', volume, 1, frequency, usepressure = 0, falloff = 1000)
|
||||
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
|
||||
@@ -312,7 +311,6 @@ var/datum/controller/subsystem/explosives/SSexplosives
|
||||
|
||||
var/volume = 10 + (power * 20)
|
||||
|
||||
var/frequency = get_rand_frequency()
|
||||
var/close_dist = round(power + world.view - 2, 1)
|
||||
|
||||
var/sound/explosion_sound = sound(get_sfx("explosion"))
|
||||
@@ -345,10 +343,10 @@ var/datum/controller/subsystem/explosives/SSexplosives
|
||||
var/dist = get_dist(M, epicenter) || 1
|
||||
if ((reception & EXPLFX_SOUND) && M.ear_deaf <= 0)
|
||||
if (dist <= close_dist)
|
||||
M.playsound_local(epicenter, explosion_sound, min(100, volume), 1, frequency, falloff = 5)
|
||||
M.playsound_simple(epicenter, 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_local(epicenter, 'sound/effects/explosionfar.ogg', volume, 1, frequency, usepressure = 0, falloff = 1000)
|
||||
volume = M.playsound_simple(epicenter, 'sound/effects/explosionfar.ogg', volume, use_random_freq = TRUE, falloff = 1000, use_pressure = FALSE)
|
||||
|
||||
if ((reception & EXPLFX_SHAKE) && volume > 0)
|
||||
shake_camera(M, min(30, max(2,(power*2) / dist)), min(3.5, ((power/3) / dist)),0.05)
|
||||
|
||||
Reference in New Issue
Block a user