diff --git a/code/__DEFINES/sound.dm b/code/__DEFINES/sound.dm index ba2bb37743f..2654e33644f 100644 --- a/code/__DEFINES/sound.dm +++ b/code/__DEFINES/sound.dm @@ -14,7 +14,7 @@ //THIS SHOULD ALWAYS BE THE LOWEST ONE! //KEEP IT UPDATED -#define CHANNEL_HIGHEST_AVAILABLE 1016 +#define CHANNEL_HIGHEST_AVAILABLE 1015 #define MAX_INSTRUMENT_CHANNELS (128 * 6) diff --git a/code/datums/looping_sounds/looping_sound.dm b/code/datums/looping_sounds/looping_sound.dm index 4a3f1108ffd..2cd87ae81b2 100644 --- a/code/datums/looping_sounds/looping_sound.dm +++ b/code/datums/looping_sounds/looping_sound.dm @@ -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