GetCouriersList()
GetCouriersList():
Courier[]
CAUTION
Do not modify the returned array. It is a reference to the internal array.
Description
The GetCouriersList
function retrieves a list of all courier entities.
Returned
- Courier[] - array of all courier entities
Example
ts
let exampleScript: ScriptDescription = {};
exampleScript.OnScriptLoad = () => {
// Check if we are in the game, because otherwise the list of courier will be empty
if(!GameRules.IsActiveGame()) {
return;
}
let couriers = EntitySystem.GetCouriersList();
for(let courier of couriers) {
// Display flying courier or not
console.log(`Courier is flying - `, courier.IsFlyingCourier());
}
}
RegisterScript(exampleScript, "Example script");