Attempt to clean up commands a bit
authorMario <mario.mario@y7mail.com>
Thu, 26 Dec 2013 05:28:44 +0000 (16:28 +1100)
committerMario <mario.mario@y7mail.com>
Thu, 26 Dec 2013 05:28:44 +0000 (16:28 +1100)
commands.cfg
qcsrc/server/command/cmd.qc
qcsrc/server/command/sv_cmd.qc

index 266cc8908c5c6ac3f5715f60b338d06a5cf24094..0ebdfe3cccd43e2e1872bb4bcabf813d41747b69 100644 (file)
@@ -189,7 +189,6 @@ alias allspec              "qc_cmd_sv     allspec              ${* ?}" // Force
 alias anticheat            "qc_cmd_sv     anticheat            ${* ?}" // Create an anticheat report for a client
 alias bbox                 "qc_cmd_sv     bbox                 ${* ?}" // Print detailed information about world size
 alias bot_cmd              "qc_cmd_sv     bot_cmd              ${* ?}" // Control and send commands to bots
-alias butcher              "qc_cmd_sv     butcher              ${* ?}" // Remove all monsters on the map
 alias cointoss             "qc_cmd_sv     cointoss             ${* ?}" // Flip a virtual coin and give random result
 alias database             "qc_cmd_sv     database             ${* ?}" // Extra controls of the serverprogs database
 alias defer_clear          "qc_cmd_sv     defer_clear          ${* ?}" // Clear all queued defer commands for a specific client
@@ -203,6 +202,7 @@ alias gettaginfo           "qc_cmd_sv     gettaginfo           ${* ?}" // Get sp
 alias gotomap              "qc_cmd_sv     gotomap              ${* ?}" // Simple command to switch to another map
 alias lockteams            "qc_cmd_sv     lockteams            ${* ?}" // Disable the ability for players to switch or enter teams
 alias make_mapinfo         "qc_cmd_sv     make_mapinfo         ${* ?}" // Automatically rebuild mapinfo files
+alias mobbutcher           "qc_cmd_sv     mobbutcher           ${* ?}" // Remove all monsters on the map
 alias moveplayer           "qc_cmd_sv     moveplayer           ${* ?}" // Change the team/status of a player
 alias nospectators         "qc_cmd_sv     nospectators         ${* ?}" // Automatically remove spectators from a match
 alias playerdemo           "qc_cmd_sv     playerdemo           ${* ?}" // Control the ability to save demos of players
index fb891125882c08be9f861d6b30f48edafb5a6b72..7b1af114cae0419a9cd063ace891ba8768a55123 100644 (file)
@@ -188,16 +188,30 @@ void ClientCommand_mobedit(float request, float argc)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       makevectors(self.v_angle);
-                       WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 100, MOVE_NORMAL, self);
-                       
-                       if(!(trace_ent.flags & FL_MONSTER)) { sprint(self, "You need to aim at your monster to edit its properties.\n"); return; }
-                       if(trace_ent.realowner != self) { sprint(self, "That monster does not belong to you.\n"); return; }
-                       
-                       switch(argv(1))
+                       if(argv(1) && argv(2))
                        {
-                               case "skin": if(trace_ent.monsterid != MON_MAGE) { trace_ent.skin = stof(argv(2)); } return;
-                               case "movetarget": trace_ent.monster_moveflags = stof(argv(2)); return;
+                               makevectors(self.v_angle);
+                               WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 100, MOVE_NORMAL, self);
+                               
+                               if(!(trace_ent.flags & FL_MONSTER)) { sprint(self, "You need to aim at your monster to edit its properties.\n"); }
+                               else if(trace_ent.realowner != self) { sprint(self, "That monster does not belong to you.\n"); }
+                               else // all went well, continue
+                               {
+                                       switch(argv(1))
+                                       {
+                                               case "skin":
+                                               {
+                                                       if(trace_ent.monsterid != MON_MAGE)
+                                                               trace_ent.skin = stof(argv(2));
+                                                       break;
+                                               }
+                                               case "movetarget":
+                                               {
+                                                       trace_ent.monster_moveflags = stof(argv(2));
+                                                       break;
+                                               }
+                                       }
+                               }
                        }
                }
                default:
@@ -269,6 +283,7 @@ void ClientCommand_mobspawn(float request, float argc)
                        
                        if(autocvar_g_monsters_max <= 0 || autocvar_g_monsters_max_perplayer <= 0) { sprint(self, "Monster spawning is disabled.\n"); }
                        else if(!IS_PLAYER(self)) { sprint(self, "You can't spawn monsters while spectating.\n"); }
+                       else if(tospawn == "") { sprint(self, "No argument specified.\n"); }
                        else if(g_invasion) { sprint(self, "You can't spawn monsters during an invasion!\n"); }
                        else if(!autocvar_g_monsters) { Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_MONSTERS_DISABLED); }
                        else if(self.vehicle) { sprint(self, "You can't spawn monsters while driving a vehicle.\n"); }
@@ -297,9 +312,10 @@ void ClientCommand_mobspawn(float request, float argc)
                        sprint(self, "Incorrect parameters for ^2mobspawn^7\n");
                case CMD_REQUEST_USAGE:
                {
-                       sprint(self, "\nUsage:^3 cmd mobspawn monster\n");
+                       sprint(self, "\nUsage:^3 cmd mobspawn <random> <monster> [movetype]\n");
                        sprint(self, "  See 'cmd mobspawn list' for available arguments.\n");
-                       sprint(self, "  Argument 'random' spawns a randomly selected monster.\n");
+                       sprint(self, "  Argument 'random' spawns a random monster.\n");
+                       sprint(self, "  Monster will follow the owner if second argument is not defined.\n");
                        return;
                }
        }
index 73c04ba910af3c71f3145c72c329467a0c6922fd..8c96f2d7306dd90f6c15f4486762ff4343ec2050 100644 (file)
@@ -139,7 +139,7 @@ void GameCommand_adminmsg(float request, float argc)
        }
 }
 
-void GameCommand_butcher(float request)
+void GameCommand_mobbutcher(float request)
 {
        switch(request)
        {
@@ -1772,7 +1772,7 @@ void GameCommand_(float request)
 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
 #define SERVER_COMMANDS(request,arguments,command) \
        SERVER_COMMAND("adminmsg", GameCommand_adminmsg(request, arguments), "Send an admin message to a client directly") \
-       SERVER_COMMAND("butcher", GameCommand_butcher(request), "Instantly removes all monsters on the map") \
+       SERVER_COMMAND("mobbutcher", GameCommand_mobbutcher(request), "Instantly removes all monsters on the map") \
        SERVER_COMMAND("allready", GameCommand_allready(request), "Restart the server and reset the players") \
        SERVER_COMMAND("allspec", GameCommand_allspec(request, arguments), "Force all players to spectate") \
        SERVER_COMMAND("anticheat", GameCommand_anticheat(request, arguments), "Create an anticheat report for a client") \