]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Block spectators from changing their ready status
authorbones_was_here <bones_was_here@xonotic.au>
Wed, 23 Nov 2022 15:14:31 +0000 (01:14 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 6 Jan 2023 07:16:34 +0000 (17:16 +1000)
This is consistent with the existing behaviour of setting .ready to
false when a player switches to spectating.

Also reduces indenting and removes a condition that's no longer needed
since sv_ready_restart was removed.

qcsrc/server/command/cmd.qc

index e2d71597f44ae1f20369a8b6c7e2e2c59f38c90e..50b71957bd689efb542bc16afbd154194edd9281 100644 (file)
@@ -374,27 +374,22 @@ void ClientCommand_ready(entity caller, int request)
                case CMD_REQUEST_COMMAND:
                {
                        if (IS_CLIENT(caller) && caller.last_ready < time - 3)
+                       if (warmup_stage || g_race_qualifying == 2)
+                       if (IS_PLAYER(caller) || INGAME_JOINED(caller))
                        {
-                               if (warmup_stage || g_race_qualifying == 2)
+                               if (caller.ready) // toggle
                                {
-                                       if (time < game_starttime) // game is already restarting
-                                               return;
-                                       if (caller.ready)            // toggle
-                                       {
-                                               caller.ready = false;
-                                               if (IS_PLAYER(caller) || INGAME_JOINED(caller))
-                                                       bprint(playername(caller.netname, caller.team, false), "^2 is ^1NOT^2 ready\n");
-                                       }
-                                       else
-                                       {
-                                               caller.ready = true;
-                                               if (IS_PLAYER(caller) || INGAME_JOINED(caller))
-                                                       bprint(playername(caller.netname, caller.team, false), "^2 is ready\n");
-                                       }
-
-                                       caller.last_ready = time;
-                                       ReadyCount();
+                                       caller.ready = false;
+                                       bprint(playername(caller.netname, caller.team, false), "^2 is ^1NOT^2 ready\n");
                                }
+                               else
+                               {
+                                       caller.ready = true;
+                                       bprint(playername(caller.netname, caller.team, false), "^2 is ready\n");
+                               }
+
+                               caller.last_ready = time;
+                               ReadyCount();
                        }
                        return;  // never fall through to usage
                }