mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Moved snowflake telecomm ambient sound code that only half worked into the switch that's designed to handle it. Committing for Aranclanos: - Toggle ambience should now properly work. Fixes issue 992. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4880 316c924e-a436-60f5-8080-3fe189b3f50e
92 lines
4.2 KiB
Plaintext
92 lines
4.2 KiB
Plaintext
/proc/playsound(var/atom/source, soundin, vol as num, vary, extrarange as num)
|
|
//Frequency stuff only works with 45kbps oggs.
|
|
|
|
switch(soundin)
|
|
if ("shatter") soundin = pick('sound/effects/Glassbr1.ogg','sound/effects/Glassbr2.ogg','sound/effects/Glassbr3.ogg')
|
|
if ("explosion") soundin = pick('sound/effects/Explosion1.ogg','sound/effects/Explosion2.ogg')
|
|
if ("sparks") soundin = pick('sound/effects/sparks1.ogg','sound/effects/sparks2.ogg','sound/effects/sparks3.ogg','sound/effects/sparks4.ogg')
|
|
if ("rustle") soundin = pick('sound/effects/rustle1.ogg','sound/effects/rustle2.ogg','sound/effects/rustle3.ogg','sound/effects/rustle4.ogg','sound/effects/rustle5.ogg')
|
|
if ("punch") soundin = pick('sound/weapons/punch1.ogg','sound/weapons/punch2.ogg','sound/weapons/punch3.ogg','sound/weapons/punch4.ogg')
|
|
if ("clownstep") soundin = pick('sound/effects/clownstep1.ogg','sound/effects/clownstep2.ogg')
|
|
if ("swing_hit") soundin = pick('sound/weapons/genhit1.ogg', 'sound/weapons/genhit2.ogg', 'sound/weapons/genhit3.ogg')
|
|
if ("hiss") soundin = pick('sound/voice/hiss1.ogg','sound/voice/hiss2.ogg','sound/voice/hiss3.ogg','sound/voice/hiss4.ogg')
|
|
if ("pageturn") soundin = pick('sound/effects/pageturn1.ogg', 'sound/effects/pageturn2.ogg','sound/effects/pageturn3.ogg')
|
|
|
|
var/sound/S = sound(soundin)
|
|
S.wait = 0 //No queue
|
|
S.channel = 0 //Any channel
|
|
S.volume = vol
|
|
|
|
if (vary)
|
|
S.frequency = rand(32000, 55000)
|
|
for (var/mob/M in range(world.view+extrarange, source)) // Plays for people in range.
|
|
if(locate(/mob/, M))
|
|
var/mob/M2 = locate(/mob/, M)
|
|
if (M2.client)
|
|
if(M2.ear_deaf <= 0 || !M.ear_deaf)
|
|
if(isturf(source))
|
|
var/dx = source.x - M2.x
|
|
S.pan = max(-100, min(100, dx/8.0 * 100))
|
|
|
|
M2 << S
|
|
|
|
if (M.client)
|
|
if(M.ear_deaf <= 0 || !M.ear_deaf)
|
|
if(isturf(source))
|
|
var/dx = source.x - M.x
|
|
S.pan = max(-100, min(100, dx/8.0 * 100))
|
|
|
|
M << S
|
|
|
|
for(var/obj/structure/closet/L in range(world.view+extrarange, source))
|
|
if(locate(/mob/, L))
|
|
for(var/mob/M in L)
|
|
if (M.client)
|
|
if(M.ear_deaf <= 0 || !M.ear_deaf)
|
|
if(isturf(source))
|
|
var/dx = source.x - M.x
|
|
S.pan = max(-100, min(100, dx/8.0 * 100))
|
|
|
|
M << S
|
|
// Now plays for people in lockers! -- Polymorph
|
|
|
|
/mob/proc/playsound_local(var/atom/source, soundin, vol as num, vary, extrarange as num)
|
|
if(!src.client || ear_deaf > 0) return
|
|
switch(soundin)
|
|
if ("shatter") soundin = pick('sound/effects/Glassbr1.ogg','sound/effects/Glassbr2.ogg','sound/effects/Glassbr3.ogg')
|
|
if ("explosion") soundin = pick('sound/effects/Explosion1.ogg','sound/effects/Explosion2.ogg')
|
|
if ("sparks") soundin = pick('sound/effects/sparks1.ogg','sound/effects/sparks2.ogg','sound/effects/sparks3.ogg','sound/effects/sparks4.ogg')
|
|
if ("rustle") soundin = pick('sound/effects/rustle1.ogg','sound/effects/rustle2.ogg','sound/effects/rustle3.ogg','sound/effects/rustle4.ogg','sound/effects/rustle5.ogg')
|
|
if ("punch") soundin = pick('sound/weapons/punch1.ogg','sound/weapons/punch2.ogg','sound/weapons/punch3.ogg','sound/weapons/punch4.ogg')
|
|
if ("clownstep") soundin = pick('sound/effects/clownstep1.ogg','sound/effects/clownstep2.ogg')
|
|
if ("swing_hit") soundin = pick('sound/weapons/genhit1.ogg', 'sound/weapons/genhit2.ogg', 'sound/weapons/genhit3.ogg')
|
|
if ("hiss") soundin = pick('sound/voice/hiss1.ogg','sound/voice/hiss2.ogg','sound/voice/hiss3.ogg','sound/voice/hiss4.ogg')
|
|
|
|
var/sound/S = sound(soundin)
|
|
S.wait = 0 //No queue
|
|
S.channel = 0 //Any channel
|
|
S.volume = vol
|
|
|
|
if (vary)
|
|
S.frequency = rand(32000, 55000)
|
|
if(isturf(source))
|
|
var/dx = source.x - src.x
|
|
S.pan = max(-100, min(100, dx/8.0 * 100))
|
|
|
|
src << S
|
|
|
|
client/verb/Toggle_Soundscape() //All new ambience should be added here so it works with this verb until someone better at things comes up with a fix that isn't awful
|
|
set category = "Special Verbs"
|
|
set name = "Toggle Ambience"
|
|
|
|
usr:client:no_ambi = !usr:client:no_ambi
|
|
|
|
if(usr:client:no_ambi)
|
|
usr << sound(null, repeat = 0, wait = 0, volume = 0, channel = 1)
|
|
usr << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2)
|
|
|
|
usr << "Toggled ambient sound [usr:client:no_ambi?"off":"on"]."
|
|
return
|
|
|
|
|