]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
sv_maxidle_playertospectator: fix joining players getting moved to spec immediately
authorbones_was_here <bones_was_here@xa.org.au>
Sun, 12 Jun 2022 00:00:05 +0000 (10:00 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Sun, 12 Jun 2022 00:00:05 +0000 (10:00 +1000)
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
qcsrc/server/teamplay.qc

index 9feb068a812bdd377f7bf9a6822cdf0217a52104..3ad5749d8a423a216b1bdc7cdaea2cac34d07e01 100644 (file)
@@ -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
                }
index 80892e652891804e7fa6f83ff2f4cd623dcdd840..0d248ca1382290ab28885e07fa73a0c47ad3eaee 100644 (file)
@@ -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();