Updated to CARGO TASKING model. Now capture from the dispatcher the CargoPickedUp and CargoDeployed events.

This commit is contained in:
FlightControl 2018-09-18 10:25:13 +02:00
parent 7cd40e2d2c
commit e0c8d55a5d
4 changed files with 362 additions and 9 deletions

View File

@ -367,6 +367,15 @@
--
-- **Deploying a cargo within a deployment zone, may complete a deployment task! So ensure that you deploy the right cargo at the right deployment zone!**
--
-- ## 4) Cargo tasking from a mission designer perspective.
--
-- Please consult the documentation how to implement the derived classes of SET_CARGO in:
--
-- - @{Tasking.Task_Cargo#TASK_CARGO}: Documents the main methods how to handle the cargo tasking from a mission designer perspective.
-- - @{Tasking.Task_Cargo#TASK_CARGO_TRANSPORT}: Documents the specific methods how to handle the cargo transportation tasking from a mission designer perspective.
-- - @{Tasking.Task_Cargo#TASK_CARGO_CSAR}: Documents the specific methods how to handle the cargo CSAR tasking from a mission designer perspective.
--
--
-- ===
--
-- ### Author: **FlightControl**
@ -445,6 +454,8 @@ do -- TASK_CARGO
-- * **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.
--
--
--
-- ===
--
-- @field #TASK_CARGO
@ -716,11 +727,11 @@ do -- TASK_CARGO
-- Cargo in deployzones are flagged as deployed.
for DeployZoneName, DeployZone in pairs( Task.DeployZones ) do
if Cargo:IsInZone( DeployZone ) then
Task:E( { CargoIsDeployed = Task.CargoDeployed and "true" or "false" } )
Task:I( { CargoIsDeployed = Task.CargoDeployed and "true" or "false" } )
if Cargo:IsDeployed() == false then
Cargo:SetDeployed( true )
-- Now we call a callback method to handle the CargoDeployed event.
Task:E( { CargoIsAlive = Cargo:IsAlive() and "true" or "false" } )
Task:I( { CargoIsAlive = Cargo:IsAlive() and "true" or "false" } )
if Cargo:IsAlive() then
Task:CargoDeployed( TaskUnit, Cargo, DeployZone )
end

View File

@ -152,6 +152,114 @@ do -- TASK_CARGO_CSAR
-- It is better you use the cargo dispatcher to generate CSAR tasks and it will work as it is intended.
-- By doing this, CSAR tasking will become a dynamic experience.
--
-- # 2) Create a task using the @{Tasking.Task_Cargo_Dispatcher} module.
--
-- Actually, it is better to **GENERATE** these tasks using the @{Tasking.Task_Cargo_Dispatcher} module.
-- Using the dispatcher module, transport tasks can be created much more easy.
--
-- Find below an example how to use the TASK_CARGO_DISPATCHER class:
--
--
-- -- Find the HQ group.
-- HQ = GROUP:FindByName( "HQ", "Bravo" )
--
-- -- Create the command center with the name "Lima".
-- CommandCenter = COMMANDCENTER
-- :New( HQ, "Lima" )
--
-- -- Create the mission, for the command center, with the name "CSAR Mission", a "Tactical" mission, with the mission briefing "Rescue downed pilots.", for the RED coalition.
-- Mission = MISSION
-- :New( CommandCenter, "CSAR Mission", "Tactical", "Rescue downed pilots.", coalition.side.RED )
--
-- -- Create the SET of GROUPs containing clients (players) that will transport the cargo.
-- -- These are have a name that start with "Rescue" and are of the "red" coalition.
-- AttackGroups = SET_GROUP:New():FilterCoalitions( "red" ):FilterPrefixes( "Rescue" ):FilterStart()
--
--
-- -- Here we create the TASK_CARGO_DISPATCHER object! This is where we assign the dispatcher to generate tasks in the Mission for the AttackGroups.
-- TaskDispatcher = TASK_CARGO_DISPATCHER:New( Mission, AttackGroups )
--
--
-- -- Here the task dispatcher will generate automatically CSAR tasks once a pilot ejects.
-- TaskDispatcher:StartCSARTasks(
-- "CSAR",
-- { ZONE_UNIT:New( "Hospital", STATIC:FindByName( "Hospital" ), 100 ) },
-- "One of our pilots has ejected. Go out to Search and Rescue our pilot!\n" ..
-- "Use the radio menu to let the command center assist you with the CSAR tasking."
-- )
--
-- # 3) Handle cargo task events.
--
-- When a player is picking up and deploying cargo using his carrier, events are generated by the tasks. These events can be captured and tailored with your own code.
--
-- In order to properly capture the events and avoid mistakes using the documentation, it is advised that you execute the following actions:
--
-- * **Copy / Paste** the code section into your script.
-- * **Change** the CLASS literal to the task object name you have in your script.
-- * Within the function, you can now **write your own code**!
-- * **IntelliSense** will recognize the type of the variables provided by the function. Note: the From, Event and To variables can be safely ignored,
-- but you need to declare them as they are automatically provided by the event handling system of MOOSE.
--
-- You can send messages or fire off any other events within the code section. The sky is the limit!
--
-- NOTE: CSAR tasks are actually automatically created by the TASK_CARGO_DISPATCHER. So the underlying is not really applicable for mission designers as they will use the dispatcher instead
-- of capturing these events from manually created CSAR tasks!
--
-- ## 3.1) Handle the **CargoPickedUp** event.
--
-- Find below an example how to tailor the **CargoPickedUp** event, generated by the CSARTask:
--
-- function CSARTask:OnAfterCargoPickedUp( From, Event, To, TaskUnit, Cargo )
--
-- MESSAGE:NewType( "Unit " .. TaskUnit:GetName().. " has picked up cargo.", MESSAGE.Type.Information ):ToAll()
--
-- end
--
-- If you want to code your own event handler, use this code fragment to tailor the event when a player carrier has picked up a cargo object in the CarrierGroup.
-- You can use this event handler to post messages to players, or provide status updates etc.
--
-- --- CargoPickedUp event handler OnAfter for CLASS.
-- -- @param #CLASS self
-- -- @param #string From A string that contains the "*from state name*" when the event was triggered.
-- -- @param #string Event A string that contains the "*event name*" when the event was triggered.
-- -- @param #string To A string that contains the "*to state name*" when the event was triggered.
-- -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has picked up the cargo.
-- -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been picked up. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object!
-- function CLASS:OnAfterCargoPickedUp( From, Event, To, TaskUnit, Cargo )
--
-- -- Write here your own code.
--
-- end
--
--
-- ## 3.2) Handle the **CargoDeployed** event.
--
-- Find below an example how to tailor the **CargoDeployed** event, generated by the CSARTask:
--
-- function CSARTask:OnAfterCargoDeployed( From, Event, To, TaskUnit, Cargo, DeployZone )
--
-- MESSAGE:NewType( "Unit " .. TaskUnit:GetName().. " has deployed cargo at zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll()
--
-- end
--
-- If you want to code your own event handler, use this code fragment to tailor the event when a player carrier has deployed a cargo object from the CarrierGroup.
-- You can use this event handler to post messages to players, or provide status updates etc.
--
--
-- --- CargoDeployed event handler OnAfter for CLASS.
-- -- @param #CLASS self
-- -- @param #string From A string that contains the "*from state name*" when the event was triggered.
-- -- @param #string Event A string that contains the "*event name*" when the event was triggered.
-- -- @param #string To A string that contains the "*to state name*" when the event was triggered.
-- -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has deployed the cargo.
-- -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been deployed. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object!
-- -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
-- function CLASS:OnAfterCargoDeployed( From, Event, To, TaskUnit, Cargo, DeployZone )
--
-- -- Write here your own code.
--
-- end
--
-- ===
--
-- @field #TASK_CARGO_CSAR

View File

@ -261,6 +261,97 @@ do -- TASK_CARGO_DISPATCHER
-- Use the @{#TASK_CARGO_DISPATCHER.SetCSARDeployZone}() to setup one deployment zone, and @{#TASK_CARGO_DISPATCHER.SetCSARDeployZones}() to setup multiple default deployment zones in one call.
--
--
-- # 5) Handle cargo task events.
--
-- When a player is picking up and deploying cargo using his carrier, events are generated by the dispatcher. These events can be captured and tailored with your own code.
--
-- In order to properly capture the events and avoid mistakes using the documentation, it is advised that you execute the following actions:
--
-- * **Copy / Paste** the code section into your script.
-- * **Change** the CLASS literal to the task object name you have in your script.
-- * Within the function, you can now **write your own code**!
-- * **IntelliSense** will recognize the type of the variables provided by the function. Note: the From, Event and To variables can be safely ignored,
-- but you need to declare them as they are automatically provided by the event handling system of MOOSE.
--
-- You can send messages or fire off any other events within the code section. The sky is the limit!
--
-- First, we need to create a TASK_CARGO_DISPATCHER object.
--
-- TaskDispatcher = TASK_CARGO_DISPATCHER:New( Mission, PilotGroupSet )
--
-- Second, we create a new cargo transport task for the transportation of workmaterials.
--
-- TaskDispatcher:AddTransportTask(
-- "Transport workmaterials",
-- WorkmaterialsCargoSet,
-- "Transport the workers, engineers and the equipment near the Workplace." )
--
-- Note that we don't really need to keep the resulting task, it is kept internally also in the dispatcher.
--
-- Using the `TaskDispatcher` object, we can now cpature the CargoPickedUp and CargoDeployed events.
--
-- ## 5.1) Handle the **CargoPickedUp** event.
--
-- Find below an example how to tailor the **CargoPickedUp** event, generated by the `TaskDispatcher`:
--
-- function TaskDispatcher:OnAfterCargoPickedUp( From, Event, To, Task, TaskPrefix, TaskUnit, Cargo )
--
-- MESSAGE:NewType( "Unit " .. TaskUnit:GetName().. " has picked up cargo for task " .. Task:GetName() .. ".", MESSAGE.Type.Information ):ToAll()
--
-- end
--
-- If you want to code your own event handler, use this code fragment to tailor the event when a player carrier has picked up a cargo object in the CarrierGroup.
-- You can use this event handler to post messages to players, or provide status updates etc.
--
-- --- CargoPickedUp event handler OnAfter for CLASS.
-- -- @param #CLASS self
-- -- @param #string From A string that contains the "*from state name*" when the event was triggered.
-- -- @param #string Event A string that contains the "*event name*" when the event was triggered.
-- -- @param #string To A string that contains the "*to state name*" when the event was triggered.
-- -- @param Tasking.Task_Cargo#TASK_CARGO Task The cargo task for which the cargo has been picked up. Note that this will be a derived TAKS_CARGO object!
-- -- @param #string TaskPrefix The prefix of the task that was provided when the task was created.
-- -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has picked up the cargo.
-- -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been picked up. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object!
-- function CLASS:OnAfterCargoPickedUp( From, Event, To, Task, TaskPrefix, TaskUnit, Cargo )
--
-- -- Write here your own code.
--
-- end
--
--
-- ## 5.2) Handle the **CargoDeployed** event.
--
-- Find below an example how to tailor the **CargoDeployed** event, generated by the `TaskDispatcher`:
--
-- function WorkplaceTask:OnAfterCargoDeployed( From, Event, To, Task, TaskPrefix, TaskUnit, Cargo, DeployZone )
--
-- MESSAGE:NewType( "Unit " .. TaskUnit:GetName().. " has deployed cargo at zone " .. DeployZone:GetName() .. " for task " .. Task:GetName() .. ".", MESSAGE.Type.Information ):ToAll()
--
-- Helos[ math.random(1,#Helos) ]:Spawn()
-- EnemyHelos[ math.random(1,#EnemyHelos) ]:Spawn()
-- end
--
-- If you want to code your own event handler, use this code fragment to tailor the event when a player carrier has deployed a cargo object from the CarrierGroup.
-- You can use this event handler to post messages to players, or provide status updates etc.
--
--
-- --- CargoDeployed event handler OnAfter for CLASS.
-- -- @param #CLASS self
-- -- @param #string From A string that contains the "*from state name*" when the event was triggered.
-- -- @param #string Event A string that contains the "*event name*" when the event was triggered.
-- -- @param #string To A string that contains the "*to state name*" when the event was triggered.
-- -- @param Tasking.Task_Cargo#TASK_CARGO Task The cargo task for which the cargo has been deployed. Note that this will be a derived TAKS_CARGO object!
-- -- @param #string TaskPrefix The prefix of the task that was provided when the task was created.
-- -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has deployed the cargo.
-- -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been deployed. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object!
-- -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
-- function CLASS:OnAfterCargoDeployed( From, Event, To, Task, TaskPrefix, TaskUnit, Cargo, DeployZone )
--
-- -- Write here your own code.
--
-- end
--
--
--
-- @field #TASK_CARGO_DISPATCHER
TASK_CARGO_DISPATCHER = {
@ -288,6 +379,8 @@ do -- TASK_CARGO_DISPATCHER
self.Mission = Mission
self:AddTransition( "Started", "Assign", "Started" )
self:AddTransition( "Started", "CargoPickedUp", "Started" )
self:AddTransition( "Started", "CargoDeployed", "Started" )
--- OnAfter Transition Handler for Event Assign.
-- @function [parent=#TASK_CARGO_DISPATCHER] OnAfterAssign
@ -462,6 +555,7 @@ do -- TASK_CARGO_DISPATCHER
self.CSAR[CSARTaskName].PilotGroup = CSARGroup
self.CSAR[CSARTaskName].Briefing = CSARBriefing
self.CSAR[CSARTaskName].Task = nil
self.CSAR[CSARTaskName].TaskPrefix = CSARTaskPrefix
return CSARTaskName
end
@ -547,16 +641,17 @@ do -- TASK_CARGO_DISPATCHER
-- -- Here we set a TransportDeployZone. We use the WorkplaceTask as the reference, and provide a ZONE object.
-- TaskDispatcher:SetTransportDeployZone( WorkplaceTask, ZONE:New( "Workplace" ) )
--
function TASK_CARGO_DISPATCHER:AddTransportTask( TaskName, SetCargo, Briefing )
function TASK_CARGO_DISPATCHER:AddTransportTask( TaskPrefix, SetCargo, Briefing )
self.TransportCount = self.TransportCount + 1
local TaskName = string.format( ( TaskName or "Transport" ) .. ".%03d", self.TransportCount )
local TaskName = string.format( ( TaskPrefix or "Transport" ) .. ".%03d", self.TransportCount )
self.Transport[TaskName] = {}
self.Transport[TaskName].SetCargo = SetCargo
self.Transport[TaskName].Briefing = Briefing
self.Transport[TaskName].Task = nil
self.Transport[TaskName].TaskPrefix = TaskPrefix
self:ManageTasks()
@ -663,6 +758,7 @@ do -- TASK_CARGO_DISPATCHER
-- New CSAR Task
local SetCargo = self:EvaluateCSAR( CSAR.PilotGroup )
CSAR.Task = TASK_CARGO_CSAR:New( Mission, self.SetGroup, CSARName, SetCargo, CSAR.Briefing )
CSAR.Task.TaskPrefix = CSAR.TaskPrefix -- We keep the TaskPrefix for further reference!
Mission:AddTask( CSAR.Task )
TaskReport:Add( CSARName )
if CSAR.DeployZones then
@ -670,6 +766,17 @@ do -- TASK_CARGO_DISPATCHER
else
CSAR.Task:SetDeployZones( self.DefaultDeployZones or {} )
end
-- Now broadcast the onafterCargoPickedUp event to the Task Cargo Dispatcher.
function CSAR.Task.OnAfterCargoPickedUp( Task, From, Event, To, TaskUnit, Cargo )
self:CargoPickedUp( Task, Task.TaskPrefix, TaskUnit, Cargo )
end
-- Now broadcast the onafterCargoDeployed event to the Task Cargo Dispatcher.
function CSAR.Task.OnAfterCargoDeployed( Task, From, Event, To, TaskUnit, Cargo, DeployZone )
self:CargoDeployed( Task, Task.TaskPrefix, TaskUnit, Cargo, DeployZone )
end
end
end
@ -680,6 +787,7 @@ do -- TASK_CARGO_DISPATCHER
if not Transport.Task then
-- New Transport Task
Transport.Task = TASK_CARGO_TRANSPORT:New( Mission, self.SetGroup, TransportName, Transport.SetCargo, Transport.Briefing )
Transport.Task.TaskPrefix = Transport.TaskPrefix -- We keep the TaskPrefix for further reference!
Mission:AddTask( Transport.Task )
TaskReport:Add( TransportName )
function Transport.Task.OnEnterSuccess( Task, From, Event, To )
@ -697,6 +805,17 @@ do -- TASK_CARGO_DISPATCHER
function Transport.Task.OnEnterAborted( Task, From, Event, To )
self:Aborted( Task )
end
-- Now broadcast the onafterCargoPickedUp event to the Task Cargo Dispatcher.
function Transport.Task.OnAfterCargoPickedUp( Task, From, Event, To, TaskUnit, Cargo )
self:CargoPickedUp( Task, Task.TaskPrefix, TaskUnit, Cargo )
end
-- Now broadcast the onafterCargoDeployed event to the Task Cargo Dispatcher.
function Transport.Task.OnAfterCargoDeployed( Task, From, Event, To, TaskUnit, Cargo, DeployZone )
self:CargoDeployed( Task, Task.TaskPrefix, TaskUnit, Cargo, DeployZone )
end
end
if Transport.DeployZones then

View File

@ -67,11 +67,8 @@ do -- TASK_CARGO_TRANSPORT
--
-- ===
--
-- A transport task can be created manually, but actually, it is better to **GENERATE** these tasks using the
-- @{Tasking.Task_Cargo_Dispatcher} module.
--
-- Using the dispatcher, transport tasks can be created much more easy.
--
-- A transport task can be created manually.
--
-- # 1) Create a transport task manually (code it).
--
-- Although it is recommended to use the dispatcher, you can create a transport task yourself as a mission designer.
@ -141,6 +138,124 @@ do -- TASK_CARGO_TRANSPORT
-- It is better you use the cargo dispatcher to create transport tasks and it will work as it is intended.
-- By doing this, cargo transport tasking will become a dynamic experience.
--
--
-- # 2) Create a task using the @{Tasking.Task_Cargo_Dispatcher} module.
--
-- Actually, it is better to **GENERATE** these tasks using the @{Tasking.Task_Cargo_Dispatcher} module.
-- Using the dispatcher module, transport tasks can be created much more easy.
--
-- Find below an example how to use the TASK_CARGO_DISPATCHER class:
--
--
-- -- Find the HQ group.
-- HQ = GROUP:FindByName( "HQ", "Bravo" )
--
-- -- Create the command center with the name "Lima".
-- CommandCenter = COMMANDCENTER
-- :New( HQ, "Lima" )
--
-- -- Create the mission, for the command center, with the name "Operation Cargo Fun", a "Tactical" mission, with the mission briefing "Transport Cargo", for the BLUE coalition.
-- Mission = MISSION
-- :New( CommandCenter, "Operation Cargo Fun", "Tactical", "Transport Cargo", coalition.side.BLUE )
--
-- -- Create the SET of GROUPs containing clients (players) that will transport the cargo.
-- -- These are have a name that start with "Transport" and are of the "blue" coalition.
-- TransportGroups = SET_GROUP:New():FilterCoalitions( "blue" ):FilterPrefixes( "Transport" ):FilterStart()
--
--
-- -- Here we create the TASK_CARGO_DISPATCHER object! This is where we assign the dispatcher to generate tasks in the Mission for the TransportGroups.
-- TaskDispatcher = TASK_CARGO_DISPATCHER:New( Mission, TransportGroups )
--
--
-- -- Here we declare the SET of CARGOs called "Workmaterials".
-- local CargoSetWorkmaterials = SET_CARGO:New():FilterTypes( "Workmaterials" ):FilterStart()
--
-- -- Here we declare (add) CARGO_GROUP objects of various types, that are filtered and added in the CargoSetworkmaterials cargo set.
-- -- These cargo objects have the type "Workmaterials" which is exactly the type of cargo the CargoSetworkmaterials is filtering on.
-- local EngineerCargoGroup = CARGO_GROUP:New( GROUP:FindByName( "Engineers" ), "Workmaterials", "Engineers", 250 )
-- local ConcreteCargo = CARGO_SLINGLOAD:New( STATIC:FindByName( "Concrete" ), "Workmaterials", "Concrete", 150, 50 )
-- local CrateCargo = CARGO_CRATE:New( STATIC:FindByName( "Crate" ), "Workmaterials", "Crate", 150, 50 )
-- local EnginesCargo = CARGO_CRATE:New( STATIC:FindByName( "Engines" ), "Workmaterials", "Engines", 150, 50 )
-- local MetalCargo = CARGO_CRATE:New( STATIC:FindByName( "Metal" ), "Workmaterials", "Metal", 150, 50 )
--
-- -- And here we create a new WorkplaceTask, using the :AddTransportTask method of the TaskDispatcher.
-- local WorkplaceTask = TaskDispatcher:AddTransportTask( "Build a Workplace", CargoSetWorkmaterials, "Transport the workers, engineers and the equipment near the Workplace." )
-- TaskDispatcher:SetTransportDeployZone( WorkplaceTask, ZONE:New( "Workplace" ) )
--
-- # 3) Handle cargo task events.
--
-- When a player is picking up and deploying cargo using his carrier, events are generated by the tasks. These events can be captured and tailored with your own code.
--
-- In order to properly capture the events and avoid mistakes using the documentation, it is advised that you execute the following actions:
--
-- * **Copy / Paste** the code section into your script.
-- * **Change** the CLASS literal to the task object name you have in your script.
-- * Within the function, you can now **write your own code**!
-- * **IntelliSense** will recognize the type of the variables provided by the function. Note: the From, Event and To variables can be safely ignored,
-- but you need to declare them as they are automatically provided by the event handling system of MOOSE.
--
-- You can send messages or fire off any other events within the code section. The sky is the limit!
--
--
-- ## 3.1) Handle the CargoPickedUp event.
--
-- Find below an example how to tailor the **CargoPickedUp** event, generated by the WorkplaceTask:
--
-- function WorkplaceTask:OnAfterCargoPickedUp( From, Event, To, TaskUnit, Cargo )
--
-- MESSAGE:NewType( "Unit " .. TaskUnit:GetName().. " has picked up cargo.", MESSAGE.Type.Information ):ToAll()
--
-- end
--
-- If you want to code your own event handler, use this code fragment to tailor the event when a player carrier has picked up a cargo object in the CarrierGroup.
-- You can use this event handler to post messages to players, or provide status updates etc.
--
-- --- CargoPickedUp event handler OnAfter for CLASS.
-- -- @param #CLASS self
-- -- @param #string From A string that contains the "*from state name*" when the event was triggered.
-- -- @param #string Event A string that contains the "*event name*" when the event was triggered.
-- -- @param #string To A string that contains the "*to state name*" when the event was triggered.
-- -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has picked up the cargo.
-- -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been picked up. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object!
-- function CLASS:OnAfterCargoPickedUp( From, Event, To, TaskUnit, Cargo )
--
-- -- Write here your own code.
--
-- end
--
--
-- ## 3.2) Handle the CargoDeployed event.
--
-- Find below an example how to tailor the **CargoDeployed** event, generated by the WorkplaceTask:
--
-- function WorkplaceTask:OnAfterCargoDeployed( From, Event, To, TaskUnit, Cargo, DeployZone )
--
-- MESSAGE:NewType( "Unit " .. TaskUnit:GetName().. " has deployed cargo at zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll()
--
-- Helos[ math.random(1,#Helos) ]:Spawn()
-- EnemyHelos[ math.random(1,#EnemyHelos) ]:Spawn()
-- end
--
-- If you want to code your own event handler, use this code fragment to tailor the event when a player carrier has deployed a cargo object from the CarrierGroup.
-- You can use this event handler to post messages to players, or provide status updates etc.
--
--
-- --- CargoDeployed event handler OnAfter for CLASS.
-- -- @param #CLASS self
-- -- @param #string From A string that contains the "*from state name*" when the event was triggered.
-- -- @param #string Event A string that contains the "*event name*" when the event was triggered.
-- -- @param #string To A string that contains the "*to state name*" when the event was triggered.
-- -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has deployed the cargo.
-- -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been deployed. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object!
-- -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
-- function CLASS:OnAfterCargoDeployed( From, Event, To, TaskUnit, Cargo, DeployZone )
--
-- -- Write here your own code.
--
-- end
--
--
--
-- ===
--
-- @field #TASK_CARGO_TRANSPORT