Skip to content

GamePack beta ​

Interface of @v12-engine/engine

ts
export interface GamePack

A part of the rules a game opts into (Rules.packs): commands, orders, systems, hooks and the state it keeps, which a game without it pays nothing for. The engine's heroes, camps and shops are one (heroesPack). A game's own lists come after a pack's, so a command, an order, a hook or a system of the same id or name takes its place; withoutCommands, withoutOrders, withoutSystems and withoutHooks take one of a pack's out as they do the engine's

Members ​

check ​

ts
check?(map: GameMap, registry: Registry): MapProblem[];

What it finds wrong with a map in the editor, beside what the game finds (MapEditorDef.check)

commands ​

ts
commands?: CommandDef[];

Commands it takes, beside the engine's (defineCommand)

components ​

ts
components?: Component<any>[];

The state it keeps on entities, players and the world (defineComponent)

effects ​

ts
effects?: EffectType[];

Kinds of ability effects it brings (defineEffect), beside the engine's: one of the game's of the same type takes its place

events ​

ts
events?: EventKey<any>[];

The events it tells of (defineEvent), listed as a game's are

hooks ​

ts
hooks?: HookDef[];

Its handlers of hooks, after the engine's and before the game's (defineHook)

id ​

ts
id: string;

Unique among a game's packs: how a game, a mod or the editor asks whether it is on (hasPack)

listeners ​

ts
listeners?: ListenerDef[];

How it reacts to events (defineListener)

options ​

ts
options?: unknown;

What it was made with, as plain data: what a game's hash names it by, beside its id (gameHash), so that one pack made two ways is two games

orders ​

ts
orders?: OrderBehavior[];

Orders its units can be given, beside the engine's

replications ​

ts
replications?: ReplicatedEvent[];

How events of the world of its own are told to the players (replicateEvent), after the engine's

report ​

ts
report?(world: World, player: PlayerId): Record<string, unknown>;

What it adds to the game's report of a player at the end (Rules.report), beside the game's own

requires ​

ts
requires?: string[];

The packs it is made to go with, by id: a game with it and without one of them is refused

settings ​

ts
settings?(settings: Readonly<RuleSettings>): RuleSettingsInit;

The rules it changes: handed the game's as they come out (the engine's, the game's over them, the packs' before it), it gives what it lays over them. A function of them, so that what it says can be made of what was there (the lanes' supply: none for a minion, the game's own for the rest)

snapshotFields ​

ts
snapshotFields?: SnapshotField[];

Parts of the players' snapshots of its own (SnapshotField), after the engine's

statFields ​

ts
statFields?: StatField[];

What it adds to a unit's stats, kept up to date as the engine keeps the rest (StatField)

stats ​

ts
stats?: StatDef[];

The stats it brings, next to the engine's and the game's own (StatDef, as Rules.stats)

systems ​

ts
systems?: SystemDef[];

Systems, run with the engine's in the phase each says (see System)

timers ​

ts
timers?: TimerDef[];

What it sets to go off later (defineTimer): listed, so that a save finds them by id

victory ​

ts
victory?: SystemDef | null;

How a game with it is won, where the game says nothing of its own (Rules.victory): the last pack's that says