This PR changes code in SpectatorQueue.as to fix a bug where the queue button in the top right corner turns grey whenever a different player changes teams. The culprit is the line client_selected = -99; in onPlayerChangedTeam().
Since the newteam == this.getSpectatorTeamNum() check and the oldteam != this.getSpectatorTeamNum() && player.isMyPlayer() check are basicly the same (player changes from red/blue team to spectator), I mixed both code blocks and also moved the line client_selected = -99; inside it. SetupQueueGUI(this); also should only run if player.isMyPlayer() is true.
I tested in a dedicated CTF server with bots. Although the queue logic doesn't work well with bots, when there are enough bots it is possible to queue for one team without instantly entering it, allowing me to test the bug scenario. When queuing for a team and having a bot player change its team, my button previously turned grey but after applying the above fix it doesn't.
The sound for successfully getting entered into a team will still play at the correct time.
It plays only when switching from spectator to red/blue via the queue.
Current build
After this PR
Switch from spectator to red/blue via queue
Sound plays
Sound plays
Switch from spectator to red/blue via team button while queuing
Status
Description
Fixes https://github.com/transhumandesign/kag-base/issues/1528
This PR changes code in
SpectatorQueue.as
to fix a bug where the queue button in the top right corner turns grey whenever a different player changes teams. The culprit is the lineclient_selected = -99;
inonPlayerChangedTeam()
.Since the
newteam == this.getSpectatorTeamNum()
check and theoldteam != this.getSpectatorTeamNum() && player.isMyPlayer()
check are basicly the same (player changes from red/blue team to spectator), I mixed both code blocks and also moved the lineclient_selected = -99;
inside it.SetupQueueGUI(this);
also should only run ifplayer.isMyPlayer()
is true.I tested in a dedicated CTF server with bots. Although the queue logic doesn't work well with bots, when there are enough bots it is possible to queue for one team without instantly entering it, allowing me to test the bug scenario. When queuing for a team and having a bot player change its team, my button previously turned grey but after applying the above fix it doesn't.
The sound for successfully getting entered into a team will still play at the correct time. It plays only when switching from spectator to red/blue via the queue.