More work on redirect
This commit is contained in:
@@ -368,26 +368,22 @@ LuaDefine(tangible_redirect, "actor1, actor2",
|
||||
"|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."
|
||||
"|Actor1 must be currently logged in. Actor2 must be a valid actor "
|
||||
"|tangible that is not curretly logged in."
|
||||
"|") {
|
||||
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());
|
||||
int64_t client_id = w->connection_get_client(actor1->id());
|
||||
eng::string error = w->connection_redirect(client_id, actor2->id());
|
||||
if (!error.empty()) {
|
||||
eng::ostringstream oss;
|
||||
oss << "redirect from " << actor1->id() << " to " << actor2->id() << " failed: " << error;
|
||||
luaL_error(L, "%s", oss.str().c_str());
|
||||
return LS.result();
|
||||
}
|
||||
return LS.result();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user