From 360d5ed5afd2d5b52131b6633e9c38d2ee069b57 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Sun, 12 Jun 2022 10:00:05 +1000 Subject: [PATCH] sv_maxidle_playertospectator: fix joining players getting moved to spec immediately In gametypes without teams, if the player left the welcome dialog open for the duration of sv_maxidle_playertospectator and then clicked join, they were immediately moved back to spec for idling. This could happen with any menu dialog or console command that allowed joining without changing CSQC button state or mouse angle. It was not noticeable prior to !1021 because pressing jump to join changed the player's button state which reset their idlesince. sv_maxidle_minplayers would have prevented this being found in local testing. --- qcsrc/server/command/cmd.qc | 1 + qcsrc/server/teamplay.qc | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 9feb068a81..3ad5749d8a 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -282,6 +282,7 @@ void ClientCommand_join(entity caller, int request) else if(time < CS(caller).jointime + MIN_SPEC_TIME) CS(caller).autojoin_checked = -1; } + CS(caller).parm_idlesince = time; return; // never fall through to usage } diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 80892e6528..0d248ca138 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -247,7 +247,6 @@ bool SetPlayerTeam(entity player, int team_index, int type) { KillPlayerForTeamChange(player); PlayerScore_Clear(player); // works only in game modes without teams - CS(player).parm_idlesince = time; if (!IS_BOT_CLIENT(player)) TeamBalance_AutoBalanceBots(); -- 2.39.2