ID:164922
 
I remember seeing something somewhere that looks a bit like this:
mob
Login()
loc=locate(1,1,1)
world<<"[src] logs in."
src=/mob/player

Am i going mad, or is that really possible? Because src is't given player.dmi as an icon.
Wouldn't it be easier to do it like this?
mob
Login()
loc=locate(1,1,1)
world<<"[src] logs in."
var/mob/player/O = new()
O.client=src.client
In response to Buzzyboy
runtime error: Maximum recursion level reached (perhaps there is an infinite loop)
To avoid this safety check, set world.loop_checks=0.
proc name: Login (/mob/Login)
usr: the player (/mob/player)
src: the player (/mob/player)
call stack:
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
...
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
the player (/mob/player): Login()
Adam753 (/mob): Login()
Adam753 logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.
The player logs in.


AAAAAAAAAARGH!!! I don't see a problem here, all i can say is that maybe it is because i keep creating new mobs and logging them in, it is giving the Login() message again and again. But new mobs aren't logging in because they aren't usr's until you make them that by logging in, which you only do once... i is confuzzled. >.$
In response to Buzzyboy
Wouldn't it be even easier if you did it like this?

world/mob=/mob/player
mob
Login()
loc=locate(1,1,1)
world<<"[src] logs in."


Now, I don't know why you did what you did in the first place, so if it ain't right, we need to see more. : /
Actualy it should look like this:

world
mob = /mob/player
mob/player
Login()
loc = locate(1,1,1)
In response to RedlineM203
huh, actually i have no idea how that works, because shouldn't it turn ALL mobs into /mob/players? But it doesn't. Thanks.
In response to Adam753
Adam753 wrote:
huh, actually i have no idea how that works, because shouldn't it turn ALL mobs into /mob/players? But it doesn't. Thanks.

It should make it so that any player that gets a new mob created for them, gets a /mob/player type of mob, unless you specifically specify otherwise.
In response to Adam753
I see you edited your post to say resolved, but since no one pointed it out, and in case you didn't understand why, here's the explanation to your error:

mob/Login() is called whenever a client connects to a new (to them anyway) mob. Because Buzzyboy's example is creating a new mob and connecting the client to it inside of the Login() proc, it is looping.

This is how the game thinks:

1. A new client connects to the game. Give it a new mob based on whatever the world.mob is. (If you don't define this, I think it just gives it /mob)

2. A client was just connected to a /mob, since the client just connected to it, call mob/Login()

3. Set it's location to 1,1,1

4. Send "[src] logs in." to the world

5. Create a new mob of type /mob/player.

6. Connect the client to the new mob.

7. A client was just connected to a child of /mob, since the client just connected to it, call mob/Login().

8. Do 3-7 again... and again, and again. Infinitely repeating.


So, that's the reasoning behind it.
In response to Yume_Nasuki
Actually, I already showed him that. <_<