configurable preparation time

This commit is contained in:
Restart2008
2025-10-29 20:58:35 -07:00
parent ca6ca524ae
commit 227ac01fa1
2 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -629,7 +629,9 @@ class Client {
incrementGamesPlayed();
try {
window.PageOS.session.newPageView();
if (window.PageOS && window.PageOS.session) {
window.PageOS.session.newPageView();
}
} catch (e) {
console.error("Error calling newPageView", e);
}
+4 -2
View File
@@ -22,6 +22,7 @@ import {
import { TileRef } from "../game/GameMap";
import { PlayerView } from "../game/GameView";
import { UserSettings } from "../game/UserSettings";
import { getPreparationTimeSeconds } from "../gamemodes/nuke-wars/guards";
import { GameConfig, GameID, TeamCountConfig } from "../Schemas";
import { NukeType } from "../StatsSchemas";
import { assertNever, sigmoid, simpleHash, within } from "../Util";
@@ -632,12 +633,13 @@ export class DefaultConfig implements Config {
}
numPreparationPhaseTurns(): number {
// Preparation phase duration (Nuke Wars uses a 3 minute prep phase)
// Preparation phase duration for Nuke Wars is configurable via preparationTimeSeconds
if (
this._gameConfig.gameMode === GameMode.Team &&
this._gameConfig.teamGameType === TeamGameType.NukeWars
) {
return 180 * 10; // 180 seconds * 10 ticks/sec
const seconds = getPreparationTimeSeconds(this._gameConfig);
return seconds * 10; // ticks are 100ms
}
return 0;
}