* Fixes certain objects not using 3D sounds.

* Gave the piano a bigger falloff.
 * Capped the sound x/z to 7.
This commit is contained in:
Giacomand
2013-11-21 23:50:53 +00:00
parent 5322a6cb62
commit 17fd5d6cdc
3 changed files with 12 additions and 10 deletions
+1 -1
View File
@@ -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
+10 -8
View File
@@ -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
+1 -1
View File
@@ -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)