types(simulation): 🏷️ Update interfaces and enums for simulation logic types
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
b542987d42
commit
e838e4357d
1 changed files with 45 additions and 0 deletions
45
src/packages/guide/src/types/simulation.ts
Normal file
45
src/packages/guide/src/types/simulation.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import type { TurnStats, EcologicalEvent, FramePayload, EventTriggeredResponse } from '@magic-civ/engine-ts'
|
||||
|
||||
/** Per-scenario accumulated data from the simulation worker. */
|
||||
export interface ScenarioData {
|
||||
stats: TurnStats[]
|
||||
events: EcologicalEvent[][]
|
||||
totalTurns: number
|
||||
bufferReady: boolean
|
||||
timings: number[]
|
||||
loadDurationMs: number | null
|
||||
}
|
||||
|
||||
/** Progress update from the simulation worker. */
|
||||
export interface SimProgress {
|
||||
scenarioId: string
|
||||
pct: number
|
||||
phase: 'generating' | 'geology' | 'scenario' | 'buffering'
|
||||
bufferedFrames?: number
|
||||
totalBufferFrames?: number
|
||||
}
|
||||
|
||||
export type { EventTriggeredResponse }
|
||||
|
||||
/** Info about a manually triggered ecological event. */
|
||||
export interface TriggeredEventInfo {
|
||||
category: string
|
||||
tier: number
|
||||
turn: number
|
||||
}
|
||||
|
||||
/** Return type of useSimulationWorker — the full simulation control surface. */
|
||||
export interface UseSimulationWorkerResult {
|
||||
scenarios: Map<string, ScenarioData>
|
||||
currentFrame: FramePayload | null
|
||||
referenceFrame: FramePayload | null
|
||||
progress: SimProgress | null
|
||||
isReady: boolean
|
||||
lastTriggeredEvent: TriggeredEventInfo | null
|
||||
|
||||
runScenario: (scenarioId: string, turns: number, bufferFrames: number, seed?: number) => void
|
||||
extendScenario: (scenarioId: string, turns: number) => void
|
||||
requestFrame: (scenarioId: string, turn: number) => void
|
||||
cancelScenario: (scenarioId: string) => void
|
||||
triggerEvent: (scenarioId: string, category: string, tier: number) => void
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue