This commit is contained in:
Fox-McCloud
2017-07-26 16:29:05 -04:00
parent a86a0d1261
commit e3d425aae3
3 changed files with 17 additions and 3 deletions
+5
View File
@@ -6,6 +6,11 @@
#define CHANNEL_BUZZ 1020
#define CHANNEL_AMBIENCE 1019
//THIS SHOULD ALWAYS BE THE LOWEST ONE!
//KEEP IT UPDATED
#define CHANNEL_HIGHEST_AVAILABLE 1018
#define SOUND_MINIMUM_PRESSURE 10
#define FALLOFF_SOUNDS 0.5
+11 -2
View File
@@ -5,6 +5,9 @@
var/turf/turf_source = get_turf(source)
//allocate a channel if necessary now so its the same for everyone
channel = channel || open_sound_channel()
// Looping through the player list has the added bonus of working for mobs inside containers
var/sound/S = sound(get_sfx(soundin))
var/maxdistance = (world.view + extrarange) * 3
@@ -21,14 +24,14 @@
M.playsound_local(turf_source, soundin, vol, vary, frequency, falloff, channel, pressure_affected, S)
/mob/proc/playsound_local(turf/turf_source, soundin, vol as num, vary, frequency, falloff, channel = 0, pressure_affected = TRUE, sound/S)
if(!src.client || !can_hear())
if(!client || !can_hear())
return
if(!S)
S = sound(get_sfx(soundin))
S.wait = 0 //No queue
S.channel = channel
S.channel = channel || open_sound_channel()
S.volume = vol
if(vary)
@@ -83,6 +86,12 @@
if(prefs.sound & SOUND_LOBBY)
src << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = CHANNEL_LOBBYMUSIC) // MAD JAMS
/proc/open_sound_channel()
var/static/next_channel = 1 //loop through the available 1024 - (the ones we reserve) channels and pray that its not still being used
. = ++next_channel
if(next_channel > CHANNEL_HIGHEST_AVAILABLE)
next_channel = 1
/mob/proc/stop_sound_channel(chan)
src << sound(null, repeat = 0, wait = 0, channel = chan)
+1 -1
View File
@@ -284,7 +284,7 @@
return
var/sound/S = sound(mysound)
S.wait = 0 //No queue
S.channel = 0
S.channel = open_sound_channel()
S.volume = 50
for(var/mob/M in passengers | pilot)
M << S