mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-20 19:20:27 +00:00
have client send winner to server
This commit is contained in:
@@ -5,7 +5,6 @@ import WebSocket from 'ws';
|
||||
import { slog } from "./StructuredLog";
|
||||
import { CreateGameRecord } from "../core/Util";
|
||||
import { archive } from "./Archive";
|
||||
import { arc } from "d3";
|
||||
|
||||
|
||||
export enum GamePhase {
|
||||
@@ -31,6 +30,8 @@ export class GameServer {
|
||||
|
||||
private lastPingUpdate = 0
|
||||
|
||||
private winner: ClientID | null = null
|
||||
|
||||
constructor(
|
||||
public readonly id: string,
|
||||
public readonly createdAt: number,
|
||||
@@ -89,6 +90,9 @@ export class GameServer {
|
||||
this.lastPingUpdate = Date.now()
|
||||
client.lastPing = Date.now()
|
||||
}
|
||||
if (clientMsg.type == "winner") {
|
||||
this.winner = clientMsg.winner
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`error handline websocket request in game server: ${error}`)
|
||||
}
|
||||
@@ -190,7 +194,8 @@ export class GameServer {
|
||||
playerRecords,
|
||||
this.turns,
|
||||
this._startTime,
|
||||
Date.now()
|
||||
Date.now(),
|
||||
this.winner
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user