From: bones_was_here Date: Sun, 12 Jun 2022 00:00:05 +0000 (+1000) Subject: sv_maxidle_playertospectator: fix joining players getting moved to spec immediately X-Git-Tag: xonotic-v0.8.5~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=360d5ed5afd2d5b52131b6633e9c38d2ee069b57;p=xonotic%2Fxonotic-data.pk3dir.git 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. --- diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 9feb068a8..3ad5749d8 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 80892e652..0d248ca13 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();