move into config

This commit is contained in:
Ryan Barlow
2026-01-26 10:17:09 +00:00
parent a430cead0b
commit 263c4cc693
3 changed files with 20 additions and 21 deletions
+19 -1
View File
@@ -4,6 +4,7 @@ import {
Difficulty,
Game,
GameMode,
GameType,
Gold,
Player,
PlayerInfo,
@@ -24,7 +25,24 @@ import { Config, GameEnv, NukeMagnitude, ServerConfig, Theme } from "./Config";
import { Env } from "./Env";
import { PastelTheme } from "./PastelTheme";
import { PastelThemeDark } from "./PastelThemeDark";
import { spawnPhaseTurns } from "./Timing";
export const TICKS_PER_SECOND = 10;
export const SPAWN_PHASE_TICKS = {
singleplayer: 100,
multiplayer: 300,
} as const;
export type GameTypeLike = GameType | string | undefined;
export function spawnPhaseTurns(gameType: GameTypeLike): number {
return gameType === GameType.Singleplayer
? SPAWN_PHASE_TICKS.singleplayer
: SPAWN_PHASE_TICKS.multiplayer;
}
export function spawnPhaseSeconds(gameType: GameTypeLike): number {
return spawnPhaseTurns(gameType) / TICKS_PER_SECOND;
}
const DEFENSE_DEBUFF_MIDPOINT = 150_000;
const DEFENSE_DEBUFF_DECAY_RATE = Math.LN2 / 50000;
-19
View File
@@ -1,19 +0,0 @@
import { GameType } from "../game/Game";
export const TICKS_PER_SECOND = 10;
export const SPAWN_PHASE_TICKS = {
singleplayer: 100,
multiplayer: 300,
} as const;
export type GameTypeLike = GameType | string | undefined;
export function spawnPhaseTurns(gameType: GameTypeLike): number {
return gameType === GameType.Singleplayer
? SPAWN_PHASE_TICKS.singleplayer
: SPAWN_PHASE_TICKS.multiplayer;
}
export function spawnPhaseSeconds(gameType: GameTypeLike): number {
return spawnPhaseTurns(gameType) / TICKS_PER_SECOND;
}
+1 -1
View File
@@ -1,6 +1,6 @@
import { z } from "zod";
import { GameInfo } from "../core/Schemas";
import { spawnPhaseSeconds } from "../core/configuration/Timing";
import { spawnPhaseSeconds } from "../core/configuration/DefaultConfig";
import { GameMode } from "../core/game/Game";
export const PlayerInfoSchema = z.object({