This commit is contained in:
evanpelle
2025-03-27 20:43:56 -07:00
committed by GitHub
parent 9ed1fe865c
commit d8fe41de7a
37 changed files with 767 additions and 387 deletions
+8 -3
View File
@@ -5,6 +5,7 @@ import {
ClientID,
ClientMessage,
ClientMessageSchema,
ClientSendWinnerMessage,
GameConfig,
GameInfo,
Intent,
@@ -45,7 +46,7 @@ export class GameServer {
private lastPingUpdate = 0;
private winner: ClientID | null = null;
private winner: ClientSendWinnerMessage = null;
// This field is currently only filled at victory
private allPlayersStats: AllPlayersStats = {};
@@ -86,6 +87,9 @@ export class GameServer {
if (gameConfig.instantBuild != null) {
this.gameConfig.instantBuild = gameConfig.instantBuild;
}
if (gameConfig.gameMode != null) {
this.gameConfig.gameMode = gameConfig.gameMode;
}
}
public addClient(client: Client, lastTurn: number) {
@@ -171,7 +175,7 @@ export class GameServer {
client.hashes.set(clientMsg.turnNumber, clientMsg.hash);
}
if (clientMsg.type == "winner") {
this.winner = clientMsg.winner;
this.winner = clientMsg;
this.allPlayersStats = clientMsg.allPlayersStats;
}
} catch (error) {
@@ -318,7 +322,8 @@ export class GameServer {
this.turns,
this._startTime,
Date.now(),
this.winner,
this.winner.winner,
this.winner.winnerType,
this.allPlayersStats,
),
);