From: Mario Date: Thu, 26 Dec 2013 05:28:44 +0000 (+1100) Subject: Attempt to clean up commands a bit X-Git-Tag: xonotic-v0.8.0~241^2^2~14 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d4ade03f3e140f422bc679ecd2d7ceafa8b0d6a9;p=xonotic%2Fxonotic-data.pk3dir.git Attempt to clean up commands a bit --- diff --git a/commands.cfg b/commands.cfg index 266cc8908..0ebdfe3cc 100644 --- a/commands.cfg +++ b/commands.cfg @@ -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 diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index fb8911258..7b1af114c 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -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 [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; } } diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 73c04ba91..8c96f2d73 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -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") \