SixL server API / entity / BasicMpPool

Interface: BasicMpPool<T>

The members of the smaller pools (blips, markers, labels, checkpoints, colshapes, dummies): lookup and iteration only. SixL-only name; these pools have no spatial queries.

Extended by

Type Parameters

T

T

Properties

length

readonly length: number

The number of entities in the pool.

Example

const count = mp.blips.length;

Methods

at()

at(id): T

Finds an entity by id.

Parameters

id

number

The entity's id.

Returns

T

The entity, or null when there is none.

Example

const blip = mp.blips.at(1);

exists()

exists(entity): boolean

Whether an entity (or an id) is still in the pool.

Parameters

entity

number | T

An entity or its id.

Returns

boolean

True when it exists.

Example

if (mp.blips.exists(blip)) { }

forEach()

forEach(callingFunction): void

Calls a function for every entity.

Parameters

callingFunction

(entity) => void

Called with each entity.

Returns

void

Example

mp.blips.forEach((b) => b.destroy());

forEachFast()

forEachFast(callingFunction): void

Calls a function for every entity; the same as forEach in SixL.

Parameters

callingFunction

(entity) => void

Called with each entity.

Returns

void

Example

mp.blips.forEachFast((b) => b.destroy());

toArray()

toArray(): T[]

A snapshot of all entities.

Returns

T[]

A new array; changing it does not change the pool.

Example

const all = mp.blips.toArray();