diff --git a/@sammo/game_logic/src/LazyEntityUpdater.ts b/@sammo/game_logic/src/LazyEntityUpdater.ts index c70b18f..fec7620 100644 --- a/@sammo/game_logic/src/LazyEntityUpdater.ts +++ b/@sammo/game_logic/src/LazyEntityUpdater.ts @@ -1,7 +1,7 @@ import type { IResourceController, ValidEntity, ValidEntityType } from "./ResourceController.js"; export abstract class LazyEntityUpdater{ - protected abstract readonly _indirectNames: (keyof Entity)[]; + protected abstract readonly _indirectNames: ReadonlyArray; protected abstract readonly _entityType: ValidEntityType; protected abstract readonly _raw: Entity; diff --git a/@sammo/game_logic/src/ResourceController.ts b/@sammo/game_logic/src/ResourceController.ts index 30554d4..0d1d698 100644 --- a/@sammo/game_logic/src/ResourceController.ts +++ b/@sammo/game_logic/src/ResourceController.ts @@ -9,6 +9,7 @@ import type { ITroopEntity } from "./TroopEntity.js"; import type { LazyEntityUpdater } from "./LazyEntityUpdater.js"; import type { ICityEntity } from "./CityEntity.js"; import type { INationEntity } from "./NationEntity.js"; +import type { ValuesOf } from "@sammo/util"; export type ValidEntityList = { 'General': IGeneralEntity; @@ -17,7 +18,7 @@ export type ValidEntityList = { 'Troop': ITroopEntity; }; -export type ValidEntity = ValidEntityList[keyof ValidEntityList]; +export type ValidEntity = ValuesOf; export type ValidEntityType = Entity extends ValidEntityList[infer T extends keyof ValidEntityList] ? T : never; export interface IResourceController{ @@ -29,7 +30,7 @@ export interface IResourceController{ getNation(id: NationID): Nation | undefined; getGeneral(id: GeneralID): General | undefined; - getGameEnv(): Promise; + getGameEnv(): GameEnv; findAllNations(): Map; findAllCities(): Map; @@ -45,17 +46,11 @@ export interface IResourceController{ _getAllChanges(): Map; - - setDirtyGeneral(rawGeneral: IGeneralEntity): void; - setDirtyCity(city: City): void; - setDirtyTroop(troop: Troop | TroopID): void; - setDirtyNation(nation: Nation): void; - setDirty(entity: LazyEntityUpdater): void; createGeneral(raw: IGeneralEntity): General; + createNation(raw: INationEntity): Nation; createTroop(raw: ITroopEntity): Troop; - //createNation reserveDeleteTroop(id: TroopID): void; reserveDeleteGeneral(id: GeneralID): void;