Skip to content

MapCollections beta ​

Class of @v12-engine/editor

ts
export declare class MapCollections

The kinds of thing on a map, as one registry (editor.collections): the editor's own and then the game's, as the editor is told them (MapEditor.kinds). What touches everything on the map goes over all(); what is handed a target goes to its collection (of) or straight to the thing (item, placeOf)

Members ​

constructor ​

ts
constructor(registry: Registry, 
    kinds: () => readonly MapKind[]);

Constructs a new instance of the MapCollections class

all ​

ts
all(): MapCollection[];

Every collection: the editor's own kinds, then the game's in the order the editor was told them

find ​

ts
find<T extends {
        id: number;
    }>(map: GameMap, collection: MapCollection<T>, id: number): T | undefined;

A thing of a collection by its id, as the map has it now

get ​

ts
get(id: CollectionId): MapCollection;

The collection by id. A kind of the game's own the editor was not told of is one too: its things are in the map all the same, and are called by the kind's id

item ​

ts
item(map: GameMap, target: Named): {
        id: number;
    } | undefined;

The thing a target names, as the map has it now

of ​

ts
of(target: Named): MapCollection;

The collection of what a target names

placeOf ​

ts
placeOf(map: GameMap, target: Named): Vec2 | undefined;

Where the thing a target names stands