ID:1673488
 
Keywords: proc, range, src, usr, view
(See the best response by Kaiochao.)
Code:
/mob/monster/angel/proc/FlickerLights()
world << "Debug-running look for lights proc"
for(var/obj/light/L in range(5))
world << "Debug-found lights [L]"
L.flicker()


Problem description:
I have no idea what's wrong here, but it doesn't seem to work at all.
I get the first debug message, so I know this proc definitely runs.
However I never get the second debug message and no lights flicker (I know the actual light flickering works by itself)
No compile errors or runtime errors

Thanks in advance for any assistance or suggestions.

EDIT: Turns out I needed to specify the centre of the range.
range(5,src)
I'm not quite sure why. Can someone explain?
Best response
range() is centered on usr by default due to silly, ancient reasons. You need to specify the center if usr isn't applicable, like so: range(5, src)
RIGHT yeah I just discovered that accidentally. Thanks a bunch though.
So usr would only work if it was a client running it or what?
This explains a lot. Thank you.