Skip to content

WorldMap beta ​

Class of @v12-engine/engine

ts
export declare class WorldMap

What the map a world was made from says that is not an entity (World.map): its name, what the game kept with it, and its points and paths by name. A game can say which names there are: world.map.path<RoadPaths>('road')

Members ​

constructor ​

ts
constructor(info: MapInfo);

Constructs a new instance of the WorldMap class

cameras ​

ts
get cameras(): readonly MapCamera[];

The views of the map saved under names, for the screens

data ​

ts
get data(): Record<string, unknown>;

What the game kept with the map (GameMap.data): a difficulty, the waves of this level

doodads ​

ts
get doodads(): readonly MapDoodad[];

The scenery of the map, for the screens: the rules never see it, but where it blocks, which the terrain has

environment ​

ts
get environment(): MapEnvironment | undefined;

What the map looks like, for the screens: its water. Nothing for a world made without a map

forces ​

ts
get forces(): readonly MapForce[];

The teams of the map, named, and what their players share

has ​

ts
has(name: string): boolean;

Whether the map has a point or a path of this name

itemTable ​

ts
itemTable(name: string): MapItemTable | undefined;

An item table of the map, by name: what something placed on it drops when it dies

name ​

ts
get name(): string;

The name of the map. Empty for a world made without one

path ​

ts
path<Name extends string = string>(name: Name): Path;

A path of the map, to ask how long it is, where along it, what is on it. Throws for one it does not have

paths ​

ts
get paths(): readonly MapPath[];

The paths of the map, as it has them

player ​

ts
player(id: number): MapPlayerInfo | undefined;

What the map says of a player: who plays them (a person, the computer, nobody) and the game's own fields

point ​

ts
point<Name extends string = string>(name: Name): Spot;

A point of the map. Throws for one it does not have: a name in the code that is not on the map is a mistake

points ​

ts
get points(): readonly MapPoint[];

The points of the map, as it has them. None in a world saved before maps had points

regions ​

ts
get regions(): readonly MapRegion[];

The regions of the map, for the screens: what mist in places lies over by name. The rules know them as areas

things ​

ts
things(kind: string, fields?: readonly Pick<MapFieldDef, 'id' | 'default'>[]): MapThing[];

The things of a kind of the game's own that were put on the map (MapThing): a tower defense's ground kept clear, a MOBA's lanes. None for a kind the map has nothing of. With fields, each thing's own (data) has what was not set at its default: world.map.things('td.clearings', clearingFields)