Skip to content

Areas beta ​

Class of @v12-engine/engine

ts
export declare class Areas

The areas of a world, and who is in them

Members ​

constructor ​

ts
constructor(world: World, defs: readonly AreaDef[]);

Constructs a new instance of the Areas class

add ​

ts
add(def: AreaDef): void;

Adds an area while the game runs: a zone a spell leaves, a ring that closes in, a part of the map a quest opens. Who is in it is found at the end of the tick, and walks in then. One of the same id, added before, is replaced

all ​

ts
get all(): Iterable<AreaDef>;

The areas of the game, then those added while it runs

contains ​

ts
contains(id: string, entity: Entity): boolean;

Whether the entity was in the area when the areas were last looked at: the end of the last tick's movement

get ​

ts
get(id: string): AreaDef;

Gives the area with the id; throws when there is none

has ​

ts
has(id: string): boolean;

Whether there is an area of that id

inside ​

ts
inside(id: string): Entity[];

Who is in the area, as of the last look

remove ​

ts
remove(id: string): boolean;

Takes away an area added while the game runs. Who was in it leaves it (leftArea). False when there was none

size ​

ts
get size(): number;

How many areas there are: the game's and those added while it runs

update ​

ts
update(): void;

Looks who is in each area now, and tells who walked in and who walked out. What died in one is just gone