SixL client API / world-entities / CheckpointMpPool
Interface: CheckpointMpPool
The pool of checkpoints: mp.checkpoints. It holds the checkpoints the server has sent to this client, and the ones a script made.
Example
mp.checkpoints.forEach((cp) => mp.console.logInfo(String(cp.visible)));
Constructors
Constructor
new CheckpointMpPool(type,position,radius,options?):CheckpointMp
Makes a checkpoint, drawn by the overlay until it is destroyed.
Parameters
type
number
The ring's shape, an integer.
position
Where it stands, metres.
radius
number
Its radius, metres.
options?
color ([r, g, b, a], white by default), direction (a vector, zero by default), destination (the next point, which the ring points at when it has no direction), visible (true by default) and dimension.
color?
destination?
dimension?
number
direction?
visible?
boolean
Returns
The new checkpoint.
Remarks
It is not streamed: no stream-in event is raised for it.
Example
const cp = mp.checkpoints.new(1, new mp.Vector3(10, 20, 30), 3, { color: [0, 255, 0, 100] });
Properties
length
readonlylength:number
The number of checkpoints the client holds now.
Example
const count = mp.checkpoints.length;
Methods
at()
at(id):CheckpointMp
The checkpoint with this client id, or undefined.
Parameters
id
number
The client's own number for the checkpoint (from 1, reused after one is removed). It is not the server's id.
Returns
The checkpoint, or undefined when there is none with that id.
Example
const cp = mp.checkpoints.at(1);
exists()
exists(entity):boolean
Whether a checkpoint is still held by this client.
Parameters
entity
number | CheckpointMp
A checkpoint, or the client id of one (the id of CheckpointMpPool.at).
Returns
boolean
True while the checkpoint is held; false once the server has removed it from this client, or a script has destroyed it.
Example
if (mp.checkpoints.exists(cp)) { }
forEach()
forEach(callingFunction):void
Calls a function for every checkpoint held by this client.
Parameters
callingFunction
(entity) => void
Called with each checkpoint.
Returns
void
Example
mp.checkpoints.forEach((cp) => mp.console.logInfo(String(cp.radius)));
toArray()
toArray(): CheckpointMp[]
The checkpoints held by this client, as an array.
Returns
A new array of the checkpoints at the time of the call.
Example
const all = mp.checkpoints.toArray();