mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 15:54:36 +00:00
move into config
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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,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({
|
||||
|
||||
Reference in New Issue
Block a user