diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-03-30 20:54:57 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-03-30 20:54:57 +0300 |
commit | 4cee9a86ac6fcde65dc2855a716b52f4437323f0 (patch) | |
tree | a547e26d39dd682a107441b52147d9bc70cb69d7 /src | |
parent | 7cad0a2dcd817b179f82066964c45937a603d138 (diff) | |
download | minetest-4cee9a86ac6fcde65dc2855a716b52f4437323f0.tar.gz minetest-4cee9a86ac6fcde65dc2855a716b52f4437323f0.tar.bz2 minetest-4cee9a86ac6fcde65dc2855a716b52f4437323f0.zip |
Improved teleport command
Diffstat (limited to 'src')
-rw-r--r-- | src/servercommand.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/servercommand.cpp b/src/servercommand.cpp index 64c43d4f5..f6088925e 100644 --- a/src/servercommand.cpp +++ b/src/servercommand.cpp @@ -103,50 +103,6 @@ void cmd_setting(std::wostringstream &os, os<< L"-!- Setting changed and configuration saved."; } -void cmd_teleport(std::wostringstream &os, - ServerCommandContext *ctx) -{ - if(!ctx->server->checkPriv(ctx->player->getName(), "teleport")) - { - os<<L"-!- You don't have permission to do that"; - return; - } - - if(ctx->parms.size() != 2) - { - os<<L"-!- Missing parameter"; - return; - } - - std::vector<std::wstring> coords = str_split(ctx->parms[1], L','); - if(coords.size() != 3) - { - os<<L"-!- You can only specify coordinates currently"; - return; - } - - v3f dest(stoi(coords[0])*BS, stoi(coords[1])*BS, stoi(coords[2])*BS); - - actionstream<<ctx->player->getName()<<" teleports from " - <<PP(ctx->player->getPosition()/BS)<<" to " - <<PP(dest/BS)<<std::endl; - - // Use the ServerActiveObject interface of RemotePlayer - // This forces a position change on the client - ServerActiveObject *sao = ctx->player->getPlayerSAO(); - if(sao) - { - sao->setPos(dest); - os<< L"-!- Teleported."; - } - else - { - errorstream<<"Teleport failed, player object not found!" - <<std::endl; - os<< L"-!- Teleport failed."; - } -} - void cmd_banunban(std::wostringstream &os, ServerCommandContext *ctx) { if(!ctx->server->checkPriv(ctx->player->getName(), "ban")) @@ -240,8 +196,6 @@ std::wstring processServerCommand(ServerCommandContext *ctx) cmd_shutdown(os, ctx); else if(ctx->parms[0] == L"setting") cmd_setting(os, ctx); - else if(ctx->parms[0] == L"teleport") - cmd_teleport(os, ctx); else if(ctx->parms[0] == L"ban" || ctx->parms[0] == L"unban") cmd_banunban(os, ctx); else if(ctx->parms[0] == L"me") |