Skip to content

ThingsArea beta ​

Class of @v12-engine/editor

ts
export declare class ThingsArea

Things of kinds of the game's own (S33): what a game's editor puts down for its rules to read, where the engine's own kinds do not say it (a spawner, a waypoint, ground kept clear). Kept in the map's data under the kind's name (GameMap.data[kind], a list of MapThing): a place, a way it faces, a name, and the game's own fields. Every change is a step of the history, as every change to the map is

Members ​

constructor ​

ts
constructor(
    doc: MapDocument, names: NamesArea);

Constructs a new instance of the ThingsArea class

addThing ​

ts
addThing(kind: string, at: Vec2, init?: Partial<Omit<MapThing, 'id' | 'x' | 'z'>>): MapThing | null;

Puts a thing of a kind down: at a place, facing a way, with a name and the game's fields of it when it has some. Null when the name it is given cannot be had

doc ​

ts
readonly doc: MapDocument;

The map document the area works on

kindOf ​

ts
kindOf(kind: string): MapKind;

What a kind is called: as the game said it (kinds), or by its id

of ​

ts
of(kind: string): MapThing[];

The things of a kind on the map, as the map keeps them. None for a kind it has nothing of

removeThings ​

ts
removeThings(kind: string, ids: Iterable<number>): void;

Removes the things of a kind with those ids, as one step of the history

setThing ​

ts
setThing(kind: string, id: number, change: Partial<Pick<MapThing, 'x' | 'z' | 'facing' | 'data'>>, name?: string): void;

Changes a thing: where it is, the way it faces, the game's fields of it (all of them, as given). Its name is setName's to change, as every name is. name says what was done, in the history

setThingData ​

ts
setThingData(kind: string, ids: Iterable<number>, key: string, value: unknown, name?: string): void;

Sets a field of the game's own on things of a kind (MapThing.data), as one step: undefined takes it out, so that it is at its default again

thing ​

ts
thing(kind: string, id: number): MapThing | undefined;

The thing of that kind with that id, or undefined when there is none

writer ​

ts
writer(of: string, named: Namer): CollectionWriter;

How the things of a kind of the game's are written (CollectionWriter)