redirect code in place
This commit is contained in:
@@ -282,8 +282,8 @@ LuaDefine(tangible_getclass, "tan",
|
||||
LuaDefine(tangible_delete, "tan",
|
||||
"|Delete the specified tangible."
|
||||
"|"
|
||||
"|This cannot be used to delete player tangibles,"
|
||||
"|To delete a player, use tangible.redirect"
|
||||
"|This cannot be used to delete actor tangibles,"
|
||||
"|To delete a actor, use tangible.deleteactor"
|
||||
"|") {
|
||||
LuaArg tanobj;
|
||||
LuaDefStack LS(L, tanobj);
|
||||
@@ -332,14 +332,16 @@ LuaDefine(tangible_deleteactor, "tan",
|
||||
LuaDefine(tangible_keepactor, "tan",
|
||||
"|Mark an actor tangible to not 'delete_on_disconnect'."
|
||||
"|"
|
||||
"|When a client connects to the server, a login actor is created and the"
|
||||
"|client is put in control of the login actor. The client typically"
|
||||
"|controls the login actor just long enough to type his username and password."
|
||||
"|Then, he is redirected to the real actor."
|
||||
"|When a client connects to the server, a new 'login' actor is "
|
||||
"|created and the client is put in control of the login actor. "
|
||||
"|The login actor typically presents a login dialog. After the "
|
||||
"|client types his name and password, tangible.redirect is used "
|
||||
"|to tell the client to control the real actor."
|
||||
"|"
|
||||
"|When the client is redirected to the real actor, the login actor is no longer"
|
||||
"|needed. The login actor has the flag 'delete_on_disconnect', so when the"
|
||||
"|client detaches from the login actor, it is garbage collected."
|
||||
"|When the client is redirected to the real actor, the login "
|
||||
"|actor is no longer needed. The login actor has the "
|
||||
"|flag 'delete_on_disconnect', so when the client detaches "
|
||||
"|from the login actor, it is garbage collected."
|
||||
"|"
|
||||
"|However, if the player clicks 'NEW PLAYER', then it is necessary to"
|
||||
"|convert the login actor into a permanent actor. The most important step is to"
|
||||
@@ -357,6 +359,38 @@ LuaDefine(tangible_keepactor, "tan",
|
||||
return LS.result();
|
||||
}
|
||||
|
||||
LuaDefine(tangible_redirect, "actor1, actor2",
|
||||
"|Cause the client controlling actor1 to take a control of actor2"
|
||||
"|"
|
||||
"|When a client connects to the server, a new 'login' actor is "
|
||||
"|created and the client is put in control of the login actor. "
|
||||
"|The login actor typically presents a login dialog. After the "
|
||||
"|client types his name and password, tangible.redirect is used "
|
||||
"|to tell the client to control the real actor."
|
||||
"|"
|
||||
"|Actor1 must be currently logged in. Actor2 must not be. This "
|
||||
"|function doesn't error check that the actors are valid: it just "
|
||||
"|queues the redirect, then the system error checks later. This "
|
||||
"|is because conditions can change. An invalid redirect will cause "
|
||||
"|a disconnection."
|
||||
"|") {
|
||||
LuaArg lactor1, lactor2;
|
||||
LuaDefStack LS(L, lactor1, lactor2);
|
||||
World *w = World::fetch_global_pointer(L);
|
||||
Tangible *actor1 = w->tangible_get(LS, lactor1, true);
|
||||
Tangible *actor2 = w->tangible_get(LS, lactor2, true);
|
||||
if (!actor1->is_controlled_) {
|
||||
luaL_error(L, "Actor1 is not a controlled actor.");
|
||||
return 0;
|
||||
}
|
||||
if ((!actor2->can_be_controlled_) || (actor2->is_controlled_)) {
|
||||
luaL_error(L, "Actor2 is not an uncontrolled actor.");
|
||||
return 0;
|
||||
}
|
||||
w->add_redirect(actor1->id(), actor2->id());
|
||||
return LS.result();
|
||||
}
|
||||
|
||||
LuaDefine(tangible_build, "config",
|
||||
"|Build a new tangible object."
|
||||
"|"
|
||||
|
||||
Reference in New Issue
Block a user