Fixes possible runtimers (#18044)

whatever did call `stop()` with a valid `remove_thing` and with a nulled `output_atoms` shouldnt happen again. I think it was because I wasnt setting muted, or output_atoms lost its type when all `output_atoms` were removed.
This commit is contained in:
Kugamo
2022-06-22 18:33:14 +01:00
committed by GitHub
parent d9b2a0c4ae
commit 3ff67be9fa
2 changed files with 5 additions and 6 deletions
+4 -5
View File
@@ -52,7 +52,7 @@
/datum/looping_sound/proc/start(atom/add_thing)
if(add_thing)
output_atoms |= add_thing
LAZYADD(output_atoms, add_thing)
if(!muted)
return
muted = FALSE
@@ -60,8 +60,8 @@
/datum/looping_sound/proc/stop(atom/remove_thing, do_not_mute)
if(remove_thing)
output_atoms -= remove_thing
if(do_not_mute)
LAZYREMOVE(output_atoms, remove_thing)
if(do_not_mute && length(output_atoms)) //if there are no output_atoms then we mute regardless of your preferance
return
if(muted)
return
@@ -80,8 +80,7 @@
var/sound/S = sound(soundfile)
if(direct)
S.channel = channel || SSsounds.random_available_channel()
for(var/i in 1 to atoms_cache.len)
var/atom/thing = atoms_cache[i]
for(var/atom/thing in atoms_cache)
if(direct)
if(ismob(thing))
var/mob/M = thing