Module CargoGroup

Cargo -- Management of grouped cargo logistics, which are based on a Group object.


Banner Image


Demo Missions

YouTube Playlist


Author: FlightControl

Contributions:


Global(s)

CARGO_GROUP

CARGO_GROUP class

The CARGO_GROUP class defines a cargo that is represented by a Group object within the simulator.

Type CARGO_GROUP

CARGO_GROUP.CargoCarrier
CARGO_GROUP.CargoGroup
CARGO_GROUP.CargoLimit
CARGO_GROUP.CargoName
CARGO_GROUP.CargoObject
CARGO_GROUP.CargoSet

The collection of derived CARGO objects.

CARGO_GROUP.CargoTemplate
CARGO_GROUP.CargoUnitTemplate
CARGO_GROUP:Flare(FlareColor)

Signal a flare at the position of the CargoGroup.

CARGO_GROUP:GetCoordinate()

Get the current Coordinate of the CargoGroup.

CARGO_GROUP:GetCount()

Get the amount of cargo units in the group.

CARGO_GROUP:GetFirstAlive()

Get the first alive Cargo Unit of the Cargo Group.

CARGO_GROUP:GetGroup(Cargo)

Get the amount of cargo units in the group.

CARGO_GROUP:GetTransportationMethod()

Get the transportation method of the Cargo.

CARGO_GROUP.GroupName

The name of the CargoGroup.

CARGO_GROUP.Grouped
CARGO_GROUP:IsAlive()

Check if the CargoGroup is alive.

CARGO_GROUP:IsInLoadRadius(Coordinate)

Check if Cargo Group is in the radius for the Cargo to be Boarded.

CARGO_GROUP:IsInReportRadius(Coordinate)

Check if Cargo Group is in the report radius.

CARGO_GROUP:IsInZone(Zone)

Check if the first element of the CargoGroup is the given Zone.

CARGO_GROUP:IsNear(CargoCarrier, NearRadius)

Check if Cargo is near to the Carrier.

CARGO_GROUP:New(CargoGroup, Type, Name, LoadRadius, NearRadius)

CARGO_GROUP constructor.

CARGO_GROUP:OnEventCargoDead(EventData)
CARGO_GROUP:Regroup()

Regroup the cargo group into one group with multiple unit.

CARGO_GROUP:Respawn()

Respawn the CargoGroup.

CARGO_GROUP:RouteTo(Coordinate)

Route Cargo to Coordinate and randomize locations.

CARGO_GROUP:Smoke(SmokeColor, Radius)

Smoke the CargoGroup.

CARGO_GROUP:Ungroup()

Ungroup the cargo group into individual groups with one unit.

CARGO_GROUP:onafterBoarding(CargoCarrier, Event, From, To, NearRadius, ...)

Leave Boarding State.

CARGO_GROUP:onafterUnBoarding(ToPointVec2, Event, From, To, NearRadius, ...)

UnBoard Event.

CARGO_GROUP:onenterBoarding(CargoCarrier, Event, From, To, NearRadius, ...)

Enter Boarding State.

CARGO_GROUP:onenterLoaded(Event, From, To, CargoCarrier, ...)

Enter Loaded State.

CARGO_GROUP:onenterUnBoarding(ToPointVec2, Event, From, To, NearRadius, ...)

Enter UnBoarding State.

CARGO_GROUP:onenterUnLoaded(Core, Event, From, To, ToPointVec2, ...)

Enter UnLoaded State.

CARGO_GROUP:onleaveUnBoarding(ToPointVec2, Event, From, To, NearRadius, ...)

Leave UnBoarding State.

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:

The above cargo classes are also used by the TASK_CARGO_ classes to allow human players to transport cargo as part of a tasking:

The

Type CargoGroup

Type CARGO

Type CARGO_GROUP

Extends Cargo.Cargo#CARGO_REPORTABLE

Field(s)

CARGO_GROUP.CargoCarrier
CARGO_GROUP.CargoGroup

Then we register the new group in the database

#number CARGO_GROUP.CargoLimit
CARGO_GROUP.CargoName
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.CargoTemplate
#table CARGO_GROUP.CargoUnitTemplate
CARGO_GROUP:Flare(FlareColor)

Signal a flare at the position of the CargoGroup.

Parameter

CARGO_GROUP:GetCoordinate()

Get the current Coordinate of the CargoGroup.

Return values

  1. Core.Point#COORDINATE: The current Coordinate of the first Cargo of the CargoGroup.

  2. #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:

CARGO_GROUP:GetFirstAlive()

Get the first alive Cargo Unit of the Cargo Group.

Return value

#CARGO_GROUP:

CARGO_GROUP:GetGroup(Cargo)

Get the amount of cargo units in the group.

Parameter

  • Cargo :

Return value

#CARGO_GROUP:

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

  1. #boolean: true if the CargoGroup is alive.

  2. #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

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

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

Return values

  1. #boolean: true if the first element of the CargoGroup is in the Zone

  2. #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

Return values

  1. #boolean: The Cargo is near to the Carrier.

  2. #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:

CARGO_GROUP:OnEventCargoDead(EventData)

Parameter

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

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

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

CARGO_GROUP:onenterUnBoarding(ToPointVec2, Event, From, To, NearRadius, ...)

Enter UnBoarding State.

Parameters

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