]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean up monster commands a bit more
authorMario <mario.mario@y7mail.com>
Mon, 6 Jan 2014 21:39:48 +0000 (08:39 +1100)
committerMario <mario.mario@y7mail.com>
Mon, 6 Jan 2014 21:39:48 +0000 (08:39 +1100)
qcsrc/server/command/cmd.qc

index af8d9c88cd5fbabd68e018a471e211eec2eed7be..9f636416a692486d53e0564cf892435f0b4dcee6 100644 (file)
@@ -193,28 +193,25 @@ void ClientCommand_mobedit(float request, float argc)
                                makevectors(self.v_angle);
                                WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 100, MOVE_NORMAL, self);
                                
-                               if(!autocvar_g_monsters_edit) { sprint(self, "Monster property editing is not enabled.\n"); }
-                               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
+                               if(!autocvar_g_monsters_edit) { sprint(self, "Monster property editing is not enabled.\n"); return; }
+                               if(trace_ent.flags & FL_MONSTER)
                                {
+                                       if(trace_ent.realowner != self) { sprint(self, "That monster does not belong to you.\n"); return; }
                                        switch(argv(1))
                                        {
                                                case "skin":
                                                {
                                                        if(trace_ent.monsterid != MON_MAGE)
                                                                trace_ent.skin = stof(argv(2));
-                                                       break;
+                                                       return;
                                                }
                                                case "movetarget":
                                                {
                                                        trace_ent.monster_moveflags = stof(argv(2));
-                                                       break;
+                                                       return;
                                                }
                                        }
                                }
-                               
-                               return;
                        }
                }
                default:
@@ -223,6 +220,7 @@ void ClientCommand_mobedit(float request, float argc)
                {
                        sprint(self, "\nUsage:^3 cmd mobedit [argument]\n");
                        sprint(self, "  Where 'argument' can be skin or movetarget.\n");
+                       sprint(self, "  Aim at your monster to edit its properties.\n");
                        return;
                }
        }
@@ -248,10 +246,6 @@ void ClientCommand_mobkill(float request)
                                Damage (trace_ent, world, world, trace_ent.health + trace_ent.max_health + 200, DEATH_KILL, trace_ent.origin, '0 0 0');
                                return;
                        }
-                       else
-                               sprint(self, "You need to aim at your monster to kill it.\n");
-                       
-                       return;
                }
        
                default:
@@ -284,15 +278,15 @@ void ClientCommand_mobspawn(float request, float argc)
                                return;
                        }
                        
-                       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(MUTATOR_CALLHOOK(AllowMobSpawning)) { sprint(self, "Monster spawning is currently disabled by a mutator.\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"); }
-                       else if(autocvar_g_campaign) { sprint(self, "You can't spawn monsters in campaign mode.\n"); }
-                       else if(self.deadflag != DEAD_NO) { sprint(self, "You can't spawn monsters while dead.\n"); }
-                       else if(self.monstercount >= autocvar_g_monsters_max_perplayer) { sprint(self, "You have spawned too many monsters, kill some before trying to spawn any more.\n"); }
-                       else if(totalspawned >= autocvar_g_monsters_max) { sprint(self, "The global maximum monster count has been reached, kill some before trying to spawn any more.\n"); }
+                       if(autocvar_g_monsters_max <= 0 || autocvar_g_monsters_max_perplayer <= 0) { sprint(self, "Monster spawning is disabled.\n"); return; }
+                       else if(!IS_PLAYER(self)) { sprint(self, "You can't spawn monsters while spectating.\n"); return; }
+                       else if(MUTATOR_CALLHOOK(AllowMobSpawning)) { sprint(self, "Monster spawning is currently disabled by a mutator.\n"); return; }
+                       else if(!autocvar_g_monsters) { Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_MONSTERS_DISABLED); return; }
+                       else if(self.vehicle) { sprint(self, "You can't spawn monsters while driving a vehicle.\n"); return; }
+                       else if(autocvar_g_campaign) { sprint(self, "You can't spawn monsters in campaign mode.\n"); return; }
+                       else if(self.deadflag != DEAD_NO) { sprint(self, "You can't spawn monsters while dead.\n"); return; }
+                       else if(self.monstercount >= autocvar_g_monsters_max_perplayer) { sprint(self, "You have spawned too many monsters, kill some before trying to spawn any more.\n"); return; }
+                       else if(totalspawned >= autocvar_g_monsters_max) { sprint(self, "The global maximum monster count has been reached, kill some before trying to spawn any more.\n"); return; }
                        else if(tospawn != "")
                        {
                                float found = 0, i;