Skip to content

Commit

Permalink
Ignore player join events if they happen after the game has started o…
Browse files Browse the repository at this point in the history
…r finished
  • Loading branch information
Quantumplation committed Nov 30, 2024
1 parent a7c7ea6 commit 2257af8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions referee/referee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ hydra.onNewGame = async (newGameId, humanCount, botCount, ephemeralKey) => {
});
};
hydra.onPlayerJoin = async (gameId, ephemeralKeys) => {
if (gameId || done) {
console.log("Game is already done, ignoring player join");
return;
}
const newPlayer = ephemeralKeys[ephemeralKeys.length - 1];
console.log(`Observed player join for game ${gameId}, ${newPlayer}`);
await sendEvent(gameId, {
Expand Down

0 comments on commit 2257af8

Please sign in to comment.