diff --git a/web/src/lib/codesync/GameSessionTurn.ts b/web/src/lib/codesync/GameSessionTurn.ts index 0b6fd630..aa04cdb8 100644 --- a/web/src/lib/codesync/GameSessionTurn.ts +++ b/web/src/lib/codesync/GameSessionTurn.ts @@ -1,18 +1,20 @@ // codesync: UfoGameLib.State.GameSessionTurn import _ from 'lodash' -import type { GameEventBase } from './GameEvent' +import type { GameEvent } from './GameEvent' import type { GameState } from './GameState' +import type { PlayerActionEvent } from './PlayerActionEvent' +import type { WorldEvent } from './WorldEvent' export type GameSessionTurn = { - readonly EventsUntilStartState: GameEventBase[] + readonly EventsUntilStartState: WorldEvent[] readonly StartState: GameState - readonly EventsInTurn: GameEventBase[] + readonly EventsInTurn: PlayerActionEvent[] readonly EndState: GameState - readonly AdvanceTimeEvent?: GameEventBase | undefined + readonly AdvanceTimeEvent?: PlayerActionEvent | undefined readonly NextEventId?: number | undefined } -export function getEvents(turn: GameSessionTurn): GameEventBase[] { +export function getEvents(turn: GameSessionTurn): GameEvent[] { return [ ...turn.EventsUntilStartState, ...turn.EventsInTurn, @@ -22,7 +24,7 @@ export function getEvents(turn: GameSessionTurn): GameEventBase[] { export function getGameEvents( turns: readonly GameSessionTurn[], -): readonly GameEventBase[] { +): readonly GameEvent[] { return _.flatMap(turns, (turn) => getEvents(turn)) } diff --git a/web/src/lib/gameSession/GameSessionData.ts b/web/src/lib/gameSession/GameSessionData.ts index bcec259b..3e4f9d44 100644 --- a/web/src/lib/gameSession/GameSessionData.ts +++ b/web/src/lib/gameSession/GameSessionData.ts @@ -5,7 +5,7 @@ import _ from 'lodash' import { addTurnToGameEvent, - type GameEventBase, + type GameEvent, type GameEventWithTurn, } from '../codesync/GameEvent' import { @@ -99,7 +99,7 @@ export class GameSessionData { turns.at(0)!, ) - const gameEvents: readonly GameEventBase[] = getGameEvents(turns) + const gameEvents: readonly GameEvent[] = getGameEvents(turns) if (!_.isEmpty(gameEvents)) { const firstEventId = gameEvents.at(0)!.Id for (const eventIndex of _.range(1, gameEvents.length)) {