Module CargoGroup
Cargo -- Management of grouped cargo logistics, which are based on a Group object.
Demo Missions
YouTube Playlist
Author: FlightControl
Contributions:
Global(s)
CARGO_GROUP |
CARGO_GROUP classThe CARGO_GROUP class defines a cargo that is represented by a Group object within the simulator. |
Type CARGO_GROUP
Global(s)
- #CARGO_GROUP CARGO_GROUP
-
CARGO_GROUP class
The CARGO_GROUP class defines a cargo that is represented by a 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 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#AI_CARGO_APC class.
- AI Helicopters to transport cargo, using the AI.AI_Cargo_Helicopter#AI_CARGO_HELICOPTER class.
- AI Planes to transport cargo, using the AI.AI_Cargo_Plane#AI_CARGO_PLANE class.
- 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.
The
Type CargoGroup
Type CARGO
Type CARGO_GROUP
Extends Cargo.Cargo#CARGO_REPORTABLE
Field(s)
- CARGO_GROUP.CargoGroup
-
Then we register the new group in the database
- #number CARGO_GROUP.CargoLimit
- CARGO_GROUP.CargoObject
-
Now we spawn the new group based on the template created.
- Core.Set#SET_CARGO CARGO_GROUP.CargoSet
-
The collection of derived CARGO objects.
- CARGO_GROUP:Flare(FlareColor)
-
Signal a flare at the position of the CargoGroup.
Parameter
-
Utilities.Utils#FLARECOLOR FlareColor
:
-
- CARGO_GROUP:GetCoordinate()
-
Get the current Coordinate of the CargoGroup.
Return values
-
Core.Point#COORDINATE: The current Coordinate of the first Cargo of the CargoGroup.
-
#nil: There is no valid Cargo in the CargoGroup.
-
- CARGO_GROUP:GetCount()
-
Get the amount of cargo units in the group.
Return value
- CARGO_GROUP:GetFirstAlive()
-
Get the first alive Cargo Unit of the Cargo Group.
Return value
- CARGO_GROUP:GetGroup(Cargo)
-
Get the amount of cargo units in the group.
Parameter
-
Cargo
:
Return value
-
- CARGO_GROUP:GetTransportationMethod()
-
Get the transportation method of the Cargo.
Return value
#string: The transportation method of the Cargo.
- #string CARGO_GROUP.GroupName
-
The name of the CargoGroup.
- #boolean CARGO_GROUP.Grouped
- CARGO_GROUP:IsAlive()
-
Check if the CargoGroup is alive.
Return values
-
#boolean: true if the CargoGroup is alive.
-
#boolean: false if the CargoGroup is dead.
-
- CARGO_GROUP:IsInLoadRadius(Coordinate)
-
Check if Cargo Group is in the radius for the Cargo to be Boarded.
Parameter
-
Core.Point#COORDINATE Coordinate
:
Return value
#boolean: true if the Cargo Group is within the load radius.
-
- CARGO_GROUP:IsInReportRadius(Coordinate)
-
Check if Cargo Group is in the report radius.
Parameter
-
Core.Point#Coordinate Coordinate
:
Return value
#boolean: true if the Cargo Group is within the report radius.
-
- CARGO_GROUP:IsInZone(Zone)
-
Check if the first element of the CargoGroup is the given Zone.
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.
-
- CARGO_GROUP:IsNear(CargoCarrier, NearRadius)
-
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.
Parameters
-
Wrapper.Group#GROUP CargoCarrier
: -
#number NearRadius
:
Return values
-
#boolean: The Cargo is near to the Carrier.
-
#nil: The Cargo is not near to the Carrier.
-
- CARGO_GROUP:New(CargoGroup, Type, Name, LoadRadius, NearRadius)
-
CARGO_GROUP constructor.
This make a new CARGO_GROUP from a Group object. It will "ungroup" the group object within the sim, and will create a Set of individual Unit objects.
Parameters
-
Wrapper.Group#GROUP CargoGroup
: -
#string Type
: -
#string Name
: -
#number LoadRadius
: (optional) -
#number NearRadius
: (optional)
Return value
-
- CARGO_GROUP:OnEventCargoDead(EventData)
-
Parameter
-
Core.Event#EVENTDATA EventData
:
-
- CARGO_GROUP:Regroup()
-
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.
- CARGO_GROUP:Respawn()
-
Respawn the CargoGroup.
- CARGO_GROUP:RouteTo(Coordinate)
-
Route Cargo to Coordinate and randomize locations.
Parameter
-
Core.Point#COORDINATE Coordinate
:
-
- CARGO_GROUP:Smoke(SmokeColor, Radius)
-
Smoke the CargoGroup.
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.
-
- CARGO_GROUP:Ungroup()
-
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.
- CARGO_GROUP:onafterBoarding(CargoCarrier, Event, From, To, NearRadius, ...)
-
Leave Boarding State.
Parameters
-
Wrapper.Unit#UNIT CargoCarrier
: -
#string Event
: -
#string From
: -
#string To
: -
NearRadius
: -
...
:
-
- CARGO_GROUP:onafterUnBoarding(ToPointVec2, Event, From, To, NearRadius, ...)
-
UnBoard Event.
Parameters
-
Core.Point#POINT_VEC2 ToPointVec2
: -
#string Event
: -
#string From
: -
#string To
: -
NearRadius
: -
...
:
-
- CARGO_GROUP:onenterBoarding(CargoCarrier, Event, From, To, NearRadius, ...)
-
Enter Boarding State.
Parameters
-
Wrapper.Unit#UNIT CargoCarrier
: -
#string Event
: -
#string From
: -
#string To
: -
NearRadius
: -
...
:
-
- CARGO_GROUP:onenterLoaded(Event, From, To, CargoCarrier, ...)
-
Enter Loaded State.
Parameters
-
#string Event
: -
#string From
: -
#string To
: -
Wrapper.Unit#UNIT CargoCarrier
: -
...
:
-
- CARGO_GROUP:onenterUnBoarding(ToPointVec2, Event, From, To, NearRadius, ...)
-
Enter UnBoarding State.
Parameters
-
Core.Point#POINT_VEC2 ToPointVec2
: -
#string Event
: -
#string From
: -
#string To
: -
NearRadius
: -
...
:
-
- CARGO_GROUP:onenterUnLoaded(Core, Event, From, To, ToPointVec2, ...)
-
Enter UnLoaded State.
Parameters
-
Core
: Point#POINT_VEC2 -
#string Event
: -
#string From
: -
#string To
: -
ToPointVec2
: -
...
:
-
- CARGO_GROUP:onleaveUnBoarding(ToPointVec2, Event, From, To, NearRadius, ...)
-
Leave UnBoarding State.
Parameters
-
Core.Point#POINT_VEC2 ToPointVec2
: -
#string Event
: -
#string From
: -
#string To
: -
NearRadius
: -
...
:
-