X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcommand%2Fcmd.qc;h=915fea7ee0ca2ca02ffb14d9341d539b4b4a7d14;hp=6f1d60dd9bffe1a9dd9970408ec715f3071f29f1;hb=2f163ba8166694e7467740bb2618e61fa2ef0a9a;hpb=2cabbcd1e3acb48f45f56f976a94b7c8d48addee diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 6f1d60dd9b..915fea7ee0 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -8,6 +8,8 @@ #include "common.qh" #include "vote.qh" +#include "../bot/api.qh" + #include "../campaign.qh" #include "../cheats.qh" #include "../client.qh" @@ -166,6 +168,61 @@ void ClientCommand_mv_getpicture(entity caller, int request, int argc) // inter } } +void ClientCommand_wpeditor(entity caller, int request, int argc) +{ + switch (request) + { + case CMD_REQUEST_COMMAND: + { + if (!autocvar_g_waypointeditor) + { + sprint(caller, "ERROR: this command works only if the waypoint editor is on\n"); + return; + } + + if (argv(1) != "") + { + if (argv(1) == "spawn") + { + if (!IS_PLAYER(caller)) + sprint(caller, "ERROR: this command works only if you are player\n"); + else + waypoint_spawn_fromeditor(caller); + } + else if (argv(1) == "remove") + { + if (!IS_PLAYER(caller)) + sprint(caller, "ERROR: this command works only if you are player\n"); + else + waypoint_remove_fromeditor(caller); + } + else if (argv(1) == "unreachable") + { + if (!IS_PLAYER(caller)) + sprint(caller, "ERROR: this command works only if you are player\n"); + else + waypoint_unreachable(caller); + } + else if (argv(1) == "saveall") + waypoint_saveall(); + else if (argv(1) == "relinkall") + waypoint_schedulerelinkall(); + + return; + } + } + + default: + sprint(caller, "Incorrect parameters for ^2wpeditor^7\n"); + case CMD_REQUEST_USAGE: + { + sprint(caller, "\nUsage:^3 cmd wpeditor action\n"); + sprint(caller, " Where 'action' can be: spawn, remove, unreachable, saveall, relinkall\n"); + return; + } + } +} + void ClientCommand_join(entity caller, int request) { switch (request) @@ -306,19 +363,7 @@ void ClientCommand_say_team(entity caller, int request, int argc, string command case CMD_REQUEST_COMMAND: { if (argc >= 2) - { - string _classname = string_null; - if (!IS_PLAYER(caller) && caller.caplayer) - { - // CA: make work team chat for killed players - _classname = caller.classname; - caller.classname = STR_PLAYER; - } - Say(caller, true, NULL, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); - if (_classname) - caller.classname = _classname; - } return; // never fall through to usage } @@ -698,6 +743,7 @@ void ClientCommand_(entity caller, int request) CLIENT_COMMAND("suggestmap", ClientCommand_suggestmap(ent, request, arguments), "Suggest a map to the mapvote at match end") \ CLIENT_COMMAND("tell", ClientCommand_tell(ent, request, arguments, command), "Send a message directly to a player") \ CLIENT_COMMAND("voice", ClientCommand_voice(ent, request, arguments, command), "Send voice message via sound") \ + CLIENT_COMMAND("wpeditor", ClientCommand_wpeditor(ent, request, arguments), "Waypoint editor commands") \ /* nothing */ void ClientCommand_macro_help(entity caller) @@ -772,6 +818,7 @@ void SV_ParseClientCommand(entity this, string command) case "begin": break; // handled by engine in host_cmd.c case "download": break; // handled by engine in cl_parse.c case "mv_getpicture": break; // handled by server in this file + case "wpeditor": break; // handled by server in this file case "pause": break; // handled by engine in host_cmd.c case "prespawn": break; // handled by engine in host_cmd.c case "sentcvar": break; // handled by server in this file