mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-28 01:14:15 +00:00
teams (#349)
This commit is contained in:
@@ -2,7 +2,7 @@ import { ServerConfig } from "../core/configuration/Config";
|
||||
import { GameConfig, GameID } from "../core/Schemas";
|
||||
import { Client } from "./Client";
|
||||
import { GamePhase, GameServer } from "./GameServer";
|
||||
import { Difficulty, GameMapType, GameType } from "../core/game/Game";
|
||||
import { Difficulty, GameMapType, GameMode, GameType } from "../core/game/Game";
|
||||
import { Logger } from "winston";
|
||||
|
||||
export class GameManager {
|
||||
@@ -38,6 +38,7 @@ export class GameManager {
|
||||
infiniteGold: false,
|
||||
infiniteTroops: false,
|
||||
instantBuild: false,
|
||||
gameMode: GameMode.FFA,
|
||||
bots: 400,
|
||||
...gameConfig,
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -165,6 +165,7 @@ export function startWorker() {
|
||||
bots: req.body.bots,
|
||||
disableNPCs: req.body.disableNPCs,
|
||||
disableNukes: req.body.disableNukes,
|
||||
gameMode: req.body.gameMode,
|
||||
});
|
||||
res.status(200).json({ success: true });
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user