transhumandesign / kag-base

King Arthur's Gold base folder.
258 stars 119 forks source link

Queue puts you as waiting to join "any team" when waiting to join a certain team #1528

Open mugg91 opened 1 year ago

mugg91 commented 1 year ago

Description

1) As spectator, click "join red team" or "join blue team". 2) Notice that sometimes you will get put as waiting to join "any team".

Reproduction

Video - https://www.youtube.com/watch?v=qTy_kL6UCN0

mugg91 commented 1 year ago

It seems the problem is only graphical.

1) It's 4 blue players, 6 red players, I queue as "waiting to join red team" 2) The button turns grey. 3) It still correctly joins me into red team when a slot becomes available.

The issue itself, I have seen happening after another player becomes spectator. Not sure if it starts happening because player limit is exceeded by patreon players...

asumagic commented 1 year ago

@bunniewormy ping, I missed that issue.

mugg91 commented 7 months ago

In SpectatorQueue.as:

void onPlayerChangedTeam(CRules@ this, CPlayer@ player, u8 oldteam, u8 newteam)
{
    if (newteam == this.getSpectatorTeamNum())
    {
        SetupQueueGUI(this);
    }

    if (oldteam != this.getSpectatorTeamNum() && player.isMyPlayer()) 
    {
        hide = true;
        return;
    }

    if (this.get_bool(player.getUsername() + "_playsound"))
    {
        if (isClient() && player.isMyPlayer())
        {
            Sound::Play("AchievementUnlocked.ogg"); // TODO: different, distinct sound
        }

        this.set_bool(player.getUsername() + "_playsound", false);
    }

    client_selected = -99;
    RemoveFromQueue(player);
}

I think the line client_selected = -99; is the cause of the problem, making your button grey when someone before you switched teams. Maybe the issue is fixed by moving the line into the if (oldteam != this.getSpectatorTeamNum() && player.isMyPlayer()) code block. But I'm currently unable to test it.