ID:151847
 
Well, This may be the wrong place to post this, please move it if you wish.

I'm assuming "world" is a list because we can loop through mobs in it, Now, I want to know if as well as mobs are clients added to the world list?

Normally to loop through clients connected to the server (Hosting computer), I do "for(var/client/C)" without the "in world" bit, all seems to work, and it wouldn't make much sense if the client was IN the world? So any more info on if client's are actually in the world list? Or do they have there own special list? Or do they even not have a list! :O

You could easily make a list like:

var/list/worldClients = list()
client
New()
..()
worldClients += src
Del()
..()
worldClients -= src


But that would be useless if BYOND had already done it.

Thanks in advance...

--Haywire
for(var/client/C) is a shortcut for for(var/client/C in world.contents) as I (mis)understand it.
World is not a list. It's an object... but not exactly a datum. Just like the atomic types, if you use the in operator on the world type, it'll actually check in the world.contents list. The world.contents list contains every atom, even those who's location is null (and even areas with no turfs, or 'rooms').

Because the client isn't an atom it isn't in the world.contents list. However, like you said, you can loop through them with a normal "for(var/client/C){}". There isn't a global list of clients in DM, so you'll have to maintain a list of them yourself if you want such a list. Internally, the 0x5000000 memory locations may be reserved for clients, so you could think of that as a "list", but then again I'm just guessing.




Stephen001 wrote:
for(var/client/C) is a shortcut for for(var/client/C in world.contents) as I (mis)understand it.

Sorry to break it to you, "but var/client/C" in a for loop is not the same thing as "var/client/C in world.contents"; the first will locate all clients, the second will fail to locate any.
In response to IainPeregrine
Ahh, I see. So I was going on the right direction, Thanks Ian and also Stephen for trying :P

--Haywire