Skip to content

MapFieldDef beta ​

Interface of @v12-engine/engine

ts
export interface MapFieldDef

A field of a game's own on what is placed on a map: the wave a spawner sends, whether a gate starts open, what a guard does. The editor shows it in the inspector for what it is a field of, and keeps what it was set to with the object (MapObject.data). The engine does nothing with it: the mapObject hook hands it to the game as the world is made, which is where the game says what it means. Given in Rules.editor.fields

Members ​

default ​

ts
default?: unknown;

What it is when nothing was set. The game is given this then, and the file does not hold it

for ​

ts
for: string[] | ((def: UnitTypeDef) => boolean) | 'camp' | 'region' | 'map' | 'player';

What it is a field of: objects of these unit types, or of the types a function says yes to (every hero, every building that trains something); or camps, or regions; or the map itself (kept in GameMap.data, read as world.map.data), or its players (MapPlayer.data, read as world.map.player(id).data)

group ​

ts
group?: string;

The fields it is laid out beside in the inspector, by a name they share ('Position'): the consecutive fields of one group two a line, under its name. Alone when left out

hint ​

ts
hint?: string;

A line more, shown when the pointer rests on it

id ​

ts
id: string;

The key it is kept under. Shared by the fields of every mod on the game: give a mod's a prefix

kind ​

ts
kind: MapFieldKind;

What sort of value the field holds, which the inspector edits it with (MapFieldKind)

max ​

ts
max?: number;

For a number field: the most it can be

min ​

ts
min?: number;

For a number: the least and the most it can be, and what the arrows step by

name ​

ts
name: string;

What the inspector calls it

options ​

ts
options?: readonly MapFieldOption[] | ((registry: Registry) => readonly MapFieldOption[]);

For a choice: what there is to choose from, as data or worked out from the game

step ​

ts
step?: number;

For a number field: what the arrows step it by