Update musician.dm

This commit is contained in:
kevinz000
2017-07-24 00:13:10 -07:00
committed by GitHub
parent abeda8d408
commit d9a057966d
+7 -7
View File
@@ -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,14 +65,14 @@
// and play
var/turf/source = get_turf(instrumentObj)
if((world.time - MUSICIAN_HEARCHECK_MINDELAY) > last_hearcheck)
LAZYCLEARLIST(hearers)
LAZYCLEARLIST(hearing_mobs)
for(var/mob/M in get_hearers_in_view(15, source))
if(!M.client || !(M.client.prefs.toggles & SOUND_INSTRUMENTS))
continue
LAZYADD(hearers, M)
LAZYADD(hearing_mobs, M)
last_hearcheck = world.time
if(LAZYLEN(hearers))
for(var/i in hearers)
if(LAZYLEN(hearing_mobs))
for(var/i in hearing_mobs)
var/mob/M = i
M.playsound_local(source, soundfile, 100, falloff = 5)
@@ -104,7 +104,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 +136,7 @@
else
sleep(tempo)
repeat--
hearers = null
hearing_mobs = null
playing = FALSE
repeat = 0
updateDialog(user)