Registry
Class of @v12-engine/engine
export declare class RegistryThe registry of a game's definitions and behaviours: unit types, abilities, orders, systems, buffs and the rest, by id
Members
abilities
readonly abilities: Definitions<AbilityDef>;Every ability there is, of units, heroes and items alike (Rules.abilities)
ability
ability(id: string): AbilityDef;An ability by id: throws for one the game does not have (abilities)
assembly
assembly: AssembledGame | null;The game put together with its packs (assembleGame): set as the registry is made of it
buff
buff(id: string): BuffDef;A buff by id: throws for one the game does not have (buffs)
buffs
readonly buffs: Definitions<BuffDef>;The game's buffs (Rules.buffs)
cellLayers
cellLayers: CellLayerDef[];The game's layers of cells (Rules.cellLayers): what Terrain.cells is keyed by, with what each means
command
command(type: string): CommandDef | undefined;The command type, or undefined for one the game does not have: commands come from outside, and may name anything
commands
readonly commands: Definitions<CommandDef<import("./fields").Fields>>;The commands a world takes, the engine's and the game's, by type
component
component(id: string): Component<unknown> | undefined;A component of this game by its id: one the game lists, or one of the engine's own (coreComponents). None for any other
currency
currency: ResourceId | null;The resource prices, bounties, revives and sales are in: the game's money. Null for a game without one, where there is nothing of that kind to pay with
dataHash
get dataHash(): string;What identifies the game's data: everything but how its code reads (see gameHash). What a server and a player check they share: the two run builds of the same code that print it differently
day
day: DayCycle | null;Null for a game where it is always day
defineParts
defineParts(components: readonly Component<unknown>[], events: readonly EventKey<unknown>[]): void;Takes in the components and events a game lists. Throws for an id that is there twice, another way
effect
effect(type: string): EffectHandler;What an effect type does: throws for one there is not (effects)
effects
readonly effects: Definitions<EffectType<keyof import("./defs").EffectTypes>>;What each type of an ability's effect does, by type
event
event(id: string): EventKey<unknown> | undefined;An event of the game's own by its id: listed, or the engine's (core.), as the engine defined it. One of a game's that it does not list throws (UnlistedError). Never another game's: a process may hold more than one, each defining an id its own way (E7)
file
file<T>(def: GameFileDef<T>): T;What the rules read of a file of the game's own data (Rules.files): throws for one the game does not list
fileDef
fileDef(id: string): GameFileDef<unknown> | undefined;A file of the game's own data by its id (waves.json): what reads it, for an editor that writes it. None for one the game does not list
formation
formation(id: string): FormationDef;A formation by id: throws for one there is not (formations)
formations
readonly formations: Definitions<FormationDef>;How groups line up (Rules.formations)
game
game: string;Id of the game module it was made from
hash
get hash(): string;What identifies the game exactly, mods and code included (see gameHash). Worked out the first time it is asked for
item
item(id: string): ItemDef;An item by id: throws for one the game does not have (items)
items
readonly items: Definitions<ItemDef>;The game's items (Rules.items)
kinds
readonly kinds: {
readonly [K in DataKind]: Definitions<DataDefs[K]>;
};The kinds of definition a game's data is kept for (DataKind), each its collection: what the Data panel, mods, saves and a game's reload walk, one loop each
leaving
leaving: readonly Component<unknown, unknown>[];The engine's parts and the game's that call something off as an entity leaves its owner (Component.onLeave)
listedComponents beta
listedComponents(): Iterable<Component<unknown, unknown>>;The components the game lists, for what goes through them all: the map's fields they have
lists
lists(kind: 'component' | 'event', id: string): boolean;Whether the game lists a component or an event, or it is one of the engine's own
log
log?: Logger;The log of the world this is the registry of, once there is one (World.log)
module
module: Rules | null;The game module it was made from
order
order<Type extends string>(type: Type): OrderBehavior<OrderStateOf<Type>, OrderInitOf<Type>>;An order type's behaviour, typed by what its orders keep (OrderStates): throws for one there is not (orders)
orders
readonly orders: Definitions<OrderBehavior<Record<string, any>, OrderParams>>;The orders units can be given, the engine's and the game's, by type
passing
passing: readonly Component<unknown, unknown>[];The engine's parts and the game's that may have a structure stand open, in nobody's way (Component.passable)
prefab
prefab(id: string): PrefabDef;A prefab of the game's by id, for world.spawnPrefab; throws for one there is not
prefabs
readonly prefabs: Definitions<PrefabDef>;The game's prefabs (Rules.prefabs)
race
race(id: string): RaceDef;A race by id: throws for one the game does not have (races)
races
readonly races: Definitions<RaceDef>;The game's races, in its order (Rules.races): none in a game without
replications
replications: readonly ReplicatedEvent[];How each event of the world is told to a player, the engine's then the packs' (replicateEvent), in order
report
report: ((world: World, player: PlayerId) => Record<string, unknown>) | null;What the game tells each player about itself, see Rules.report. Asked by the session that runs the world
resource
resource(id: ResourceId): ResourceDef | undefined;The definition of a resource, or undefined for one the game does not have
resources
resources: ResourceDef[];The resources of the game, in the order players are shown them
saveVersion
get saveVersion(): number;The version of what the game keeps in a save (Rules.saves.version): 1 for a game that says none
score
score: ResolvedScore | null;What the game counts of its players (RuleSettings.score), its stats made: null for a game that counts nothing
setFile
setFile<T>(def: GameFileDef<T>, value: T): void;Puts what a file of the game's is read as, for this registry's world alone: the editor's panel, as it is edited
settings
settings: Readonly<RuleSettings>;The game's numbers that are not about any one unit (Rules.settings)
snapshotFields
snapshotFields: readonly SnapshotField[];The parts of a player's snapshot, the engine's then the packs' (SnapshotField), in order
spawning
spawning: readonly Component<unknown, unknown>[];The engine's parts and the game's that give an entity something as it is made (Component.onSpawn), in order
standsOpen
standsOpen(entity: Entity): boolean;Whether a structure stands open now, in nobody's way, by its parts (Component.passable): a gate opened
statDefaults
statDefaults: Readonly<Stats>;Every stat of the game at 0, its own at their default: what base stats start from
statFields
statFields: StatField[];What the game's packs add to a unit's stats (GamePack.stats): a hero's growth
statKeys
statKeys: string[];Every stat there is in the game, the engine's first
stats
stats: StatDef[];The game's own stats, next to the engine's (Rules.stats)
tags
readonly tags: Definitions<TagDef>;The tags of the game's items named and given a look (Rules.tags): a tag none names is its own word
takeFrom
takeFrom(other: Registry): void;Takes the definitions of another registry of the same game over its own (world.reload): its unit types, abilities, buffs, items, upgrades and races, the code of its effects and orders, its rules, and its module. Those it has that the other has not are kept (a world may have units of them). What the game is made of otherwise (its resources, stats, components, events) stays as it is: a world was made of it
targetings
readonly targetings: Definitions<Targeting>;A game's own ways of aiming an ability (Rules.targetings), by name
tile
tile(id: string): number;The index of a tile of the game, for painting the ground in code: terrain.tiles[cell] = registry.tile('road')
tileIds
get tileIds(): string[];The ids of the game's tiles, in the order of their indices
tiles
tiles: TileDef[];What the ground can be painted with, in the order of their indices: the first is 1 (Rules.tiles)
tunable
tunable(id: string): TunableDef | undefined;A tunable by id, or nothing for one the game does not have
tunables
tunables: TunableDef[];The numbers of the rules to be tuned while the game plays (Rules.tunables)
unit
unit(id: string): UnitTypeDef;A unit type by id: throws for one the game does not have (units)
units
readonly units: Definitions<UnitTypeDef>;The game's unit types, buildings and resources (Rules.units)
upgrade
upgrade(id: string): UpgradeDef;An upgrade by id: throws for one the game does not have (upgrades)
upgrades
readonly upgrades: Definitions<UpgradeDef>;The game's research (Rules.upgrades)
upkeep
upkeep: UpkeepTier[];Lowest threshold first. Empty for a game without upkeep
used
used(id: string): Component<unknown>;A component of this game by its id, as something of the world uses it: throws for one the game does not list (UnlistedError)