Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to fix issue with battle being tried to start over and over again #2863

Merged
merged 5 commits into from
Apr 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions ZkLobbyServer/autohost/Commands/CmdStart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ public override async Task ExecuteArmed(ServerBattle battle, Say e)
}
if (wait)
{
await battle.SayBattle("Game starting in 10 seconds...");
battle.BlockPolls(10);
await battle.SayBattle("Game starting in 10 seconds...");
startTimer = new Timer(10000);
startTimer.Enabled = true;
startTimer.AutoReset = false;
startTimer.Elapsed += (t, s) => { StartGame(battle); };
startTimer.Enabled = true;
startTimer.Elapsed += (t, s) => {
startTimer.Enabled = false;
StartGame(battle);
};
}
else
{
Expand All @@ -59,9 +62,11 @@ public override int GetPollWinMargin(ServerBattle battle, int numVoters)
{
// Require one more vote to start a game with uneven teams so at least one player in the smaller
// team needs to agree to start the game. This is particularly relevant for the 2v1 case.
if (battle.Mode == PlasmaShared.AutohostMode.Teams) {
if (battle.Mode == PlasmaShared.AutohostMode.Teams)
{
return base.GetPollWinMargin(battle, numVoters) + numVoters % 2;
} else
}
else
{
return base.GetPollWinMargin(battle, numVoters);
}
Expand Down
Loading