From 17fd5d6cdc645df34781cb390fe0a317d7dcb8bd Mon Sep 17 00:00:00 2001 From: Giacomand Date: Thu, 21 Nov 2013 23:50:53 +0000 Subject: [PATCH] * Fixes certain objects not using 3D sounds. * Gave the piano a bigger falloff. * Capped the sound x/z to 7. --- code/game/objects/structures/musician.dm | 2 +- code/game/sound.dm | 18 ++++++++++-------- code/modules/telesci/telesci_computer.dm | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/code/game/objects/structures/musician.dm b/code/game/objects/structures/musician.dm index f9c3af20b00..02d1dc63834 100644 --- a/code/game/objects/structures/musician.dm +++ b/code/game/objects/structures/musician.dm @@ -50,7 +50,7 @@ // and play var/turf/source = get_turf(instrumentObj) for(var/mob/M in hearers(15, source)) - M.playsound_local(source, file(soundfile), 100, falloff = 2) + M.playsound_local(source, file(soundfile), 100, falloff = 5) /datum/song/proc/updateDialog(mob/user as mob) instrumentObj.updateDialog() // assumes it's an object in world, override if otherwise diff --git a/code/game/sound.dm b/code/game/sound.dm index 2cbdc1fe399..c2f9e9fca02 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -1,4 +1,4 @@ -/proc/playsound(var/atom/source, soundin, vol as num, vary, extrarange as num) +/proc/playsound(var/atom/source, soundin, vol as num, vary, extrarange as num, falloff) soundin = get_sfx(soundin) // same sound for everyone @@ -16,9 +16,10 @@ var/turf/T = get_turf(M) if(T && T.z == source.z) if(get_dist(T, source) <= world.view + extrarange) - M.playsound_local(source, soundin, vol, vary, frequency) + M.playsound_local(source, soundin, vol, vary, frequency, falloff) var/const/FALLOFF_SOUNDS = 1 +var/const/SURROUND_CAP = 7 /mob/proc/playsound_local(var/atom/source, soundin, vol as num, vary, frequency, falloff) if(!src.client || ear_deaf > 0) return @@ -35,18 +36,19 @@ var/const/FALLOFF_SOUNDS = 1 else S.frequency = get_rand_frequency() - if(isturf(source)) + var/turf/turf_source = get_turf(source) + if(isturf(turf_source)) // 3D sounds, the technology is here! var/turf/T = get_turf(src) - var/dx = source.x - T.x // Hearing from the right/left - S.x = round(max(-10, min(10, dx)), 1) + var/dx = turf_source.x - T.x // Hearing from the right/left - var/dz = source.y - T.y // Hearing from infront/behind - S.z = round(max(-10, min(10, dz)), 1) + S.x = round(max(-SURROUND_CAP, min(SURROUND_CAP, dx)), 1) + + var/dz = turf_source.y - T.y // Hearing from infront/behind + S.z = round(max(-SURROUND_CAP, min(SURROUND_CAP, dz)), 1) // The y value is for above your head, but there is no ceiling in 2d spessmens. S.y = 1 - S.falloff = (falloff ? falloff : FALLOFF_SOUNDS) src << S diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm index e1682cfbbfc..d6c2246d76d 100644 --- a/code/modules/telesci/telesci_computer.dm +++ b/code/modules/telesci/telesci_computer.dm @@ -207,7 +207,7 @@ dest = target flick("pad-beam", telepad) - playsound(telepad.loc, 'sound/weapons/emitter2.ogg', 25, 1) + playsound(telepad.loc, 'sound/weapons/emitter2.ogg', 25, 1, extrarange = 3, falloff = 5) for(var/atom/movable/ROI in source) // if is anchored, don't let through if(ROI.anchored)