Module Cargo.CargoGroup
Cargo - Management of grouped cargo logistics, which are based on a GROUP object.
Demo Missions
YouTube Playlist
Author: FlightControl
Contributions:
Global(s)
Global CARGO_GROUP |
Defines a cargo that is represented by a Wrapper.Group object within the simulator. |
Defines a cargo that is represented by a Wrapper.Group object within the simulator.
The cargo can be Loaded, UnLoaded, Boarded, UnBoarded to and from Carriers.
The above cargo classes are used by the following AI_CARGO_ classes to allow AI groups to transport cargo:
- AI Armoured Personnel Carriers to transport cargo and engage in battles, using the AI.AI_Cargo_APC module.
- AI Helicopters to transport cargo, using the AI.AI_Cargo_Helicopter module.
- AI Planes to transport cargo, using the AI.AI_Cargo_Airplane module.
- AI Ships is planned.
The above cargo classes are also used by the TASK_CARGO_ classes to allow human players to transport cargo as part of a tasking:
- Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT to transport cargo by human players.
- Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR to transport downed pilots by human players.
Developer Note
Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE Therefore, this class is considered to be deprecated
Type(s)
Fields and Methods inherited from CARGO_GROUP | Description |
---|---|
The collection of derived CARGO objects. |
|
Signal a flare at the position of the CargoGroup. |
|
Get the current Coordinate of the CargoGroup. |
|
Get the amount of cargo units in the group. |
|
Get the first alive Cargo Unit of the Cargo Group. |
|
Get the amount of cargo units in the group. |
|
Get the transportation method of the Cargo. |
|
The name of the CargoGroup. |
|
Check if the CargoGroup is alive. |
|
Check if Cargo Group is in the radius for the Cargo to be Boarded. |
|
Check if Cargo Group is in the report radius. |
|
Check if the first element of the CargoGroup is the given Core.Zone. |
|
Check if Cargo is near to the Carrier. |
|
CARGO_GROUP:New(CargoGroup, Type, Name, LoadRadius, NearRadius) |
CARGO_GROUP constructor. |
Regroup the cargo group into one group with multiple unit. |
|
Respawn the CargoGroup. |
|
Route Cargo to Coordinate and randomize locations. |
|
Smoke the CargoGroup. |
|
Ungroup the cargo group into individual groups with one unit. |
|
CARGO_GROUP:onafterBoard(Event, From, To, CargoCarrier, NearRadius, ...) |
After Board Event. |
CARGO_GROUP:onafterBoarding(Event, From, To, CargoCarrier, NearRadius, ...) |
Leave Boarding State. |
Enter Loaded State. |
|
CARGO_GROUP:onafterUnBoard(Event, From, To, ToPointVec2, NearRadius, ...) |
Enter UnBoarding State. |
CARGO_GROUP:onafterUnBoarding(Event, From, To, ToPointVec2, NearRadius, ...) |
Leave UnBoarding State. |
CARGO_GROUP:onafterUnLoad(Event, From, To, ToPointVec2, ...) |
Enter UnLoaded State. |
Field(s)
Then we register the new group in the database
Now we spawn the new group based on the template created.
The name of the CargoGroup.
Function(s)
Signal a flare at the position of the CargoGroup.
Get the current Coordinate of the CargoGroup.
Defined in:
CARGO_GROUP
Return values:
The current Coordinate of the first Cargo of the CargoGroup.
#nil:
There is no valid Cargo in the CargoGroup.
Get the amount of cargo units in the group.
Get the first alive Cargo Unit of the Cargo Group.
Get the amount of cargo units in the group.
Get the transportation method of the Cargo.
Defined in:
CARGO_GROUP
Return value:
#string:
The transportation method of the Cargo.
Check if the CargoGroup is alive.
Defined in:
CARGO_GROUP
Return values:
#boolean:
true if the CargoGroup is alive.
#boolean:
false if the CargoGroup is dead.
Check if Cargo Group is in the radius for the Cargo to be Boarded.
Defined in:
CARGO_GROUP
Parameter:
Core.Point#COORDINATE Coordinate
Return value:
#boolean:
true if the Cargo Group is within the load radius.
Check if Cargo Group is in the report radius.
Defined in:
CARGO_GROUP
Parameter:
Core.Point#Coordinate Coordinate
Return value:
#boolean:
true if the Cargo Group is within the report radius.
Check if the first element of the CargoGroup is the given Core.Zone.
Defined in:
CARGO_GROUP
Parameter:
Core.Zone#ZONE_BASE Zone
Return values:
#boolean:
true if the first element of the CargoGroup is in the Zone
#boolean:
false if there is no element of the CargoGroup in the Zone.
Check if Cargo is near to the Carrier.
The Cargo is near to the Carrier if the first unit of the Cargo Group is within NearRadius.
Defined in:
CARGO_GROUP
Parameters:
Wrapper.Group#GROUP CargoCarrier
#number NearRadius
Return value:
#boolean:
The Cargo is near to the Carrier or #nil if the Cargo is not near to the Carrier.
CARGO_GROUP constructor.
This make a new CARGO_GROUP from a Wrapper.Group object. It will "ungroup" the group object within the sim, and will create a Core.Set of individual Unit objects.
Defined in:
CARGO_GROUP
Parameters:
Wrapper.Group#GROUP CargoGroup
Group to be transported as cargo.
#string Type
Cargo type, e.g. "Infantry". This is the type used in SET_CARGO:New():FilterTypes("Infantry") to define the valid cargo groups of the set.
#string Name
A user defined name of the cargo group. This name CAN be the same as the group object but can also have a different name. This name MUST be unique!
#number LoadRadius
(optional) Distance in meters until which a cargo is loaded into the carrier. Cargo outside this radius has to be routed by other means to within the radius to be loaded.
#number NearRadius
(optional) Once the units are within this radius of the carrier, they are actually loaded, i.e. disappear from the scene.
Return value:
Cargo group object.
Regroup the cargo group into one group with multiple unit.
This is required because by default a group will move in formation and this is really an issue for group control. Therefore this method is made to be able to regroup a group. This works for ground only groups.
Defined in:
CARGO_GROUP
Route Cargo to Coordinate and randomize locations.
Smoke the CargoGroup.
Defined in:
CARGO_GROUP
Parameters:
Utilities.Utils#SMOKECOLOR SmokeColor
The color of the smoke.
#number Radius
The radius of randomization around the center of the first element of the CargoGroup.
Ungroup the cargo group into individual groups with one unit.
This is required because by default a group will move in formation and this is really an issue for group control. Therefore this method is made to be able to ungroup a group. This works for ground only groups.
Defined in:
CARGO_GROUP
After Board Event.
Defined in:
CARGO_GROUP
Parameters:
#string Event
#string From
#string To
Wrapper.Unit#UNIT CargoCarrier
#number NearRadius
If distance is smaller than this number, cargo is loaded into the carrier.
...
Leave Boarding State.
Defined in:
CARGO_GROUP
Parameters:
#string Event
#string From
#string To
Wrapper.Unit#UNIT CargoCarrier
#number NearRadius
If distance is smaller than this number, cargo is loaded into the carrier.
...
Enter Loaded State.
Defined in:
CARGO_GROUP
Parameters:
#string Event
#string From
#string To
Wrapper.Unit#UNIT CargoCarrier
...
Enter UnBoarding State.
Defined in:
CARGO_GROUP
Parameters:
#string Event
#string From
#string To
Core.Point#POINT_VEC2 ToPointVec2
#number NearRadius
If distance is smaller than this number, cargo is loaded into the carrier.
...
Leave UnBoarding State.
Defined in:
CARGO_GROUP
Parameters:
#string Event
#string From
#string To
Core.Point#POINT_VEC2 ToPointVec2
#number NearRadius
If distance is smaller than this number, cargo is loaded into the carrier.
...
Enter UnLoaded State.
Defined in:
CARGO_GROUP
Parameters:
#string Event
#string From
#string To
Core.Point#POINT_VEC2 ToPointVec2
...