]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/wpeditior_command'
authorterencehill <piuntn@gmail.com>
Wed, 5 Sep 2018 19:26:57 +0000 (21:26 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 5 Sep 2018 19:26:57 +0000 (21:26 +0200)
1  2 
qcsrc/server/command/cmd.qc
qcsrc/server/impulse.qc

index 353d81395b0f568acb931cc517219bc0c8d0e139,bdfc52da0e16544961da36215d7d87f7e209624c..a5867dced827e3bcae9fb5f5151d14f063be81d5
@@@ -8,10 -8,11 +8,12 @@@
  #include "common.qh"
  #include "vote.qh"
  
+ #include "../bot/api.qh"
  #include "../campaign.qh"
  #include "../cheats.qh"
  #include "../client.qh"
 +#include "../clientkill.qh"
  #include "../player.qh"
  #include "../ipban.qh"
  #include "../mapvoting.qh"
@@@ -166,6 -167,61 +168,61 @@@ void ClientCommand_mv_getpicture(entit
        }
  }
  
+ 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)
@@@ -698,6 -754,7 +755,7 @@@ void ClientCommand_(entity caller, int 
        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 -829,7 +830,7 @@@ void SV_ParseClientCommand(entity this
                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
diff --combined qcsrc/server/impulse.qc
index 5d71b95afa829d84ba7885516b458a92d40a3dd2,20307b8a2863ec56b659b6e9360304d897b47903..cce5963990893d7a4178e8b7d5e0ddd7895b886e
@@@ -1,12 -1,9 +1,10 @@@
  #include "impulse.qh"
  #include "round_handler.qh"
  
- #include "bot/api.qh"
  #include "weapons/throwing.qh"
  #include "command/common.qh"
  #include "cheats.qh"
 +#include "clientkill.qh"
  #include "weapons/selection.qh"
  #include "weapons/tracing.qh"
  #include "weapons/weaponsystem.qh"
@@@ -572,33 -569,3 +570,3 @@@ IMPULSE(waypoint_clear
        }
        sprint(this, "all waypoints cleared\n");
  }
- IMPULSE(navwaypoint_spawn)
- {
-       if (!autocvar_g_waypointeditor) return;
-       waypoint_spawn_fromeditor(this);
- }
- IMPULSE(navwaypoint_remove)
- {
-       if (!autocvar_g_waypointeditor) return;
-       waypoint_remove_fromeditor(this);
- }
- IMPULSE(navwaypoint_relink)
- {
-       if (!autocvar_g_waypointeditor) return;
-       waypoint_schedulerelinkall();
- }
- IMPULSE(navwaypoint_save)
- {
-       if (!autocvar_g_waypointeditor) return;
-       waypoint_saveall();
- }
- IMPULSE(navwaypoint_unreachable)
- {
-       if (!autocvar_g_waypointeditor) return;
-       waypoint_unreachable(this);
- }