]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/cmd.qc
Manual riddance of remaining "if not".
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / cmd.qc
index 36567b4986af079bc7a7a9270afef42fe0f90ec0..44cc46a02bcd7bad0a07422ec6dc8b11917c9c5e 100644 (file)
@@ -5,7 +5,7 @@
 
 float SV_ParseClientCommand_floodcheck()
 {
-       if not(timeout_status) // not while paused
+       if (!timeout_status) // not while paused
        {
                if(time <= (self.cmd_floodtime + autocvar_sv_clientcommand_antispam_time))
                {
@@ -81,7 +81,7 @@ void ClientCommand_clientversion(float request, float argc) // internal command,
                {
                        if(argv(1) != "")
                        {
-                               if(self.flags & FL_CLIENT)
+                               if(IS_CLIENT(self))
                                {
                                        self.version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1)));
                                        
@@ -148,17 +148,17 @@ void ClientCommand_join(float request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if(self.flags & FL_CLIENT)
+                       if(IS_CLIENT(self))
                        {
-                               if(self.classname != "player" && !lockteams && !g_arena)
+                               if(!IS_PLAYER(self) && !lockteams && !g_arena)
                                {
                                        if(nJoinAllowed(self)) 
                                        {
-                                               if(g_ca) { self.caplayer = 1; }
                                                if(autocvar_g_campaign) { campaign_bots_may_start = 1; }
-                                               
+
                                                self.classname = "player";
                                                PlayerScore_Clear(self);
+                                               Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_PREVENT_JOIN);
                                                Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_JOIN_PLAY, self.netname);
                                                PutClientInServer();
                                        }
@@ -188,12 +188,14 @@ void ClientCommand_ready(float request) // todo: anti-spam for toggling readynes
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if(self.flags & FL_CLIENT)
+                       if(IS_CLIENT(self))
                        {
-                               if(inWarmupStage || autocvar_sv_ready_restart || g_race_qualifying == 2)
+                               if(warmup_stage || autocvar_sv_ready_restart || g_race_qualifying == 2)
                                {
                                        if(!readyrestart_happened || autocvar_sv_ready_restart_repeatable)
                                        {
+                                               if(time < game_starttime) // game is already restarting
+                                                       return;
                                                if (self.ready) // toggle
                                                {
                                                        self.ready = FALSE;
@@ -206,7 +208,7 @@ void ClientCommand_ready(float request) // todo: anti-spam for toggling readynes
                                                }
 
                                                // cannot reset the game while a timeout is active!
-                                               if not(timeout_status)
+                                               if (!timeout_status)
                                                        ReadyCount();
                                        } else {
                                                sprint(self, "^1Game has already been restarted\n");
@@ -274,11 +276,11 @@ void ClientCommand_selectteam(float request, float argc)
                {
                        if(argv(1) != "")
                        {
-                               if(self.flags & FL_CLIENT)
+                               if(IS_CLIENT(self))
                                {
                                        if(teamplay)
-                                               if not(self.team_forced > 0) 
-                                                       if not(lockteams) 
+                                               if(self.team_forced <= 0)
+                                                       if (!lockteams) 
                                                        {
                                                                float selection;
                                                                
@@ -390,7 +392,7 @@ void ClientCommand_spectate(float request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if(self.flags & FL_CLIENT)
+                       if(IS_CLIENT(self))
                        {
                                if(g_arena) { return; } 
                                if(g_lms)
@@ -410,12 +412,12 @@ void ClientCommand_spectate(float request)
                                        }
                                }
                                
-                               if(self.classname == "player" && autocvar_sv_spectate == 1) 
+                               if(IS_PLAYER(self) && autocvar_sv_spectate == 1) 
                                        ClientKill_TeamChange(-2); // observe
-                               
+
                                // in CA, allow a dead player to move to spectators (without that, caplayer!=0 will be moved back to the player list)
                                // note: if arena game mode is ever done properly, this needs to be removed.
-                               if(g_ca && self.caplayer && (self.classname == "spectator" || self.classname == "observer"))
+                               if(self.caplayer && (IS_SPEC(self) || IS_OBSERVER(self)))
                                {
                                        sprint(self, "WARNING: you will spectate in the next round.\n");
                                        self.caplayer = 0;