mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 08:03:43 +01:00
Adds delta alarm to mixer (#21702)
* Re-adds delta alarm to mixer * Fixes weirdness with changing volume mixers
This commit is contained in:
@@ -88,6 +88,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
|
||||
"1017" = 100, // CHANNEL_ENGINE
|
||||
"1016" = 100, // CHANNEL_FIREALARM
|
||||
"1015" = 100, // CHANNEL_ASH_STORM
|
||||
"1014" = 100, // CHANNEL_DELTA_ALARM
|
||||
)
|
||||
/// The volume mixer save timer handle. Used to debounce the DB call to save, to avoid spamming.
|
||||
var/volume_mixer_saving = null
|
||||
|
||||
@@ -50,10 +50,21 @@
|
||||
// Set the volume
|
||||
volume = clamp(volume, 0, 100)
|
||||
volume_mixer["[channel]"] = volume
|
||||
// Update the sound channel
|
||||
var/sound/S = sound(null, channel = channel, volume = volume)
|
||||
S.status = SOUND_UPDATE
|
||||
SEND_SOUND(parent, S)
|
||||
var/sound/S
|
||||
var/channel_already_updated = FALSE
|
||||
// special handling for looping sounds, especially if they're decreasing
|
||||
for(var/datum/looping_sound/D in GLOB.looping_sounds)
|
||||
if(channel == D.channel)
|
||||
S = sound(null, channel = channel, volume = D.volume * volume / 100)
|
||||
S.status = SOUND_UPDATE
|
||||
SEND_SOUND(parent, S)
|
||||
channel_already_updated = TRUE
|
||||
|
||||
if(!channel_already_updated)
|
||||
// Update the currently playing sound to update its volume
|
||||
S = sound(null, channel = channel, volume = volume)
|
||||
S.status = SOUND_UPDATE
|
||||
SEND_SOUND(parent, S)
|
||||
// Save it
|
||||
if(debounce_save)
|
||||
volume_mixer_saving = addtimer(CALLBACK(src, PROC_REF(save_volume_mixer)), 3 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_STOPPABLE)
|
||||
|
||||
Reference in New Issue
Block a user