diff --git a/ai_animation/src/gameState.ts b/ai_animation/src/gameState.ts index a2ffe48..79dd6ae 100644 --- a/ai_animation/src/gameState.ts +++ b/ai_animation/src/gameState.ts @@ -97,7 +97,7 @@ class GameState { constructor(boardName: AvailableMaps) { this.phaseIndex = 0 this.boardName = boardName - this.currentPower = getRandomPower() + this.currentPower = null; this.gameId = 1 // State locks this.isSpeaking = false @@ -156,6 +156,8 @@ class GameState { playBtn.disabled = false; speedSelector.disabled = false; + // Set the poewr if the game specifies it, else random. + this.currentPower = this.gameData.power !== undefined ? this.gameData.power : getRandomPower(); const momentsFilePath = `./games/${this.gameId}/moments.json`; diff --git a/ai_animation/src/main.ts b/ai_animation/src/main.ts index 18c8532..81aad4a 100644 --- a/ai_animation/src/main.ts +++ b/ai_animation/src/main.ts @@ -46,6 +46,9 @@ function initScene() { // Load default game file if in debug mode if (config.isDebugMode || isStreamingMode) { gameState.loadGameFile(0); + + // Initialize info panel + logger.updateInfoPanel(); } // Initialize debug menu if in debug mode @@ -69,8 +72,6 @@ function initScene() { // Kick off animation loop animate(); - // Initialize info panel - logger.updateInfoPanel(); } function createCameraPan(): Group { diff --git a/ai_animation/src/types/gameState.ts b/ai_animation/src/types/gameState.ts index 4fd4763..e1e6cc3 100644 --- a/ai_animation/src/types/gameState.ts +++ b/ai_animation/src/types/gameState.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { PowerENUMSchema } from './map'; +import { PowerENUM, PowerENUMSchema } from './map'; import { OrderFromString } from './unitOrders'; import { ProvinceENUMSchema } from './map'; @@ -67,6 +67,7 @@ const PhaseSchema = z.object({ export const GameSchema = z.object({ map: z.string(), id: z.string(), + power: PowerENUMSchema.optional(), phases: z.array(PhaseSchema), });