ID:167319
 
Just wondering how would this be done.
for(var/mob/M) if(M.client && M.z==insertZhere) M<<sound('song')
In response to Mysame
Thanks
In response to Mysame
Mysame wrote:
for(var/mob/M) if(M.client && M.z==insertZhere) M<<sound('song')


Far, far better is to loop through clients only.

for(var/client/C) if(C.mob.z==insertZhere) C<<sound('song')


Lummox JR
In response to Lummox JR
Then again, when you'd like to change their vars, too, you'd always have to use client.mob, so meh.
In response to Mysame
The point Lummox was making was that to loop through all mobs in the world takes more time than is necessary, when you can loop through clients much faster, and only get the mobs you want...

Having to use client.mob inside of that loop for other functions is hardly a big deal...