Module Task_Cargo

Tasking -- The TASK_CARGO models tasks for players to transport Cargo.

Banner Image


The Moose framework provides various CARGO classes that allow DCS phisical or logical objects to be transported or sling loaded by Carriers. The CARGO_ classes, as part of the moose core, are able to Board, Load, UnBoard and UnLoad cargo between Carrier units.

This collection of classes in this module define tasks for human players to handle these cargo objects. Cargo can be transported, picked-up, deployed and sling-loaded from and to other places.

The following classes are important to consider:

  • #TASKCARGOTRANSPORT: Defines a task for a human player to transport a set of cargo between various zones.

Author: Sven Van de Velde (FlightControl)

Contributions:


Global(s)

TASK_CARGO

TASK_CARGO class, extends Task#TASK

A flexible tasking system

The TASK_CARGO classes provide you with a flexible tasking sytem, that allows you to transport cargo of various types between various locations and various dedicated deployment zones.

TASK_CARGO_TRANSPORT

Type FSM_PROCESS

FSM_PROCESS.Cargo
FSM_PROCESS.DeployZone

Type TASK_CARGO

TASK_CARGO:AddDeployZone(DeployZone, TaskUnit)
TASK_CARGO.CargoItemCount
TASK_CARGO.CargoLimit
TASK_CARGO.DeployZones
TASK_CARGO:GetCargoSet()
TASK_CARGO:GetDeployZones()
TASK_CARGO:GetGoalTotal()
TASK_CARGO:GetPlannedMenuText()
TASK_CARGO:GetSmokeColor()
TASK_CARGO:GetTargetZone(TaskUnit)
TASK_CARGO:New(Mission, SetGroup, TaskName, SetCargo, TaskType, TaskBriefing)

Instantiates a new TASK_CARGO.

TASK_CARGO:RemoveDeployZone(DeployZone, TaskUnit)
TASK_CARGO.SetCargo
TASK_CARGO:SetCargoLimit(CargoLimit)

Set a limit on the amount of cargo items that can be loaded into the Carriers.

TASK_CARGO:SetCargoPickup(Cargo, TaskUnit)
TASK_CARGO:SetDeployZone(DeployZone, TaskUnit)
TASK_CARGO:SetDeployZones(@, TaskUnit, DeployZones)
TASK_CARGO:SetGoalTotal()
TASK_CARGO:SetScoreOnFail(Text, Penalty, TaskUnit)

Set a penalty when the A2G attack has failed.

TASK_CARGO:SetScoreOnProgress(Text, Score, TaskUnit)

Set a score when a target in scope of the A2G attack, has been destroyed .

TASK_CARGO:SetScoreOnSuccess(Text, Score, TaskUnit)

Set a score when all the targets in scope of the A2G attack, have been destroyed.

TASK_CARGO.SetSmokeColor(Color, self, SmokeColor)
TASK_CARGO.SmokeColor
TASK_CARGO.TaskType

Type TASK_CARGO_TRANSPORT

TASK_CARGO_TRANSPORT:CargoDeployed(TaskUnit, Cargo, DeployZone)

Synchronous Event Trigger for Event CargoDeployed.

TASK_CARGO_TRANSPORT:CargoPickedUp(TaskUnit, Cargo)

Synchronous Event Trigger for Event CargoPickedUp.

TASK_CARGO_TRANSPORT.ClassName
TASK_CARGO_TRANSPORT:IsAllCargoTransported()
TASK_CARGO_TRANSPORT:New(Mission, SetGroup, TaskName, SetCargo, TaskBriefing)

Instantiates a new TASKCARGOTRANSPORT.

TASK_CARGO_TRANSPORT:OnAfterCargoDeployed(From, Event, To, TaskUnit, Cargo, DeployZone)

OnAfter Transition Handler for Event CargoDeployed.

TASK_CARGO_TRANSPORT:OnAfterCargoPickedUp(From, Event, To, TaskUnit, Cargo)

OnAfter Transition Handler for Event CargoPickedUp.

TASK_CARGO_TRANSPORT:OnBeforeCargoDeployed(From, Event, To, TaskUnit, Cargo, DeployZone)

OnBefore Transition Handler for Event CargoDeployed.

TASK_CARGO_TRANSPORT:OnBeforeCargoPickedUp(From, Event, To, TaskUnit, Cargo)

OnBefore Transition Handler for Event CargoPickedUp.

TASK_CARGO_TRANSPORT:ReportOrder(ReportGroup)
TASK_CARGO_TRANSPORT:__CargoDeployed(Delay, TaskUnit, Cargo, DeployZone)

Asynchronous Event Trigger for Event CargoDeployed.

TASK_CARGO_TRANSPORT:__CargoPickedUp(Delay, TaskUnit, Cargo)

Asynchronous Event Trigger for Event CargoPickedUp.

TASK_CARGO_TRANSPORT:onafterGoal(TaskUnit, From, Event, To)

Global(s)

#TASK_CARGO TASK_CARGO

TASK_CARGO class, extends Task#TASK

A flexible tasking system

The TASK_CARGO classes provide you with a flexible tasking sytem, that allows you to transport cargo of various types between various locations and various dedicated deployment zones.

The cargo in scope of the TASKCARGO classes must be explicitly given, and is of type SETCARGO. The SET_CARGO contains a collection of CARGO objects that must be handled by the players in the mission.

Task execution experience from the player perspective

A human player can join the battle field in a client airborne slot or a ground vehicle within the CA module (ALT-J). The player needs to accept the task from the task overview list within the mission, using the radio menus.

Once the TASK_CARGO is assigned to the player and accepted by the player, the player will obtain an extra Cargo Handling Radio Menu that contains the CARGO objects that need to be transported.

Each CARGO object has a certain state:

  • UnLoaded: The CARGO is located within the battlefield. It may still need to be transported.
  • Loaded: The CARGO is loaded within a Carrier. This can be your air unit, or another air unit, or even a vehicle.
  • Boarding: The CARGO is running or moving towards your Carrier for loading.
  • UnBoarding: The CARGO is driving or jumping out of your Carrier and moves to a location in the Deployment Zone.

Cargo must be transported towards different **Deployment Zones**.

The Cargo Handling Radio Menu system allows to execute various actions to handle the cargo. In the menu, you'll find for each CARGO, that is part of the scope of the task, various actions that can be completed. Depending on the location of your Carrier unit, the menu options will vary.

Cargo Pickup and Boarding

For cargo boarding, a cargo can only execute the boarding actions if it is within the foreseen Reporting Range. Therefore, it is important that you steer your Carrier within the Reporting Range, so that boarding actions can be executed on the cargo. To Pickup and Board cargo, the following menu items will be shown in your carrier radio menu:

Board Cargo

If your Carrier is within the Reporting Range of the cargo, it will allow to pickup the cargo by selecting this menu option. Depending on the Cargo type, the cargo will either move to your Carrier or you will receive instructions how to handle the cargo pickup. If the cargo moves to your carrier, it will indicate the boarding status. Note that multiple units need to board your Carrier, so it is required to await the full boarding process. Once the cargo is fully boarded within your Carrier, you will be notified of this.

Note that for airborne Carriers, it is required to land first before the Boarding process can be initiated. If during boarding the Carrier gets airborne, the boarding process will be cancelled.

Pickup Cargo

If your Carrier is not within the Reporting Range of the cargo, the HQ will guide you to its location. Routing information is shown in flight that directs you to the cargo within Reporting Range. Upon arrival, the Cargo will contact you and further instructions will be given. When your Carrier is airborne, you will receive instructions to land your Carrier. The action will not be completed until you've landed your Carrier.

Cargo Deploy and UnBoarding

Various Deployment Zones can be foreseen in the scope of the Cargo transportation. Each deployment zone can be of varying Zone type. The Cargo Handling Radio Menu provides with menu options to execute an action to steer your Carrier to a specific Zone.

UnBoard Cargo

If your Carrier is already within a Deployment Zone, then the Cargo Handling Radio Menu allows to UnBoard a specific cargo that is loaded within your Carrier group into the Deployment Zone. Note that the Unboarding process takes a while, as the cargo units (infantry or vehicles) must unload from your Carrier. Ensure that you stay at the position or stay on the ground while Unboarding. If any unforeseen manoeuvre is done by the Carrier, then the Unboarding will be cancelled.

Deploy Cargo

If your Carrier is not within a Deployment Zone, you'll need to fly towards one. Fortunately, the Cargo Handling Radio Menu provides you with menu options to select a specific Deployment Zone to fly towards. Once a Deployment Zone has been selected, your Carrier will receive routing information from HQ towards the Deployment Zone center. Upon arrival, the HQ will provide you with further instructions. When your Carrier is airborne, you will receive instructions to land your Carrier. The action will not be completed until you've landed your Carrier!

Handle TASK_CARGO Events ...

The TASK_CARGO classes define Cargo transport tasks, based on the tasking capabilities defined in Task#TASK.

Specific TASK_CARGO Events

Specific Cargo Handling event can be captured, that allow to trigger specific actions!

  • Boarded: Triggered when the Cargo has been Boarded into your Carrier.
  • UnBoarded: Triggered when the cargo has been Unboarded from your Carrier and has arrived at the Deployment Zone.

Standard TASK_CARGO Events

The TASK_CARGO is implemented using a Statemachine#FSM_TASK, and has the following standard statuses:

  • None: Start of the process.
  • Planned: The cargo task is planned.
  • Assigned: The cargo task is assigned to a Group#GROUP.
  • Success: The cargo task is successfully completed.
  • Failed: The cargo task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.

#TASK_CARGO_TRANSPORT TASK_CARGO_TRANSPORT

Type Task_Cargo

Type FSM_PROCESS

Field(s)

FSM_PROCESS.Cargo
FSM_PROCESS.DeployZone

Type TASK_CARGO

Field(s)

TASK_CARGO:AddDeployZone(DeployZone, TaskUnit)

Parameters

Return value

#TASK_CARGO:

TASK_CARGO.CargoItemCount

Map of Carriers having a cargo item count to check the cargo loading limits.

#number TASK_CARGO.CargoLimit
TASK_CARGO.DeployZones

setmetatable( {}, { __mode = "v" } ) -- weak table on value

TASK_CARGO:GetCargoSet()

Return value

Core.Set#SET_CARGO: The Cargo Set.

TASK_CARGO:GetDeployZones()

Return value

#list: Core.Zone#ZONE_BASE> The Deployment Zones.

TASK_CARGO:GetGoalTotal()
TASK_CARGO:GetPlannedMenuText()
TASK_CARGO:GetSmokeColor()

@return SmokeColor

TASK_CARGO:GetTargetZone(TaskUnit)

Parameter

Return value

Core.Zone#ZONE_BASE: The Zone object where the Target is located on the map.

TASK_CARGO:New(Mission, SetGroup, TaskName, SetCargo, TaskType, TaskBriefing)

Instantiates a new TASK_CARGO.

Parameters

  • Tasking.Mission#MISSION Mission :

  • Set#SET_GROUP SetGroup : The set of groups for which the Task can be assigned.

  • #string TaskName : The name of the Task.

  • Core.Set#SET_CARGO SetCargo : The scope of the cargo to be transported.

  • #string TaskType : The type of Cargo task.

  • #string TaskBriefing : The Cargo Task briefing.

Return value

#TASK_CARGO: self

TASK_CARGO:RemoveDeployZone(DeployZone, TaskUnit)

Parameters

Return value

#TASK_CARGO:

TASK_CARGO.SetCargo
TASK_CARGO:SetCargoLimit(CargoLimit)

Set a limit on the amount of cargo items that can be loaded into the Carriers.

Parameter

  • CargoLimit : Specifies a number of cargo items that can be loaded in the helicopter.

Return value

#TASK_CARGO:

TASK_CARGO:SetCargoPickup(Cargo, TaskUnit)

Parameters

Return value

#TASK_CARGO:

TASK_CARGO:SetDeployZone(DeployZone, TaskUnit)

Parameters

Return value

#TASK_CARGO:

TASK_CARGO:SetDeployZones(@, TaskUnit, DeployZones)

Parameters

Return value

#TASK_CARGO:

TASK_CARGO:SetGoalTotal()
TASK_CARGO:SetScoreOnFail(Text, Penalty, TaskUnit)

Set a penalty when the A2G attack has failed.

Parameters

  • #string Text : The text to display to the player, when the A2G attack has failed.

  • #number Penalty : The penalty in points.

  • Wrapper.Unit#UNIT TaskUnit :

Return value

#TASK_CARGO:

TASK_CARGO:SetScoreOnProgress(Text, Score, TaskUnit)

Set a score when a target in scope of the A2G attack, has been destroyed .

Parameters

  • #string Text : The text to display to the player, when the target has been destroyed.

  • #number Score : The score in points.

  • Wrapper.Unit#UNIT TaskUnit :

Return value

#TASK_CARGO:

TASK_CARGO:SetScoreOnSuccess(Text, Score, TaskUnit)

Set a score when all the targets in scope of the A2G attack, have been destroyed.

Parameters

  • #string Text : The text to display to the player, when all targets hav been destroyed.

  • #number Score : The score in points.

  • Wrapper.Unit#UNIT TaskUnit :

Return value

#TASK_CARGO:

TASK_CARGO.SetSmokeColor(Color, self, SmokeColor)

Parameters

  • Color : Might be SMOKECOLOR.Blue, SMOKECOLOR.Red SMOKECOLOR.Orange, SMOKECOLOR.White or SMOKECOLOR.Green

  • self :

  • SmokeColor :

TASK_CARGO.SmokeColor
TASK_CARGO.TaskType

Type TASK_CARGO_TRANSPORT

The TASKCARGOTRANSPORT class

Field(s)

TASK_CARGO_TRANSPORT:CargoDeployed(TaskUnit, Cargo, DeployZone)

Synchronous Event Trigger for Event CargoDeployed.

Parameters

  • Wrapper.Unit#UNIT TaskUnit : The Unit (Client) that Deployed the cargo. You can use this to retrieve the PlayerName etc.

  • Core.Cargo#CARGO Cargo : The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

  • Core.Zone#ZONE DeployZone : The zone where the Cargo got Deployed or UnBoarded.

TASK_CARGO_TRANSPORT:CargoPickedUp(TaskUnit, Cargo)

Synchronous Event Trigger for Event CargoPickedUp.

Parameters

  • Wrapper.Unit#UNIT TaskUnit : The Unit (Client) that PickedUp the cargo. You can use this to retrieve the PlayerName etc.

  • Core.Cargo#CARGO Cargo : The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

#string TASK_CARGO_TRANSPORT.ClassName
TASK_CARGO_TRANSPORT:IsAllCargoTransported()

Return value

#boolean:

TASK_CARGO_TRANSPORT:New(Mission, SetGroup, TaskName, SetCargo, TaskBriefing)

Instantiates a new TASKCARGOTRANSPORT.

Parameters

  • Tasking.Mission#MISSION Mission :

  • Set#SET_GROUP SetGroup : The set of groups for which the Task can be assigned.

  • #string TaskName : The name of the Task.

  • Core.Set#SET_CARGO SetCargo : The scope of the cargo to be transported.

  • #string TaskBriefing : The Cargo Task briefing.

Return value

#TASKCARGOTRANSPORT: self

TASK_CARGO_TRANSPORT:OnAfterCargoDeployed(From, Event, To, TaskUnit, Cargo, DeployZone)

OnAfter Transition Handler for Event CargoDeployed.

Parameters

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

  • Wrapper.Unit#UNIT TaskUnit : The Unit (Client) that Deployed the cargo. You can use this to retrieve the PlayerName etc.

  • Core.Cargo#CARGO Cargo : The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

  • Core.Zone#ZONE DeployZone : The zone where the Cargo got Deployed or UnBoarded.

TASK_CARGO_TRANSPORT:OnAfterCargoPickedUp(From, Event, To, TaskUnit, Cargo)

OnAfter Transition Handler for Event CargoPickedUp.

Parameters

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

  • Wrapper.Unit#UNIT TaskUnit : The Unit (Client) that PickedUp the cargo. You can use this to retrieve the PlayerName etc.

  • Core.Cargo#CARGO Cargo : The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

TASK_CARGO_TRANSPORT:OnBeforeCargoDeployed(From, Event, To, TaskUnit, Cargo, DeployZone)

OnBefore Transition Handler for Event CargoDeployed.

Parameters

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

  • Wrapper.Unit#UNIT TaskUnit : The Unit (Client) that Deployed the cargo. You can use this to retrieve the PlayerName etc.

  • Core.Cargo#CARGO Cargo : The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

  • Core.Zone#ZONE DeployZone : The zone where the Cargo got Deployed or UnBoarded.

Return value

#boolean: Return false to cancel Transition.

TASK_CARGO_TRANSPORT:OnBeforeCargoPickedUp(From, Event, To, TaskUnit, Cargo)

OnBefore Transition Handler for Event CargoPickedUp.

Parameters

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

  • Wrapper.Unit#UNIT TaskUnit : The Unit (Client) that PickedUp the cargo. You can use this to retrieve the PlayerName etc.

  • Core.Cargo#CARGO Cargo : The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

Return value

#boolean: Return false to cancel Transition.

TASK_CARGO_TRANSPORT:ReportOrder(ReportGroup)

Parameter

  • ReportGroup :

TASK_CARGO_TRANSPORT:__CargoDeployed(Delay, TaskUnit, Cargo, DeployZone)

Asynchronous Event Trigger for Event CargoDeployed.

Parameters

  • #number Delay : The delay in seconds.

  • Wrapper.Unit#UNIT TaskUnit : The Unit (Client) that Deployed the cargo. You can use this to retrieve the PlayerName etc.

  • Core.Cargo#CARGO Cargo : The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

  • Core.Zone#ZONE DeployZone : The zone where the Cargo got Deployed or UnBoarded.

TASK_CARGO_TRANSPORT:__CargoPickedUp(Delay, TaskUnit, Cargo)

Asynchronous Event Trigger for Event CargoPickedUp.

Parameters

  • #number Delay : The delay in seconds.

  • Wrapper.Unit#UNIT TaskUnit : The Unit (Client) that PickedUp the cargo. You can use this to retrieve the PlayerName etc.

  • Core.Cargo#CARGO Cargo : The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

TASK_CARGO_TRANSPORT:onafterGoal(TaskUnit, From, Event, To)

Parameters

  • TaskUnit :

  • From :

  • Event :

  • To :

Type list