Module Cargo
This module contains the CARGO classes.
1) Cargo#CARGO_BASE class, extends Base#BASE
The #CARGO_BASE class defines the core functions that defines a cargo object within MOOSE. A cargo is a logical object defined within a Mission, that is available for transport, and has a life status within a simulation.
Cargo can be of various forms:
- CARGO_UNIT, represented by a Unit in a Group: Cargo can be represented by a Unit in a Group. Destruction of the Unit will mean that the cargo is lost.
- CARGO_STATIC, represented by a Static: Cargo can be represented by a Static. Destruction of the Static will mean that the cargo is lost.
- CARGO_PACKAGE, contained in a Unit of a Group: Cargo can be contained within a Unit of a Group. The cargo can be delivered by the Unit. If the Unit is destroyed, the cargo will be destroyed also.
- CARGO_PACKAGE, Contained in a Static: Cargo can be contained within a Static. The cargo can be collected from the @Static. If the Static is destroyed, the cargo will be destroyed.
- CARGO_SLINGLOAD, represented by a Cargo that is transportable: Cargo can be represented by a Cargo object that is transportable. Destruction of the Cargo will mean that the cargo is lost.
1.2) CARGO state machine:
The CARGO is a state machine: it manages the different events and states of the Controllable it is controlling.
1.2.1) CARGO Events:
- CARGO.Board( ToCarrier ): Boards the cargo to a Carrier.
- CARGO.Load( ToCarrier ): Loads the cargo into a Carrier, regardless of its position.
- CARGO.UnBoard( ToPointVec2 ): UnBoard the cargo from a Carrier. This will trigger a movement of the cargo to the option ToPointVec2.
- CARGO.UnLoad( ToPointVec2 ): UnLoads the cargo from a Carrier.
- CARGO.Dead( Controllable ): The cargo is dead. The cargo process will be ended.
1.2.2) PROCESS_PATROLZONE States:
- UnLoaded: The cargo is unloaded from a carrier.
- Boarding: The cargo is currently boarding (= running) into a carrier.
- Loaded: The cargo is loaded into a carrier.
- UnBoarding: The cargo is currently unboarding (=running) from a carrier.
- Dead: The cargo is dead ...
- End: The process has come to an end.
1.2.3) PROCESS_PATROLZONE state transition functions:
State transition functions can be set by the mission designer customizing or improving the behaviour of the state. There are 2 moments when state transition functions will be called by the state machine:
Before the state transition. The state transition function needs to start with the name OnBefore + the name of the state. If the state transition function returns false, then the processing of the state transition will not be done! If you want to change the behaviour of the AIControllable at this event, return false, but then you'll need to specify your own logic using the AIControllable!
After the state transition. The state transition function needs to start with the name OnAfter + the name of the state. These state transition functions need to provide a return value, which is specified at the function description.
Global(s)
| CARGO | |
| CARGOS | |
| CARGO_PACKAGE | |
| CARGO_REPRESENTABLE | |
| CARGO_UNIT | |
| FSMT |
Type CARGO
| CARGO:Board(ToPointVec2) |
Event Function. |
| CARGO.CargoCarrier |
The alive DCS object carrying the cargo. This value can be nil, meaning, that the cargo is not contained anywhere... |
| CARGO.CargoObject |
The alive DCS object representing the cargo. This value can be nil, meaning, that the cargo is not represented anywhere... |
| CARGO.CargoScheduler | |
| CARGO.ClassName | |
| CARGO.Containable |
This flag defines if the cargo can be contained within a DCS Unit. |
| CARGO:IsNear(PointVec2) |
Check if CargoCarrier is near the Cargo to be Loaded. |
| CARGO:Load(ToCarrier) |
Event Function. |
| CARGO.Moveable |
This flag defines if the cargo is moveable. |
| CARGO.Name |
A string defining the name of the cargo. The name is the unique identifier of the cargo. |
| CARGO.NearRadius |
(optional) A number defining the radius in meters when the cargo is near to a Carrier, so that it can be loaded. |
| CARGO:New(Mission, Type, Name, Weight, ReportRadius, NearRadius) |
CARGO Constructor. |
| CARGO:OnAfterBoarding(Controllable) | |
| CARGO:OnAfterLoaded(Controllable) | |
| CARGO:OnAfterUnBoarding(Controllable) | |
| CARGO:OnAfterUnLoaded(Controllable) | |
| CARGO:OnBeforeBoarding(Controllable) | |
| CARGO:OnBeforeLoaded(Controllable) | |
| CARGO:OnBeforeUnBoarding(Controllable) | |
| CARGO:OnBeforeUnLoaded(Controllable) | |
| CARGO.ReportRadius |
(optional) A number defining the radius in meters when the cargo is signalling or reporting to a Carrier. |
| CARGO.Representable |
This flag defines if the cargo can be represented by a DCS Unit. |
| CARGO.Slingloadable |
This flag defines if the cargo can be slingloaded. |
| CARGO:Spawn(PointVec2) |
Template method to spawn a new representation of the CARGO in the simulator. |
| CARGO.Type |
A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers. |
| CARGO:UnBoard(ToPointVec2) |
Event Function. |
| CARGO.Weight |
A number defining the weight of the cargo. The weight is expressed in kg. |
Type CARGO_PACKAGE
Type CARGO_REPRESENTABLE
| CARGO_REPRESENTABLE.ClassName | |
| CARGO_REPRESENTABLE:New(Mission, CargoObject, Type, Name, Weight, ReportRadius, NearRadius) |
CARGO_REPRESENTABLE Constructor. |
Type CARGO_UNIT
| CARGO_UNIT.CargoCarrier | |
| CARGO_UNIT.CargoInAir | |
| CARGO_UNIT.CargoObject | |
| CARGO_UNIT.ClassName | |
| CARGO_UNIT:New(Mission, CargoUnit, Type, Name, Weight, ReportRadius, NearRadius) |
CARGO_UNIT Constructor. |
| CARGO_UNIT.OnLoadedCallBack | |
| CARGO_UNIT.OnUnLoadedCallBack | |
| CARGO_UNIT:onafterBoard(Event, From, To, CargoCarrier) |
Board Event. |
| CARGO_UNIT:onafterUnBoarded(ToPointVec2, Event, From, To) |
UnBoard Event. |
| CARGO_UNIT:onenterBoarding(CargoCarrier, Event, From, To) |
Enter Boarding State. |
| CARGO_UNIT:onenterLoaded(CargoCarrier, Event, From, To) |
Loaded State. |
| CARGO_UNIT:onenterUnBoarding(ToPointVec2, Event, From, To) |
Enter UnBoarding State. |
| CARGO_UNIT:onenterUnLoaded(Point, Event, From, To, ToPointVec2) |
Enter UnLoaded State. |
| CARGO_UNIT:onleaveBoarding(CargoCarrier, Event, From, To) |
Leave Boarding State. |
| CARGO_UNIT:onleaveUnBoarding(ToPointVec2, Event, From, To) |
Leave UnBoarding State. |
Global(s)
Type Cargo
Type CARGO
Field(s)
- CARGO:Board(ToPointVec2)
-
Event Function.
The cargo must be in the Loaded state. UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
Parameter
-
Point#POINT_VEC2 ToPointVec2: (optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
-
- Positionable#POSITIONABLE CARGO.CargoCarrier
-
The alive DCS object carrying the cargo. This value can be nil, meaning, that the cargo is not contained anywhere...
- Controllable#CONTROLLABLE CARGO.CargoObject
-
The alive DCS object representing the cargo. This value can be nil, meaning, that the cargo is not represented anywhere...
- #string CARGO.ClassName
- #boolean CARGO.Containable
-
This flag defines if the cargo can be contained within a DCS Unit.
- CARGO:IsNear(PointVec2)
-
Check if CargoCarrier is near the Cargo to be Loaded.
Parameter
-
Point#POINT_VEC2 PointVec2:
Return value
#boolean:
-
- CARGO:Load(ToCarrier)
-
Event Function.
The cargo must be in the UnLoaded state. Loads the cargo to a Carrier. The event will load the cargo into the Carrier regardless of its position. There will be no movement simulated of the cargo loading.
Parameter
-
Controllable#CONTROLLABLE ToCarrier: The Carrier that will hold the cargo.
-
- #boolean CARGO.Moveable
-
This flag defines if the cargo is moveable.
- #string CARGO.Name
-
A string defining the name of the cargo. The name is the unique identifier of the cargo.
- #number CARGO.NearRadius
-
(optional) A number defining the radius in meters when the cargo is near to a Carrier, so that it can be loaded.
- CARGO:New(Mission, Type, Name, Weight, ReportRadius, NearRadius)
-
CARGO Constructor.
This class is an abstract class and should not be instantiated.
Parameters
-
Mission#MISSION Mission: -
#string Type: -
#string Name: -
#number Weight: -
#number ReportRadius: (optional) -
#number NearRadius: (optional)
Return value
-
- CARGO:OnAfterBoarding(Controllable)
-
Parameter
-
Controllable#CONTROLLABLE Controllable:
-
- CARGO:OnAfterLoaded(Controllable)
-
Parameter
-
Controllable#CONTROLLABLE Controllable:
-
- CARGO:OnAfterUnBoarding(Controllable)
-
Parameter
-
Controllable#CONTROLLABLE Controllable:
-
- CARGO:OnAfterUnLoaded(Controllable)
-
Parameter
-
Controllable#CONTROLLABLE Controllable:
-
- CARGO:OnBeforeBoarding(Controllable)
-
Parameter
-
Controllable#CONTROLLABLE Controllable:
Return value
#boolean:
-
- CARGO:OnBeforeLoaded(Controllable)
-
Parameter
-
Controllable#CONTROLLABLE Controllable:
Return value
#boolean:
-
- CARGO:OnBeforeUnBoarding(Controllable)
-
Parameter
-
Controllable#CONTROLLABLE Controllable:
Return value
#boolean:
-
- CARGO:OnBeforeUnLoaded(Controllable)
-
Parameter
-
Controllable#CONTROLLABLE Controllable:
Return value
#boolean:
-
- #number CARGO.ReportRadius
-
(optional) A number defining the radius in meters when the cargo is signalling or reporting to a Carrier.
- #boolean CARGO.Representable
-
This flag defines if the cargo can be represented by a DCS Unit.
- #boolean CARGO.Slingloadable
-
This flag defines if the cargo can be slingloaded.
- CARGO:Spawn(PointVec2)
-
Template method to spawn a new representation of the CARGO in the simulator.
Parameter
-
PointVec2:
Return value
-
- #string CARGO.Type
-
A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.
- CARGO:UnBoard(ToPointVec2)
-
Event Function.
The cargo must be in the Loaded state. UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
Parameter
-
Point#POINT_VEC2 ToPointVec2: (optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
-
- #number CARGO.Weight
-
A number defining the weight of the cargo. The weight is expressed in kg.
Type CARGO.CargoObjects
Type CARGO_PACKAGE
Field(s)
- #string CARGO_PACKAGE.ClassName
- CARGO_PACKAGE:IsNear(CargoCarrier)
-
Check if CargoCarrier is near the Cargo to be Loaded.
Parameter
-
Unit#UNIT CargoCarrier:
Return value
#boolean:
-
- CARGO_PACKAGE:New(Mission, CargoCarrier, Type, Name, Weight, ReportRadius, NearRadius)
-
CARGO_PACKAGE Constructor.
Parameters
-
Mission#MISSION Mission: -
Unit#UNIT CargoCarrier: The UNIT carrying the package. -
#string Type: -
#string Name: -
#number Weight: -
#number ReportRadius: (optional) -
#number NearRadius: (optional)
Return value
-
- CARGO_PACKAGE:onafterLoad(FsmP, Event, From, To, CargoCarrier, Speed, LoadDistance, Angle)
-
Load Event.
Parameters
-
#string Event: -
#string From: -
#string To: -
Unit#UNIT CargoCarrier: -
#number Speed: -
#number LoadDistance: -
#number Angle:
- CARGO_PACKAGE:onafterOnBoard(FsmP, Event, From, To, CargoCarrier, Speed, BoardDistance, Angle, LoadDistance)
-
Board Event.
Parameters
-
#string Event: -
#string From: -
#string To: -
Unit#UNIT CargoCarrier: -
#number Speed: -
#number BoardDistance: -
#number Angle: -
LoadDistance:
- CARGO_PACKAGE:onafterOnBoarded(FsmP, Event, From, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle)
-
Boarded Event.
Parameters
-
#string Event: -
#string From: -
#string To: -
Unit#UNIT CargoCarrier: -
Speed: -
BoardDistance: -
LoadDistance: -
Angle:
- CARGO_PACKAGE:onafterUnBoard(FsmP, Event, From, To, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle, CargoCarrier)
-
UnBoard Event.
Parameters
-
#string Event: -
#string From: -
#string To: -
#number Speed: -
#number UnLoadDistance: -
#number UnBoardDistance: -
#number Radius: -
#number Angle: -
CargoCarrier:
- CARGO_PACKAGE:onafterUnBoarded(FsmP, Event, From, To, CargoCarrier, Speed)
-
UnBoarded Event.
Parameters
-
#string Event: -
#string From: -
#string To: -
Unit#UNIT CargoCarrier: -
Speed:
- CARGO_PACKAGE:onafterUnLoad(FsmP, Event, From, To, Distance, Angle, CargoCarrier, Speed)
-
UnLoad Event.
Parameters
-
#string Event: -
#string From: -
#string To: -
#number Distance: -
#number Angle: -
CargoCarrier: -
Speed:
Type CARGO_REPRESENTABLE
Field(s)
- #string CARGO_REPRESENTABLE.ClassName
- CARGO_REPRESENTABLE:New(Mission, CargoObject, Type, Name, Weight, ReportRadius, NearRadius)
-
CARGO_REPRESENTABLE Constructor.
Parameters
-
Mission#MISSION Mission: -
Controllable#Controllable CargoObject: -
#string Type: -
#string Name: -
#number Weight: -
#number ReportRadius: (optional) -
#number NearRadius: (optional)
Return value
-
Type CARGO_UNIT
Field(s)
- #string CARGO_UNIT.ClassName
- CARGO_UNIT:New(Mission, CargoUnit, Type, Name, Weight, ReportRadius, NearRadius)
-
CARGO_UNIT Constructor.
Parameters
-
Mission#MISSION Mission: -
Unit#UNIT CargoUnit: -
#string Type: -
#string Name: -
#number Weight: -
#number ReportRadius: (optional) -
#number NearRadius: (optional)
Return value
-
- CARGO_UNIT:onafterBoard(Event, From, To, CargoCarrier)
-
Board Event.
Parameters
-
#string Event: -
#string From: -
#string To: -
CargoCarrier:
-
- CARGO_UNIT:onafterUnBoarded(ToPointVec2, Event, From, To)
-
UnBoard Event.
Parameters
-
Point#POINT_VEC2 ToPointVec2: -
#string Event: -
#string From: -
#string To:
-
- CARGO_UNIT:onenterBoarding(CargoCarrier, Event, From, To)
-
Enter Boarding State.
Parameters
-
Unit#UNIT CargoCarrier: -
#string Event: -
#string From: -
#string To:
-
- CARGO_UNIT:onenterLoaded(CargoCarrier, Event, From, To)
-
Loaded State.
Parameters
-
Unit#UNIT CargoCarrier: -
#string Event: -
#string From: -
#string To:
-
- CARGO_UNIT:onenterUnBoarding(ToPointVec2, Event, From, To)
-
Enter UnBoarding State.
Parameters
-
Point#POINT_VEC2 ToPointVec2: -
#string Event: -
#string From: -
#string To:
-
- CARGO_UNIT:onenterUnLoaded(Point, Event, From, To, ToPointVec2)
-
Enter UnLoaded State.
Parameters
-
Point: POINT_VEC2 -
#string Event: -
#string From: -
#string To: -
ToPointVec2:
-
- CARGO_UNIT:onleaveBoarding(CargoCarrier, Event, From, To)
-
Leave Boarding State.
Parameters
-
Unit#UNIT CargoCarrier: -
#string Event: -
#string From: -
#string To:
-
- CARGO_UNIT:onleaveUnBoarding(ToPointVec2, Event, From, To)
-
Leave UnBoarding State.
Parameters
-
Point#POINT_VEC2 ToPointVec2: -
#string Event: -
#string From: -
#string To:
-