From 47e20105a39298d17ec408a3cc57e3d70f0b3902 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Tue, 25 Jul 2017 17:33:45 -0500 Subject: [PATCH] fixes instruments (#2129) --- code/game/objects/structures/musician.dm | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/code/game/objects/structures/musician.dm b/code/game/objects/structures/musician.dm index 142ec8fc93..b57ab68641 100644 --- a/code/game/objects/structures/musician.dm +++ b/code/game/objects/structures/musician.dm @@ -18,7 +18,7 @@ var/instrumentExt = "ogg" // the file extension var/obj/instrumentObj = null // the associated obj playing the sound var/last_hearcheck = 0 - var/list/hearers + var/list/hearing_mobs /datum/song/New(dir, obj, ext = "ogg") tempo = sanitize_tempo(tempo) @@ -65,16 +65,15 @@ // and play var/turf/source = get_turf(instrumentObj) if((world.time - MUSICIAN_HEARCHECK_MINDELAY) > last_hearcheck) - hearers = list() + LAZYCLEARLIST(hearing_mobs) for(var/mob/M in get_hearers_in_view(15, source)) if(!M.client || !(M.client.prefs.toggles & SOUND_INSTRUMENTS)) continue - LAZYSET(hearers, M, TRUE) + LAZYADD(hearing_mobs, M) last_hearcheck = world.time - if(LAZYLEN(hearers)) - for(var/i in hearers) - var/mob/M = hearers[i] - M.playsound_local(source, soundfile, 100, falloff = 5) + for(var/i in hearing_mobs) + var/mob/M = i + M.playsound_local(source, soundfile, 100, falloff = 5) /datum/song/proc/updateDialog(mob/user) instrumentObj.updateDialog() // assumes it's an object in world, override if otherwise @@ -104,7 +103,7 @@ //to_chat(world, "note: [note]") if(!playing || shouldStopPlaying(user))//If the instrument is playing, or special case playing = FALSE - hearers = null + hearing_mobs = null return if(!lentext(note)) continue @@ -136,7 +135,7 @@ else sleep(tempo) repeat-- - hearers = null + hearing_mobs = null playing = FALSE repeat = 0 updateDialog(user) @@ -298,7 +297,7 @@ else if(href_list["stop"]) playing = FALSE - hearers = null + hearing_mobs = null updateDialog(usr) return