Merge pull request #7875 from Fox-McCloud/sound-update

Sound Update/Refactor
This commit is contained in:
Crazy Lemon
2017-08-01 22:09:46 -07:00
committed by GitHub
18 changed files with 124 additions and 121 deletions
+8 -14
View File
@@ -40,7 +40,11 @@
if(!silent)
var/frequency = get_rand_frequency()
for(var/mob/M in player_list)
var/sound/explosion_sound = sound(get_sfx("explosion"))
var/sound/global_boom = sound('sound/effects/explosionfar.ogg')
for(var/P in player_list)
var/mob/M = P
// Double check for client
if(M && M.client)
var/turf/M_turf = get_turf(M)
@@ -48,20 +52,10 @@
var/dist = get_dist(M_turf, epicenter)
// If inside the blast radius + world.view - 2
if(dist <= round(max_range + world.view - 2, 1))
M.playsound_local(epicenter, get_sfx("explosion"), 100, 1, frequency, falloff = 5) // get_sfx() is so that everyone gets the same sound
M.playsound_local(epicenter, null, 100, 1, frequency, falloff = 5, S = explosion_sound)
// You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station.
else if(dist <= far_dist)
var/far_volume = Clamp(far_dist, 30, 50) // Volume is based on explosion size and dist
far_volume += (dist <= far_dist * 0.5 ? 50 : 0) // add 50 volume if the mob is pretty close to the explosion
M.playsound_local(epicenter, 'sound/effects/explosionfar.ogg', far_volume, 1, frequency, falloff = 5)
var/close = range(world.view+round(devastation_range,1), epicenter)
// to all distanced mobs play a different sound
for(var/mob/M in world)
if(M.z == epicenter.z && !(M in close))
// check if the mob can hear
if(M.can_hear() && !istype(M.loc,/turf/space))
M << 'sound/effects/explosionfar.ogg'
else if(M.can_hear() && !isspaceturf(M.loc))
M << global_boom
if(heavy_impact_range > 1)
if(smoke)
+2 -1
View File
@@ -57,10 +57,11 @@
return
// and play
var/turf/source = get_turf(instrumentObj)
var/sound/music_played = sound(soundfile)
for(var/mob/M in hearers(15, source))
if(!M.client || !(M.client.prefs.sound & SOUND_INSTRUMENTS))
continue
M.playsound_local(source, soundfile, 100, falloff = 5)
M.playsound_local(source, null, 100, falloff = 5, S = music_played)
/datum/song/proc/shouldStopPlaying(mob/user)
if(instrumentObj)