diff --git a/@sammo/game_logic/src/City.ts b/@sammo/game_logic/src/City.ts index 7870fc1..70615fd 100644 --- a/@sammo/game_logic/src/City.ts +++ b/@sammo/game_logic/src/City.ts @@ -1,4 +1,4 @@ -import type { ICityEntity } from "./CityEntity.js"; +import type { ICityEntity } from "./Entity/CityEntity.js"; import { LazyEntityUpdater } from "./LazyEntityUpdater.js"; import type { IResourceController } from "./ResourceController.js"; import type { CityID } from "./defs.js"; diff --git a/@sammo/game_logic/src/CityEntity.ts b/@sammo/game_logic/src/Entity/CityEntity.ts similarity index 59% rename from @sammo/game_logic/src/CityEntity.ts rename to @sammo/game_logic/src/Entity/CityEntity.ts index 9931731..ab8a128 100644 --- a/@sammo/game_logic/src/CityEntity.ts +++ b/@sammo/game_logic/src/Entity/CityEntity.ts @@ -1,4 +1,4 @@ -import type { CityID, CityName, NationID } from "./defs.js"; +import type { CityID, CityName, NationID } from "../defs.js"; export interface ICityEntity{ id: CityID; diff --git a/@sammo/game_logic/src/GeneralEntity.ts b/@sammo/game_logic/src/Entity/GeneralEntity.ts similarity index 97% rename from @sammo/game_logic/src/GeneralEntity.ts rename to @sammo/game_logic/src/Entity/GeneralEntity.ts index 7c618e8..b09ea2c 100644 --- a/@sammo/game_logic/src/GeneralEntity.ts +++ b/@sammo/game_logic/src/Entity/GeneralEntity.ts @@ -1,4 +1,4 @@ -import type { DiplomaticPermission, GeneralID, GeneralName, ItemID, ItemKeyType, NationID, NpcType, OfficerLevel, OwnerID, OwnerName, PersonalityType, SpecialityDomesticType, SpecialityWarType, TroopID } from "./defs.js"; +import type { DiplomaticPermission, GeneralID, GeneralName, ItemID, ItemKeyType, NationID, NpcType, OfficerLevel, OwnerID, OwnerName, PersonalityType, SpecialityDomesticType, SpecialityWarType, TroopID } from "../defs.js"; export interface IGeneralEntity { id: GeneralID; diff --git a/@sammo/game_logic/src/NationEntity.ts b/@sammo/game_logic/src/Entity/NationEntity.ts similarity index 93% rename from @sammo/game_logic/src/NationEntity.ts rename to @sammo/game_logic/src/Entity/NationEntity.ts index 80df752..cbb2771 100644 --- a/@sammo/game_logic/src/NationEntity.ts +++ b/@sammo/game_logic/src/Entity/NationEntity.ts @@ -1,4 +1,4 @@ -import type { CityID, NationID, NationName, NationType } from "./defs.js"; +import type { CityID, NationID, NationName, NationType } from "../defs.js"; export interface INationEntity{ id: NationID; diff --git a/@sammo/game_logic/src/TroopEntity.ts b/@sammo/game_logic/src/Entity/TroopEntity.ts similarity index 63% rename from @sammo/game_logic/src/TroopEntity.ts rename to @sammo/game_logic/src/Entity/TroopEntity.ts index fa9abd8..f58931c 100644 --- a/@sammo/game_logic/src/TroopEntity.ts +++ b/@sammo/game_logic/src/Entity/TroopEntity.ts @@ -1,4 +1,4 @@ -import type { NationID, TroopID } from "./defs.js"; +import type { NationID, TroopID } from "../defs.js"; export interface ITroopEntity { id: TroopID; diff --git a/@sammo/game_logic/src/Entity/index.ts b/@sammo/game_logic/src/Entity/index.ts new file mode 100644 index 0000000..a6d8641 --- /dev/null +++ b/@sammo/game_logic/src/Entity/index.ts @@ -0,0 +1,21 @@ +import type { ValuesOf } from '@sammo/util'; +import type { ICityEntity } from './CityEntity.js'; +import type { IGeneralEntity } from './GeneralEntity.js'; +import type { INationEntity } from './NationEntity.js'; +import type { ITroopEntity } from './TroopEntity.js'; + +export type { IGeneralEntity } from './GeneralEntity.js'; +export type { ICityEntity } from './CityEntity.js'; +export type { ITroopEntity } from './TroopEntity.js'; +export type { INationEntity } from './NationEntity.js'; + + +export type ValidEntityList = { + 'General': IGeneralEntity; + 'City': ICityEntity; + 'Nation': INationEntity; + 'Troop': ITroopEntity; +}; + +export type ValidEntity = ValuesOf; +export type ValidEntityType = Entity extends ValidEntityList[infer T extends keyof ValidEntityList] ? T : never; diff --git a/@sammo/game_logic/src/General.ts b/@sammo/game_logic/src/General.ts index a40e937..3cfd382 100644 --- a/@sammo/game_logic/src/General.ts +++ b/@sammo/game_logic/src/General.ts @@ -1,6 +1,6 @@ import { InvalidArgument } from "@sammo/util"; import { City } from "./City.js"; -import type { IGeneralEntity } from "./GeneralEntity.js"; +import type { IGeneralEntity } from "./Entity/GeneralEntity.js"; import type { IResourceController } from "./ResourceController.js"; import { DiplomaticPermission, type CityID, type GeneralID, type GeneralName, type NationID, OfficerLevel, type TroopID } from "./defs.js"; import { must } from "@sammo/util"; diff --git a/@sammo/game_logic/src/LazyEntityUpdater.ts b/@sammo/game_logic/src/LazyEntityUpdater.ts index fec7620..aec7567 100644 --- a/@sammo/game_logic/src/LazyEntityUpdater.ts +++ b/@sammo/game_logic/src/LazyEntityUpdater.ts @@ -1,4 +1,5 @@ -import type { IResourceController, ValidEntity, ValidEntityType } from "./ResourceController.js"; +import type { ValidEntity, ValidEntityType } from "./Entity/index.js"; +import type { IResourceController } from "./ResourceController.js"; export abstract class LazyEntityUpdater{ protected abstract readonly _indirectNames: ReadonlyArray; diff --git a/@sammo/game_logic/src/Nation.ts b/@sammo/game_logic/src/Nation.ts index 64d518d..0eec4eb 100644 --- a/@sammo/game_logic/src/Nation.ts +++ b/@sammo/game_logic/src/Nation.ts @@ -1,5 +1,5 @@ import { LazyEntityUpdater } from "./LazyEntityUpdater.js"; -import type { INationEntity } from "./NationEntity.js"; +import type { INationEntity } from "./Entity/NationEntity.js"; import type { IResourceController } from "./ResourceController.js"; import type { NationID, NationName } from "./defs.js"; diff --git a/@sammo/game_logic/src/ResourceController.ts b/@sammo/game_logic/src/ResourceController.ts index 67ccf68..31009e0 100644 --- a/@sammo/game_logic/src/ResourceController.ts +++ b/@sammo/game_logic/src/ResourceController.ts @@ -3,23 +3,14 @@ import type { City } from "./City.js"; import type { Nation } from "./Nation.js"; import type { CityID, GeneralID, NationID, TroopID } from "./defs.js"; import type { GameEnv } from "./GameEnv.js"; -import type { IGeneralEntity } from "./GeneralEntity.js"; +import type { IGeneralEntity } from "./Entity/GeneralEntity.js"; import type { Troop } from "./Troop.js"; -import type { ITroopEntity } from "./TroopEntity.js"; +import type { ITroopEntity } from "./Entity/TroopEntity.js"; import type { LazyEntityUpdater } from "./LazyEntityUpdater.js"; -import type { ICityEntity } from "./CityEntity.js"; -import type { INationEntity } from "./NationEntity.js"; +import type { ICityEntity } from "./Entity/CityEntity.js"; +import type { INationEntity } from "./Entity/NationEntity.js"; import type { ValuesOf } from "@sammo/util"; - -export type ValidEntityList = { - 'General': IGeneralEntity; - 'City': ICityEntity; - 'Nation': INationEntity; - 'Troop': ITroopEntity; -}; - -export type ValidEntity = ValuesOf; -export type ValidEntityType = Entity extends ValidEntityList[infer T extends keyof ValidEntityList] ? T : never; +import type { ValidEntityType } from "./Entity/index.js"; export interface IResourceController{ addCity(city: City): boolean; diff --git a/@sammo/game_logic/src/Troop.ts b/@sammo/game_logic/src/Troop.ts index 9553a80..0e85d5b 100644 --- a/@sammo/game_logic/src/Troop.ts +++ b/@sammo/game_logic/src/Troop.ts @@ -1,7 +1,7 @@ import { must } from "@sammo/util"; import type { General } from "./General.js"; import type { IResourceController } from "./ResourceController.js"; -import type { ITroopEntity } from "./TroopEntity.js"; +import type { ITroopEntity } from "./Entity/TroopEntity.js"; import type { GeneralID } from "./defs.js"; import { LazyEntityUpdater } from "./LazyEntityUpdater.js";