Adds volume channel for engine ambience (SM, Tesla) (#15845)

This commit is contained in:
dearmochi
2021-04-10 12:10:22 +01:00
committed by GitHub
parent 13512ba21a
commit 71ddf21925
7 changed files with 21 additions and 10 deletions
+7 -3
View File
@@ -31,6 +31,8 @@
var/falloff_exponent
var/muted = TRUE
var/falloff_distance
/// Channel of the audio, random otherwise
var/channel
/datum/looping_sound/New(list/_output_atoms = list(), start_immediately = FALSE, _direct = FALSE)
if(!mid_sounds)
@@ -75,14 +77,16 @@
var/list/atoms_cache = output_atoms
var/sound/S = sound(soundfile)
if(direct)
S.channel = SSsounds.random_available_channel()
S.volume = volume
S.channel = channel || SSsounds.random_available_channel()
for(var/i in 1 to atoms_cache.len)
var/atom/thing = atoms_cache[i]
if(direct)
if(ismob(thing))
var/mob/M = thing
S.volume = volume * (USER_VOLUME(M, channel) || 1)
SEND_SOUND(thing, S)
else
playsound(thing, S, volume, vary, extra_range, falloff_exponent = falloff_exponent, falloff_distance = falloff_distance)
playsound(thing, S, volume, vary, extra_range, falloff_exponent = falloff_exponent, falloff_distance = falloff_distance, channel = channel)
/datum/looping_sound/proc/get_sound(looped, _mid_sounds)
if(!_mid_sounds)
@@ -16,3 +16,4 @@
falloff_exponent = 10
falloff_distance = 5
vary = TRUE
channel = CHANNEL_ENGINE