SixL server API / world-entities / ColshapeMpPool

Interface: ColshapeMpPool

The pool of colshapes: mp.colshapes.

Example

const zone = mp.colshapes.newCircle(0, 0, 20);

Extends

Properties

length

readonly length: number

The number of entities in the pool.

Example

const count = mp.blips.length;

Inherited from

BasicMpPool.length

Methods

at()

at(id): ColshapeMp

Finds an entity by id.

Parameters

id

number

The entity's id.

Returns

ColshapeMp

The entity, or null when there is none.

Example

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

Inherited from

BasicMpPool.at


exists()

exists(entity): boolean

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

Parameters

entity

number | ColshapeMp

An entity or its id.

Returns

boolean

True when it exists.

Example

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

Inherited from

BasicMpPool.exists


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());

Inherited from

BasicMpPool.forEach


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());

Inherited from

BasicMpPool.forEachFast


newCircle()

newCircle(x, y, range, dimension?): ColshapeMp

Creates a circle (a vertical cylinder of infinite height: z is ignored).

Parameters

x

number

Centre x, metres.

y

number

Centre y, metres.

range

number

Radius, metres.

dimension?

number

The dimension (default 0).

Returns

ColshapeMp

The colshape.

Example

const zone = mp.colshapes.newCircle(0, 0, 20);

newCuboid()

newCuboid(x, y, z, width, depth, height, dimension?): ColshapeMp

Creates a cuboid centred on a point.

Parameters

x

number

Centre x, metres.

y

number

Centre y, metres.

z

number

Centre z, metres.

width

number

Size along x, metres.

depth

number

Size along y, metres.

height

number

Size along z, metres.

dimension?

number

The dimension (default 0).

Returns

ColshapeMp

The colshape.

Example

const zone = mp.colshapes.newCuboid(0, 0, 70, 10, 10, 4);

newRectangle()

newRectangle(x, y, width, height, dimension?): ColshapeMp

Creates a rectangle centred on a point (z is ignored).

Parameters

x

number

Centre x, metres.

y

number

Centre y, metres.

width

number

Size along x, metres.

height

number

Size along y, metres.

dimension?

number

The dimension (default 0).

Returns

ColshapeMp

The colshape.

Example

const zone = mp.colshapes.newRectangle(0, 0, 10, 20);

newSphere()

newSphere(x, y, z, range, dimension?): ColshapeMp

Creates a sphere.

Parameters

x

number

Centre x, metres.

y

number

Centre y, metres.

z

number

Centre z, metres.

range

number

Radius, metres.

dimension?

number

The dimension (default 0).

Returns

ColshapeMp

The colshape.

Example

const zone = mp.colshapes.newSphere(0, 0, 70, 5);

newTube()

newTube(x, y, z, range, height, dimension?): ColshapeMp

Creates a tube: a vertical cylinder standing on its bottom centre.

Parameters

x

number

Bottom centre x, metres.

y

number

Bottom centre y, metres.

z

number

Bottom centre z, metres.

range

number

Radius, metres.

height

number

Height above z, metres.

dimension?

number

The dimension (default 0).

Returns

ColshapeMp

The colshape.

Remarks

The fourth argument is the radius and the fifth the height. RAGE MP's typings and manual order them the other way (height, range): a script ported from RAGE MP must swap them.

Example

const zone = mp.colshapes.newTube(0, 0, 70, 3, 5);

toArray()

toArray(): ColshapeMp[]

A snapshot of all entities.

Returns

ColshapeMp[]

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

Example

const all = mp.blips.toArray();

Inherited from

BasicMpPool.toArray