Skip to content

Commit

Permalink
try to fix possible issue with battle being tried to start over and o…
Browse files Browse the repository at this point in the history
…ver again (#2863)
  • Loading branch information
DeinFreund authored Apr 6, 2024
1 parent dfafef5 commit 144f611
Showing 1 changed file with 10 additions and 5 deletions.
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

0 comments on commit 144f611

Please sign in to comment.