MapCollection beta
Interface of @v12-engine/editor
export interface MapCollection<T extends {
id: number;
} = {
id: number;
}>A kind of thing on the map, as the editor's features see every kind: where its things are kept in the map, what they are called, where each stands, and which row of the Hierarchy it is under. The editor's own kinds and the game's (MapKind) are all this, so a feature that touches everything on the map goes over the registry (MapCollections.all()) and knows no kind by name
Members
alwaysNamed
readonly alwaysNamed?: boolean;Whether every one of them has a name, which is what the rules know it by and cannot be taken away: a region, a point, a path
extent
extent?(item: T): number;How far one covers the ground around its place, for the ground a prefab takes with it (copyGround): a building its footprint's half, a region its size. Half a cell when left out
faced
faced?(item: T, facing: number): Partial<T>;What of one changes as it is turned to face a way
facingOf
facingOf?(item: T): number | undefined;Which way one faces, where it faces a way at all: a camp faces none
fields
fields?(item: T): readonly MapFieldDef[];The game's own fields of one (defineMapField), kept in its data: an object's by its type, a camp's, a region's. None where the game reads it whole (a point, a path) or it has fields of its own (a kind of the game's)
groupOf
groupOf(item: T): OutlineGroup;The row of the Hierarchy one is under (groups)
groups
readonly groups: readonly OutlineGroup[];The rows of the Hierarchy its things are listed under: one for most, three for the objects (units, buildings, resources)
id
id: number;labelHeight
labelHeight?(item: T, heightOf: (type: string) => number): number;How high over the ground its name is written on the map, where it has one, by how tall what is drawn of a type is (heightOf): over a unit, on the ground in a region's middle. Left out by what has no name written over it (a doodad, a light, an effect)
list
list(map: GameMap): readonly T[];Its things, as the map keeps them
listed
listed(item: T, owner: (player: number) => string): string;What the Hierarchy calls one: its name, or what it is; an object with its type and whose it is (owner)
mirrored
readonly mirrored?: boolean;Whether a copy of one is made where the map's symmetry mirrors it (mirrorSelection): objects, camps, points, doodads
moved
moved(item: T, moving: Moving): Partial<T>;What of one changes as it is moved, turned or sized (Moving): its place or places, which way it faces, its size and shape. The change only, to be written as the collection's things are
nameOf
nameOf(item: T): string | undefined;Its name, where it has one
placeOf
placeOf(item: T): Vec2 | undefined;Where one stands: its place, a region's middle, a path's first point. Nothing for a path with no points
placesOf
placesOf?(item: T): readonly Vec2[];Every place of one, where it has more than one: a path's points. Its one place when left out
reach
reach?(item: T): number;How far around its place a view takes in to show it: a region's size, a camp's ring. A cell when left out
searchWords
searchWords?(item: T): string;Words more the search finds one by: an object's type, a camp's units
sized
sized?(item: T, factor: number): Partial<T>;What of one changes as it is made bigger or smaller by a factor, where it has a size of its own
sizeOf
sizeOf?(item: T): number;How big one is, where it has a size of its own: what a prefab's size is read from
stands
readonly stands?: boolean;Whether each stands at one place, moved by its place alone: what is lined up, spread and faced together. Not a region (a shape) nor a path (a line of points)
title
title?(item: T): string;What one is called where it has no name, in the search and the Hierarchy: Footman 12, Camp 3, pine 4, a kind of the game's own as it says (MapKind.label). Left out by what is not listed so
words
readonly words: {
one: string;
many: string;
};What one is called and what several are: "light", "lights"; a kind of the game's own as it says ("Clearing")