Areas beta
Class of @v12-engine/engine
export declare class AreasThe areas of a world, and who is in them
Members
constructor
constructor(world: World, defs: readonly AreaDef[]);Constructs a new instance of the Areas class
add
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
get all(): Iterable<AreaDef>;The areas of the game, then those added while it runs
contains
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
get(id: string): AreaDef;Gives the area with the id; throws when there is none
has
has(id: string): boolean;Whether there is an area of that id
inside
inside(id: string): Entity[];Who is in the area, as of the last look
remove
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
get size(): number;How many areas there are: the game's and those added while it runs
update
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