mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 09:10:42 +00:00
fix multiplayer
This commit is contained in:
@@ -184,6 +184,13 @@ export class GameServer {
|
||||
if (gameConfig.waterNukes !== undefined) {
|
||||
this.gameConfig.waterNukes = gameConfig.waterNukes ?? undefined;
|
||||
}
|
||||
if (gameConfig.invasionMode !== undefined) {
|
||||
this.gameConfig.invasionMode = gameConfig.invasionMode;
|
||||
}
|
||||
if (gameConfig.invasionGracePeriod !== undefined) {
|
||||
this.gameConfig.invasionGracePeriod =
|
||||
gameConfig.invasionGracePeriod ?? undefined;
|
||||
}
|
||||
this.gameConfig.hostCheats = gameConfig.hostCheats;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,4 +85,17 @@ describe("GameLifecycle", () => {
|
||||
await expect(game.end()).resolves.toBeUndefined();
|
||||
expect((game as any)._hasEnded).toBe(true);
|
||||
});
|
||||
|
||||
it("propagates invasion mode settings through updateGameConfig", () => {
|
||||
// Regression: the host's config update is an allowlist; invasion fields
|
||||
// must be copied or private matches never start the invasion.
|
||||
const game = new GameServer("test-game", mockLogger, Date.now(), {
|
||||
gameType: GameType.Private,
|
||||
} as any);
|
||||
|
||||
game.updateGameConfig({ invasionMode: true, invasionGracePeriod: 5 });
|
||||
|
||||
expect((game as any).gameConfig.invasionMode).toBe(true);
|
||||
expect((game as any).gameConfig.invasionGracePeriod).toBe(5);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user