From b26d53a276a706f023b09c568cbdf7afaa8e92a5 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Fri, 7 Jun 2024 19:08:38 +1000 Subject: [PATCH] join queue: fix removal of AFK players Was broken in 433e811eb85f24adf86b8a81679a5c9a6c273337 Improves documentation. Signed-off-by: bones_was_here --- qcsrc/server/client.qc | 4 ++++ qcsrc/server/clientkill.qc | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 3016275b9..0d804177b 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2900,6 +2900,10 @@ void PlayerFrame (entity this) else Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_MOVETOSPEC_IDLING, this.netname, maxidle_time); PutObserverInServer(this, true, true); + // Can't do this in PutObserverInServer() or SetPlayerTeam() cos it causes + // mouse2 (change spectate mode) to kick the player off the join queue. + this.wants_join = 0; + this.team_selected = false; // when the player is kicked off the server, these are called in ClientDisconnect() if (!TeamBalance_QueuedPlayersTagIn(this)) if (autocvar_g_balance_teams_remove) diff --git a/qcsrc/server/clientkill.qc b/qcsrc/server/clientkill.qc index d61481ab0..b8f128a33 100644 --- a/qcsrc/server/clientkill.qc +++ b/qcsrc/server/clientkill.qc @@ -28,10 +28,12 @@ void ClientKill_Now_TeamChange(entity this) if (this.wants_join) { - this.wants_join = 0; - this.team_selected = false; Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_QUEUE, this.netname); SetPlayerTeam(this, -1, TEAM_CHANGE_SPECTATOR); + // Can't do this in PutObserverInServer() or SetPlayerTeam() cos it causes + // mouse2 (change spectate mode) to kick the player off the join queue. + this.wants_join = 0; + this.team_selected = false; } else { -- 2.39.2