Banner Image

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.

#CARGO_GROUP CARGO_GROUP

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:

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

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

CARGO_GROUP.CargoCarrier

CARGO_GROUP.CargoGroup

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.GroupTemplate

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 Core.Zone.

CARGO_GROUP:IsNear(CargoCarrier, NearRadius)

Check if Cargo is near to the Carrier.

CARGO_GROUP.NearRadius

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:onafterBoard(Event, From, To, CargoCarrier, NearRadius, ...)

After Board Event.

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

Leave Boarding State.

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

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)

CARGO_GROUP.CargoGroup

Then we register the new group in the database

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.

#string CARGO_GROUP.GroupName

The name of the CargoGroup.

Function(s)

Signal a flare at the position of the CargoGroup.

Defined in:

CARGO_GROUP

Parameter:

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.

Defined in:

CARGO_GROUP

Return value:

Get the first alive Cargo Unit of the Cargo Group.

Defined in:

CARGO_GROUP

Return value:

Get the amount of cargo units in the group.

Defined in:

CARGO_GROUP

Parameter:

Cargo

Return value:

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:

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:

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:

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.

Defined in:

CARGO_GROUP

Parameter:

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

Respawn the CargoGroup.

Defined in:

CARGO_GROUP

Route Cargo to Coordinate and randomize locations.

Defined in:

CARGO_GROUP

Parameter:

Smoke the CargoGroup.

Defined in:

CARGO_GROUP

Parameters:

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

...