fix: don't report game as Lobby phase when players leave mid-game

After a player left, the server would fall back to Lobby phase if player
count dropped below the max — even if the game had already started.
Now checks hasStarted() before reporting Lobby phase.
This commit is contained in:
evanpelle
2026-03-11 21:30:04 -07:00
parent 3013133d08
commit 4cfefdfb02
+1 -1
View File
@@ -817,7 +817,7 @@ export class GameServer {
this.gameConfig.gameType === GameType.Public &&
this.gameConfig.maxPlayers &&
this.activeClients.length < this.gameConfig.maxPlayers;
if (lessThanLifetime && notEnoughPlayers) {
if (lessThanLifetime && notEnoughPlayers && !this.hasStarted()) {
return GamePhase.Lobby;
}
const warmupOver = now > this.startsAt! + 30 * 1000;