mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Updated the DETECTION_MANAGER
-- Added a scoring tailoring possibility for TASK_DISPATCHER class tasks. -- DETECTION_MANAGER has become an FSM -- TASK_A2G_DISPATCHER has become an FSM. It implements an Assign Event, that can be handled. In the Assign event handler, you can specify scoring schemes etc.
This commit is contained in:
parent
90cb0dc012
commit
2e894df4c2
@ -175,7 +175,7 @@ do -- ACT_ASSIGN_ACCEPT
|
||||
|
||||
self:Message( "You are assigned to the task " .. self.Task:GetName() )
|
||||
|
||||
self.Task:Assign( ProcessUnit, self.Task )
|
||||
self.Task:Assign( ProcessUnit, ProcessUnit:GetPlayerName() )
|
||||
end
|
||||
|
||||
end -- ACT_ASSIGN_ACCEPT
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 1) @{DetectionManager#DETECTION_MANAGER} class, extends @{Base#BASE}
|
||||
-- 1) @{DetectionManager#DETECTION_MANAGER} class, extends @{Fsm#FSM}
|
||||
-- ====================================================================
|
||||
-- The @{DetectionManager#DETECTION_MANAGER} class defines the core functions to report detected objects to groups.
|
||||
-- Reportings can be done in several manners, and it is up to the derived classes if DETECTION_MANAGER to model the reporting behaviour.
|
||||
@ -48,7 +48,7 @@ do -- DETECTION MANAGER
|
||||
-- @type DETECTION_MANAGER
|
||||
-- @field Set#SET_GROUP SetGroup The groups to which the FAC will report to.
|
||||
-- @field Functional.Detection#DETECTION_BASE Detection The DETECTION_BASE object that is used to report the detected objects.
|
||||
-- @extends Base#BASE
|
||||
-- @extends Core.Fsm#FSM
|
||||
DETECTION_MANAGER = {
|
||||
ClassName = "DETECTION_MANAGER",
|
||||
SetGroup = nil,
|
||||
@ -63,19 +63,37 @@ do -- DETECTION MANAGER
|
||||
function DETECTION_MANAGER:New( SetGroup, Detection )
|
||||
|
||||
-- Inherits from BASE
|
||||
local self = BASE:Inherit( self, BASE:New() ) -- Functional.Detection#DETECTION_MANAGER
|
||||
local self = BASE:Inherit( self, FSM:New() ) -- #DETECTION_MANAGER
|
||||
|
||||
self.SetGroup = SetGroup
|
||||
self.Detection = Detection
|
||||
|
||||
self:SetStartState( "Stopped" )
|
||||
self:AddTransition( "Stopped", "Start", "Started" )
|
||||
self:AddTransition( "Started", "Stop", "Stopped" )
|
||||
self:AddTransition( "Started", "Report", "Started" )
|
||||
|
||||
self:SetReportInterval( 30 )
|
||||
self:SetReportDisplayTime( 25 )
|
||||
|
||||
Detection:__Start( 5 )
|
||||
|
||||
|
||||
Detection:__Start( 1 )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function DETECTION_MANAGER:onafterStart( From, Event, To )
|
||||
self:Report()
|
||||
end
|
||||
|
||||
function DETECTION_MANAGER:onafterReport( From, Event, To )
|
||||
|
||||
self:E( "onafterReport" )
|
||||
|
||||
self:__Report( -self._ReportInterval )
|
||||
|
||||
self:ProcessDetected( self.Detection )
|
||||
end
|
||||
|
||||
--- Set the reporting time interval.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
-- @param #number ReportInterval The interval in seconds when a report needs to be done.
|
||||
@ -106,51 +124,14 @@ do -- DETECTION MANAGER
|
||||
return self._ReportDisplayTime
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Reports the detected items to the @{Set#SET_GROUP}.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
-- @param Functional.Detection#DETECTION_BASE Detection
|
||||
-- @return #DETECTION_MANAGER self
|
||||
function DETECTION_MANAGER:ReportDetected( Detection )
|
||||
self:F2()
|
||||
function DETECTION_MANAGER:ProcessDetected( Detection )
|
||||
self:E()
|
||||
|
||||
end
|
||||
|
||||
--- Schedule the FAC reporting.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
-- @param #number DelayTime The delay in seconds to wait the reporting.
|
||||
-- @param #number ReportInterval The repeat interval in seconds for the reporting to happen repeatedly.
|
||||
-- @return #DETECTION_MANAGER self
|
||||
function DETECTION_MANAGER:Schedule( DelayTime, ReportInterval )
|
||||
self:F2()
|
||||
|
||||
self._ScheduleDelayTime = DelayTime
|
||||
|
||||
self:SetReportInterval( ReportInterval )
|
||||
|
||||
self.FacScheduler = SCHEDULER:New(self, self._FacScheduler, { self, "DetectionManager" }, self._ScheduleDelayTime, self._ReportInterval )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Report the detected @{Unit#UNIT}s detected within the @{Detection#DETECTION_BASE} object to the @{Set#SET_GROUP}s.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
function DETECTION_MANAGER:_FacScheduler( SchedulerName )
|
||||
self:F2( { SchedulerName } )
|
||||
|
||||
return self:ProcessDetected( self.Detection )
|
||||
|
||||
-- self.SetGroup:ForEachGroup(
|
||||
-- --- @param Wrapper.Group#GROUP Group
|
||||
-- function( Group )
|
||||
-- if Group:IsAlive() then
|
||||
-- return self:ProcessDetected( self.Detection )
|
||||
-- end
|
||||
-- end
|
||||
-- )
|
||||
|
||||
-- return true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -981,11 +981,16 @@ end
|
||||
-- @param #string Event
|
||||
-- @param #string From
|
||||
-- @param #string To
|
||||
function TASK:onenterAssigned( From, Event, To )
|
||||
function TASK:onenterAssigned( From, Event, To, PlayerUnit, PlayerName )
|
||||
|
||||
self:E("Task Assigned")
|
||||
|
||||
self:MessageToGroups( "Task " .. self:GetName() .. " has been assigned to your group." )
|
||||
|
||||
if self.Dispatcher then
|
||||
self.Dispatcher:Assign( self, PlayerUnit, PlayerName )
|
||||
end
|
||||
|
||||
self:GetMission():__Start( 1 )
|
||||
end
|
||||
|
||||
@ -1097,6 +1102,18 @@ function TASK:onbeforeTimeOut( From, Event, To )
|
||||
return false
|
||||
end
|
||||
|
||||
do -- Dispatcher
|
||||
|
||||
--- Set dispatcher of a task
|
||||
-- @param #TASK self
|
||||
-- @param Tasking.DetectionManager#DETECTION_MANAGER Dispatcher
|
||||
-- @return #TASK
|
||||
function TASK:SetDispatcher( Dispatcher )
|
||||
self.Dispatcher = Dispatcher
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
do -- Reporting
|
||||
|
||||
--- Create a summary report of the Task.
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
--- This module contains the TASK_A2G classes.
|
||||
--- **Tasking** - The TASK_A2G models tasks for players in Air to Ground engagements.
|
||||
--
|
||||
-- 
|
||||
--
|
||||
--
|
||||
-- # 1) @{Task_A2G#TASK_A2G} class, extends @{Task#TASK}
|
||||
--
|
||||
@ -12,10 +15,30 @@
|
||||
-- * **Success**: The A2G task is successfully completed.
|
||||
-- * **Failed**: The A2G task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
|
||||
--
|
||||
-- # 1) @{Task_A2G#TASK_SEAD} class, extends @{Task_A2G#TASK_A2G}
|
||||
-- # 1.1) Set the scoring of achievements in an A2G attack.
|
||||
--
|
||||
-- Scoring or penalties can be given in the following circumstances:
|
||||
--
|
||||
-- * @{#TASK_A2G.SetScoreOnDestroy}(): Set a score when a target in scope of the A2G attack, has been destroyed.
|
||||
-- * @{#TASK_A2G.SetScoreOnSuccess}(): Set a score when all the targets in scope of the A2G attack, have been destroyed.
|
||||
-- * @{#TASK_A2G.SetPenaltyOnFailed}(): Set a penalty when the A2G attack has failed.
|
||||
--
|
||||
-- # 2) @{Task_A2G#TASK_SEAD} class, extends @{Task_A2G#TASK_A2G}
|
||||
--
|
||||
-- The @{#TASK_SEAD} class defines a SEAD task for a @{Set} of Target Units.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # 3) @{Task_A2G#TASK_CAS} class, extends @{Task_A2G#TASK_A2G}
|
||||
--
|
||||
-- The @{#TASK_CAS} class defines a CAS task for a @{Set} of Target Units.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # 4) @{Task_A2G#TASK_BAI} class, extends @{Task_A2G#TASK_A2G}
|
||||
--
|
||||
-- The @{#TASK_BAI} class defines a BAI task for a @{Set} of Target Units.
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- # **API CHANGE HISTORY**
|
||||
@ -277,6 +300,52 @@ do -- TASK_A2G
|
||||
local ActRouteTarget = ProcessUnit:GetProcess( "Engaging", "RouteToTargetZone" ) -- Actions.Act_Route#ACT_ROUTE_ZONE
|
||||
return ActRouteTarget:GetZone()
|
||||
end
|
||||
|
||||
--- Set a score when a target in scope of the A2G attack, has been destroyed .
|
||||
-- @param #TASK_A2G self
|
||||
-- @param #string Text The text to display to the player, when the target has been destroyed.
|
||||
-- @param #number Score The score in points.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return #TASK_A2G
|
||||
function TASK_A2G:SetScoreOnDestroy( Text, Score, TaskUnit )
|
||||
|
||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||
|
||||
ProcessUnit:AddScoreProcess( "Engaging", "Account", "Account", Text, Score )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set a score when all the targets in scope of the A2G attack, have been destroyed.
|
||||
-- @param #TASK_A2G self
|
||||
-- @param #string Text The text to display to the player, when all targets hav been destroyed.
|
||||
-- @param #number Score The score in points.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return #TASK_A2G
|
||||
function TASK_A2G:SetScoreOnSuccess( Text, Score, TaskUnit )
|
||||
|
||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||
|
||||
ProcessUnit:AddScore( "Success", Text, Score )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set a penalty when the A2G attack has failed.
|
||||
-- @param #TASK_A2G self
|
||||
-- @param #string Text The text to display to the player, when the A2G attack has failed.
|
||||
-- @param #number Penalty The penalty in points.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return #TASK_A2G
|
||||
function TASK_A2G:SetPenaltyOnFailed( Text, Penalty, TaskUnit )
|
||||
|
||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||
|
||||
ProcessUnit:AddScore( "Failed", Text, Penalty )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -72,7 +72,20 @@ do -- TASK_A2G_DISPATCHER
|
||||
self.Detection = Detection
|
||||
self.Mission = Mission
|
||||
|
||||
self:Schedule( 30 )
|
||||
self:AddTransition( "Started", "Assign", "Started" )
|
||||
|
||||
--- OnAfter Transition Handler for Event Assign.
|
||||
-- @function [parent=#TASK_A2G_DISPATCHER] OnAfterAssign
|
||||
-- @param #TASK_A2G_DISPATCHER self
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
-- @param #string To The To State string.
|
||||
-- @param Tasking.Task_A2G#TASK_A2G Task
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @param #string PlayerName
|
||||
|
||||
self:__Start( 5 )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -186,7 +199,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
-- @param Functional.Detection#DETECTION_BASE Detection The detection created by the @{Detection#DETECTION_BASE} derived object.
|
||||
-- @return #boolean Return true if you want the task assigning to continue... false will cancel the loop.
|
||||
function TASK_A2G_DISPATCHER:ProcessDetected( Detection )
|
||||
self:F2()
|
||||
self:E()
|
||||
|
||||
local AreaMsg = {}
|
||||
local TaskMsg = {}
|
||||
@ -217,6 +230,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
if TargetSetUnit then
|
||||
local Task = TASK_SEAD:New( Mission, self.SetGroup, string.format( "SEAD.%03d", ItemID ), TargetSetUnit )
|
||||
Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
SEADTask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
@ -232,6 +246,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
if TargetSetUnit then
|
||||
local Task = TASK_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", ItemID ), TargetSetUnit )
|
||||
--Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
CASTask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
@ -247,6 +262,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
if TargetSetUnit then
|
||||
local Task = TASK_BAI:New( Mission, self.SetGroup, string.format( "BAI.%03d", ItemID ), TargetSetUnit )
|
||||
Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
BAITask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170319_0550' )
|
||||
env.info( 'Moose Generation Timestamp: 20170319_0757' )
|
||||
local base = _G
|
||||
|
||||
Include = {}
|
||||
@ -31134,7 +31134,7 @@ do -- ACT_ASSIGN_ACCEPT
|
||||
|
||||
self:Message( "You are assigned to the task " .. self.Task:GetName() )
|
||||
|
||||
self.Task:Assign( ProcessUnit, self.Task )
|
||||
self.Task:Assign( ProcessUnit, ProcessUnit:GetPlayerName() )
|
||||
end
|
||||
|
||||
end -- ACT_ASSIGN_ACCEPT
|
||||
@ -34019,11 +34019,16 @@ end
|
||||
-- @param #string Event
|
||||
-- @param #string From
|
||||
-- @param #string To
|
||||
function TASK:onenterAssigned( From, Event, To )
|
||||
function TASK:onenterAssigned( From, Event, To, PlayerUnit, PlayerName )
|
||||
|
||||
self:E("Task Assigned")
|
||||
|
||||
self:MessageToGroups( "Task " .. self:GetName() .. " has been assigned to your group." )
|
||||
|
||||
if self.Dispatcher then
|
||||
self.Dispatcher:Assign( self, PlayerUnit, PlayerName )
|
||||
end
|
||||
|
||||
self:GetMission():__Start( 1 )
|
||||
end
|
||||
|
||||
@ -34135,6 +34140,18 @@ function TASK:onbeforeTimeOut( From, Event, To )
|
||||
return false
|
||||
end
|
||||
|
||||
do -- Dispatcher
|
||||
|
||||
--- Set dispatcher of a task
|
||||
-- @param #TASK self
|
||||
-- @param Tasking.DetectionManager#DETECTION_MANAGER Dispatcher
|
||||
-- @return #TASK
|
||||
function TASK:SetDispatcher( Dispatcher )
|
||||
self.Dispatcher = Dispatcher
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
do -- Reporting
|
||||
|
||||
--- Create a summary report of the Task.
|
||||
@ -34193,7 +34210,7 @@ end -- Reporting
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 1) @{DetectionManager#DETECTION_MANAGER} class, extends @{Base#BASE}
|
||||
-- 1) @{DetectionManager#DETECTION_MANAGER} class, extends @{Fsm#FSM}
|
||||
-- ====================================================================
|
||||
-- The @{DetectionManager#DETECTION_MANAGER} class defines the core functions to report detected objects to groups.
|
||||
-- Reportings can be done in several manners, and it is up to the derived classes if DETECTION_MANAGER to model the reporting behaviour.
|
||||
@ -34239,7 +34256,7 @@ do -- DETECTION MANAGER
|
||||
-- @type DETECTION_MANAGER
|
||||
-- @field Set#SET_GROUP SetGroup The groups to which the FAC will report to.
|
||||
-- @field Functional.Detection#DETECTION_BASE Detection The DETECTION_BASE object that is used to report the detected objects.
|
||||
-- @extends Base#BASE
|
||||
-- @extends Core.Fsm#FSM
|
||||
DETECTION_MANAGER = {
|
||||
ClassName = "DETECTION_MANAGER",
|
||||
SetGroup = nil,
|
||||
@ -34254,19 +34271,37 @@ do -- DETECTION MANAGER
|
||||
function DETECTION_MANAGER:New( SetGroup, Detection )
|
||||
|
||||
-- Inherits from BASE
|
||||
local self = BASE:Inherit( self, BASE:New() ) -- Functional.Detection#DETECTION_MANAGER
|
||||
local self = BASE:Inherit( self, FSM:New() ) -- #DETECTION_MANAGER
|
||||
|
||||
self.SetGroup = SetGroup
|
||||
self.Detection = Detection
|
||||
|
||||
self:SetStartState( "Stopped" )
|
||||
self:AddTransition( "Stopped", "Start", "Started" )
|
||||
self:AddTransition( "Started", "Stop", "Stopped" )
|
||||
self:AddTransition( "Started", "Report", "Started" )
|
||||
|
||||
self:SetReportInterval( 30 )
|
||||
self:SetReportDisplayTime( 25 )
|
||||
|
||||
Detection:__Start( 5 )
|
||||
|
||||
|
||||
Detection:__Start( 1 )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function DETECTION_MANAGER:onafterStart( From, Event, To )
|
||||
self:Report()
|
||||
end
|
||||
|
||||
function DETECTION_MANAGER:onafterReport( From, Event, To )
|
||||
|
||||
self:E( "onafterReport" )
|
||||
|
||||
self:__Report( -self._ReportInterval )
|
||||
|
||||
self:ProcessDetected( self.Detection )
|
||||
end
|
||||
|
||||
--- Set the reporting time interval.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
-- @param #number ReportInterval The interval in seconds when a report needs to be done.
|
||||
@ -34297,51 +34332,14 @@ do -- DETECTION MANAGER
|
||||
return self._ReportDisplayTime
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Reports the detected items to the @{Set#SET_GROUP}.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
-- @param Functional.Detection#DETECTION_BASE Detection
|
||||
-- @return #DETECTION_MANAGER self
|
||||
function DETECTION_MANAGER:ReportDetected( Detection )
|
||||
self:F2()
|
||||
function DETECTION_MANAGER:ProcessDetected( Detection )
|
||||
self:E()
|
||||
|
||||
end
|
||||
|
||||
--- Schedule the FAC reporting.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
-- @param #number DelayTime The delay in seconds to wait the reporting.
|
||||
-- @param #number ReportInterval The repeat interval in seconds for the reporting to happen repeatedly.
|
||||
-- @return #DETECTION_MANAGER self
|
||||
function DETECTION_MANAGER:Schedule( DelayTime, ReportInterval )
|
||||
self:F2()
|
||||
|
||||
self._ScheduleDelayTime = DelayTime
|
||||
|
||||
self:SetReportInterval( ReportInterval )
|
||||
|
||||
self.FacScheduler = SCHEDULER:New(self, self._FacScheduler, { self, "DetectionManager" }, self._ScheduleDelayTime, self._ReportInterval )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Report the detected @{Unit#UNIT}s detected within the @{Detection#DETECTION_BASE} object to the @{Set#SET_GROUP}s.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
function DETECTION_MANAGER:_FacScheduler( SchedulerName )
|
||||
self:F2( { SchedulerName } )
|
||||
|
||||
return self:ProcessDetected( self.Detection )
|
||||
|
||||
-- self.SetGroup:ForEachGroup(
|
||||
-- --- @param Wrapper.Group#GROUP Group
|
||||
-- function( Group )
|
||||
-- if Group:IsAlive() then
|
||||
-- return self:ProcessDetected( self.Detection )
|
||||
-- end
|
||||
-- end
|
||||
-- )
|
||||
|
||||
-- return true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -34500,7 +34498,20 @@ do -- TASK_A2G_DISPATCHER
|
||||
self.Detection = Detection
|
||||
self.Mission = Mission
|
||||
|
||||
self:Schedule( 30 )
|
||||
self:AddTransition( "Started", "Assign", "Started" )
|
||||
|
||||
--- OnAfter Transition Handler for Event Assign.
|
||||
-- @function [parent=#TASK_A2G_DISPATCHER] OnAfterAssign
|
||||
-- @param #TASK_A2G_DISPATCHER self
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
-- @param #string To The To State string.
|
||||
-- @param Tasking.Task_A2G#TASK_A2G Task
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @param #string PlayerName
|
||||
|
||||
self:__Start( 5 )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -34614,7 +34625,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
-- @param Functional.Detection#DETECTION_BASE Detection The detection created by the @{Detection#DETECTION_BASE} derived object.
|
||||
-- @return #boolean Return true if you want the task assigning to continue... false will cancel the loop.
|
||||
function TASK_A2G_DISPATCHER:ProcessDetected( Detection )
|
||||
self:F2()
|
||||
self:E()
|
||||
|
||||
local AreaMsg = {}
|
||||
local TaskMsg = {}
|
||||
@ -34645,6 +34656,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
if TargetSetUnit then
|
||||
local Task = TASK_SEAD:New( Mission, self.SetGroup, string.format( "SEAD.%03d", ItemID ), TargetSetUnit )
|
||||
Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
SEADTask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
@ -34660,6 +34672,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
if TargetSetUnit then
|
||||
local Task = TASK_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", ItemID ), TargetSetUnit )
|
||||
--Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
CASTask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
@ -34675,6 +34688,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
if TargetSetUnit then
|
||||
local Task = TASK_BAI:New( Mission, self.SetGroup, string.format( "BAI.%03d", ItemID ), TargetSetUnit )
|
||||
Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
BAITask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
@ -34711,7 +34725,10 @@ do -- TASK_A2G_DISPATCHER
|
||||
return true
|
||||
end
|
||||
|
||||
end--- This module contains the TASK_A2G classes.
|
||||
end--- **Tasking** - The TASK_A2G models tasks for players in Air to Ground engagements.
|
||||
--
|
||||
-- 
|
||||
--
|
||||
--
|
||||
-- # 1) @{Task_A2G#TASK_A2G} class, extends @{Task#TASK}
|
||||
--
|
||||
@ -34725,10 +34742,30 @@ end--- This module contains the TASK_A2G classes.
|
||||
-- * **Success**: The A2G task is successfully completed.
|
||||
-- * **Failed**: The A2G task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
|
||||
--
|
||||
-- # 1) @{Task_A2G#TASK_SEAD} class, extends @{Task_A2G#TASK_A2G}
|
||||
-- # 1.1) Set the scoring of achievements in an A2G attack.
|
||||
--
|
||||
-- Scoring or penalties can be given in the following circumstances:
|
||||
--
|
||||
-- * @{#TASK_A2G.SetScoreOnDestroy}(): Set a score when a target in scope of the A2G attack, has been destroyed.
|
||||
-- * @{#TASK_A2G.SetScoreOnSuccess}(): Set a score when all the targets in scope of the A2G attack, have been destroyed.
|
||||
-- * @{#TASK_A2G.SetPenaltyOnFailed}(): Set a penalty when the A2G attack has failed.
|
||||
--
|
||||
-- # 2) @{Task_A2G#TASK_SEAD} class, extends @{Task_A2G#TASK_A2G}
|
||||
--
|
||||
-- The @{#TASK_SEAD} class defines a SEAD task for a @{Set} of Target Units.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # 3) @{Task_A2G#TASK_CAS} class, extends @{Task_A2G#TASK_A2G}
|
||||
--
|
||||
-- The @{#TASK_CAS} class defines a CAS task for a @{Set} of Target Units.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # 4) @{Task_A2G#TASK_BAI} class, extends @{Task_A2G#TASK_A2G}
|
||||
--
|
||||
-- The @{#TASK_BAI} class defines a BAI task for a @{Set} of Target Units.
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- # **API CHANGE HISTORY**
|
||||
@ -34990,6 +35027,52 @@ do -- TASK_A2G
|
||||
local ActRouteTarget = ProcessUnit:GetProcess( "Engaging", "RouteToTargetZone" ) -- Actions.Act_Route#ACT_ROUTE_ZONE
|
||||
return ActRouteTarget:GetZone()
|
||||
end
|
||||
|
||||
--- Set a score when a target in scope of the A2G attack, has been destroyed .
|
||||
-- @param #TASK_A2G self
|
||||
-- @param #string Text The text to display to the player, when the target has been destroyed.
|
||||
-- @param #number Score The score in points.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return #TASK_A2G
|
||||
function TASK_A2G:SetScoreOnDestroy( Text, Score, TaskUnit )
|
||||
|
||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||
|
||||
ProcessUnit:AddScoreProcess( "Engaging", "Account", "Account", Text, Score )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set a score when all the targets in scope of the A2G attack, have been destroyed.
|
||||
-- @param #TASK_A2G self
|
||||
-- @param #string Text The text to display to the player, when all targets hav been destroyed.
|
||||
-- @param #number Score The score in points.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return #TASK_A2G
|
||||
function TASK_A2G:SetScoreOnSuccess( Text, Score, TaskUnit )
|
||||
|
||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||
|
||||
ProcessUnit:AddScore( "Success", Text, Score )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set a penalty when the A2G attack has failed.
|
||||
-- @param #TASK_A2G self
|
||||
-- @param #string Text The text to display to the player, when the A2G attack has failed.
|
||||
-- @param #number Penalty The penalty in points.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return #TASK_A2G
|
||||
function TASK_A2G:SetPenaltyOnFailed( Text, Penalty, TaskUnit )
|
||||
|
||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||
|
||||
ProcessUnit:AddScore( "Failed", Text, Penalty )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170319_0550' )
|
||||
env.info( 'Moose Generation Timestamp: 20170319_0757' )
|
||||
local base = _G
|
||||
|
||||
Include = {}
|
||||
@ -31134,7 +31134,7 @@ do -- ACT_ASSIGN_ACCEPT
|
||||
|
||||
self:Message( "You are assigned to the task " .. self.Task:GetName() )
|
||||
|
||||
self.Task:Assign( ProcessUnit, self.Task )
|
||||
self.Task:Assign( ProcessUnit, ProcessUnit:GetPlayerName() )
|
||||
end
|
||||
|
||||
end -- ACT_ASSIGN_ACCEPT
|
||||
@ -34019,11 +34019,16 @@ end
|
||||
-- @param #string Event
|
||||
-- @param #string From
|
||||
-- @param #string To
|
||||
function TASK:onenterAssigned( From, Event, To )
|
||||
function TASK:onenterAssigned( From, Event, To, PlayerUnit, PlayerName )
|
||||
|
||||
self:E("Task Assigned")
|
||||
|
||||
self:MessageToGroups( "Task " .. self:GetName() .. " has been assigned to your group." )
|
||||
|
||||
if self.Dispatcher then
|
||||
self.Dispatcher:Assign( self, PlayerUnit, PlayerName )
|
||||
end
|
||||
|
||||
self:GetMission():__Start( 1 )
|
||||
end
|
||||
|
||||
@ -34135,6 +34140,18 @@ function TASK:onbeforeTimeOut( From, Event, To )
|
||||
return false
|
||||
end
|
||||
|
||||
do -- Dispatcher
|
||||
|
||||
--- Set dispatcher of a task
|
||||
-- @param #TASK self
|
||||
-- @param Tasking.DetectionManager#DETECTION_MANAGER Dispatcher
|
||||
-- @return #TASK
|
||||
function TASK:SetDispatcher( Dispatcher )
|
||||
self.Dispatcher = Dispatcher
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
do -- Reporting
|
||||
|
||||
--- Create a summary report of the Task.
|
||||
@ -34193,7 +34210,7 @@ end -- Reporting
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 1) @{DetectionManager#DETECTION_MANAGER} class, extends @{Base#BASE}
|
||||
-- 1) @{DetectionManager#DETECTION_MANAGER} class, extends @{Fsm#FSM}
|
||||
-- ====================================================================
|
||||
-- The @{DetectionManager#DETECTION_MANAGER} class defines the core functions to report detected objects to groups.
|
||||
-- Reportings can be done in several manners, and it is up to the derived classes if DETECTION_MANAGER to model the reporting behaviour.
|
||||
@ -34239,7 +34256,7 @@ do -- DETECTION MANAGER
|
||||
-- @type DETECTION_MANAGER
|
||||
-- @field Set#SET_GROUP SetGroup The groups to which the FAC will report to.
|
||||
-- @field Functional.Detection#DETECTION_BASE Detection The DETECTION_BASE object that is used to report the detected objects.
|
||||
-- @extends Base#BASE
|
||||
-- @extends Core.Fsm#FSM
|
||||
DETECTION_MANAGER = {
|
||||
ClassName = "DETECTION_MANAGER",
|
||||
SetGroup = nil,
|
||||
@ -34254,19 +34271,37 @@ do -- DETECTION MANAGER
|
||||
function DETECTION_MANAGER:New( SetGroup, Detection )
|
||||
|
||||
-- Inherits from BASE
|
||||
local self = BASE:Inherit( self, BASE:New() ) -- Functional.Detection#DETECTION_MANAGER
|
||||
local self = BASE:Inherit( self, FSM:New() ) -- #DETECTION_MANAGER
|
||||
|
||||
self.SetGroup = SetGroup
|
||||
self.Detection = Detection
|
||||
|
||||
self:SetStartState( "Stopped" )
|
||||
self:AddTransition( "Stopped", "Start", "Started" )
|
||||
self:AddTransition( "Started", "Stop", "Stopped" )
|
||||
self:AddTransition( "Started", "Report", "Started" )
|
||||
|
||||
self:SetReportInterval( 30 )
|
||||
self:SetReportDisplayTime( 25 )
|
||||
|
||||
Detection:__Start( 5 )
|
||||
|
||||
|
||||
Detection:__Start( 1 )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function DETECTION_MANAGER:onafterStart( From, Event, To )
|
||||
self:Report()
|
||||
end
|
||||
|
||||
function DETECTION_MANAGER:onafterReport( From, Event, To )
|
||||
|
||||
self:E( "onafterReport" )
|
||||
|
||||
self:__Report( -self._ReportInterval )
|
||||
|
||||
self:ProcessDetected( self.Detection )
|
||||
end
|
||||
|
||||
--- Set the reporting time interval.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
-- @param #number ReportInterval The interval in seconds when a report needs to be done.
|
||||
@ -34297,51 +34332,14 @@ do -- DETECTION MANAGER
|
||||
return self._ReportDisplayTime
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Reports the detected items to the @{Set#SET_GROUP}.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
-- @param Functional.Detection#DETECTION_BASE Detection
|
||||
-- @return #DETECTION_MANAGER self
|
||||
function DETECTION_MANAGER:ReportDetected( Detection )
|
||||
self:F2()
|
||||
function DETECTION_MANAGER:ProcessDetected( Detection )
|
||||
self:E()
|
||||
|
||||
end
|
||||
|
||||
--- Schedule the FAC reporting.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
-- @param #number DelayTime The delay in seconds to wait the reporting.
|
||||
-- @param #number ReportInterval The repeat interval in seconds for the reporting to happen repeatedly.
|
||||
-- @return #DETECTION_MANAGER self
|
||||
function DETECTION_MANAGER:Schedule( DelayTime, ReportInterval )
|
||||
self:F2()
|
||||
|
||||
self._ScheduleDelayTime = DelayTime
|
||||
|
||||
self:SetReportInterval( ReportInterval )
|
||||
|
||||
self.FacScheduler = SCHEDULER:New(self, self._FacScheduler, { self, "DetectionManager" }, self._ScheduleDelayTime, self._ReportInterval )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Report the detected @{Unit#UNIT}s detected within the @{Detection#DETECTION_BASE} object to the @{Set#SET_GROUP}s.
|
||||
-- @param #DETECTION_MANAGER self
|
||||
function DETECTION_MANAGER:_FacScheduler( SchedulerName )
|
||||
self:F2( { SchedulerName } )
|
||||
|
||||
return self:ProcessDetected( self.Detection )
|
||||
|
||||
-- self.SetGroup:ForEachGroup(
|
||||
-- --- @param Wrapper.Group#GROUP Group
|
||||
-- function( Group )
|
||||
-- if Group:IsAlive() then
|
||||
-- return self:ProcessDetected( self.Detection )
|
||||
-- end
|
||||
-- end
|
||||
-- )
|
||||
|
||||
-- return true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -34500,7 +34498,20 @@ do -- TASK_A2G_DISPATCHER
|
||||
self.Detection = Detection
|
||||
self.Mission = Mission
|
||||
|
||||
self:Schedule( 30 )
|
||||
self:AddTransition( "Started", "Assign", "Started" )
|
||||
|
||||
--- OnAfter Transition Handler for Event Assign.
|
||||
-- @function [parent=#TASK_A2G_DISPATCHER] OnAfterAssign
|
||||
-- @param #TASK_A2G_DISPATCHER self
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
-- @param #string To The To State string.
|
||||
-- @param Tasking.Task_A2G#TASK_A2G Task
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @param #string PlayerName
|
||||
|
||||
self:__Start( 5 )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -34614,7 +34625,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
-- @param Functional.Detection#DETECTION_BASE Detection The detection created by the @{Detection#DETECTION_BASE} derived object.
|
||||
-- @return #boolean Return true if you want the task assigning to continue... false will cancel the loop.
|
||||
function TASK_A2G_DISPATCHER:ProcessDetected( Detection )
|
||||
self:F2()
|
||||
self:E()
|
||||
|
||||
local AreaMsg = {}
|
||||
local TaskMsg = {}
|
||||
@ -34645,6 +34656,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
if TargetSetUnit then
|
||||
local Task = TASK_SEAD:New( Mission, self.SetGroup, string.format( "SEAD.%03d", ItemID ), TargetSetUnit )
|
||||
Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
SEADTask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
@ -34660,6 +34672,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
if TargetSetUnit then
|
||||
local Task = TASK_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", ItemID ), TargetSetUnit )
|
||||
--Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
CASTask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
@ -34675,6 +34688,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
if TargetSetUnit then
|
||||
local Task = TASK_BAI:New( Mission, self.SetGroup, string.format( "BAI.%03d", ItemID ), TargetSetUnit )
|
||||
Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
BAITask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
@ -34711,7 +34725,10 @@ do -- TASK_A2G_DISPATCHER
|
||||
return true
|
||||
end
|
||||
|
||||
end--- This module contains the TASK_A2G classes.
|
||||
end--- **Tasking** - The TASK_A2G models tasks for players in Air to Ground engagements.
|
||||
--
|
||||
-- 
|
||||
--
|
||||
--
|
||||
-- # 1) @{Task_A2G#TASK_A2G} class, extends @{Task#TASK}
|
||||
--
|
||||
@ -34725,10 +34742,30 @@ end--- This module contains the TASK_A2G classes.
|
||||
-- * **Success**: The A2G task is successfully completed.
|
||||
-- * **Failed**: The A2G task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
|
||||
--
|
||||
-- # 1) @{Task_A2G#TASK_SEAD} class, extends @{Task_A2G#TASK_A2G}
|
||||
-- # 1.1) Set the scoring of achievements in an A2G attack.
|
||||
--
|
||||
-- Scoring or penalties can be given in the following circumstances:
|
||||
--
|
||||
-- * @{#TASK_A2G.SetScoreOnDestroy}(): Set a score when a target in scope of the A2G attack, has been destroyed.
|
||||
-- * @{#TASK_A2G.SetScoreOnSuccess}(): Set a score when all the targets in scope of the A2G attack, have been destroyed.
|
||||
-- * @{#TASK_A2G.SetPenaltyOnFailed}(): Set a penalty when the A2G attack has failed.
|
||||
--
|
||||
-- # 2) @{Task_A2G#TASK_SEAD} class, extends @{Task_A2G#TASK_A2G}
|
||||
--
|
||||
-- The @{#TASK_SEAD} class defines a SEAD task for a @{Set} of Target Units.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # 3) @{Task_A2G#TASK_CAS} class, extends @{Task_A2G#TASK_A2G}
|
||||
--
|
||||
-- The @{#TASK_CAS} class defines a CAS task for a @{Set} of Target Units.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # 4) @{Task_A2G#TASK_BAI} class, extends @{Task_A2G#TASK_A2G}
|
||||
--
|
||||
-- The @{#TASK_BAI} class defines a BAI task for a @{Set} of Target Units.
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- # **API CHANGE HISTORY**
|
||||
@ -34990,6 +35027,52 @@ do -- TASK_A2G
|
||||
local ActRouteTarget = ProcessUnit:GetProcess( "Engaging", "RouteToTargetZone" ) -- Actions.Act_Route#ACT_ROUTE_ZONE
|
||||
return ActRouteTarget:GetZone()
|
||||
end
|
||||
|
||||
--- Set a score when a target in scope of the A2G attack, has been destroyed .
|
||||
-- @param #TASK_A2G self
|
||||
-- @param #string Text The text to display to the player, when the target has been destroyed.
|
||||
-- @param #number Score The score in points.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return #TASK_A2G
|
||||
function TASK_A2G:SetScoreOnDestroy( Text, Score, TaskUnit )
|
||||
|
||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||
|
||||
ProcessUnit:AddScoreProcess( "Engaging", "Account", "Account", Text, Score )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set a score when all the targets in scope of the A2G attack, have been destroyed.
|
||||
-- @param #TASK_A2G self
|
||||
-- @param #string Text The text to display to the player, when all targets hav been destroyed.
|
||||
-- @param #number Score The score in points.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return #TASK_A2G
|
||||
function TASK_A2G:SetScoreOnSuccess( Text, Score, TaskUnit )
|
||||
|
||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||
|
||||
ProcessUnit:AddScore( "Success", Text, Score )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set a penalty when the A2G attack has failed.
|
||||
-- @param #TASK_A2G self
|
||||
-- @param #string Text The text to display to the player, when the A2G attack has failed.
|
||||
-- @param #number Penalty The penalty in points.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @return #TASK_A2G
|
||||
function TASK_A2G:SetPenaltyOnFailed( Text, Penalty, TaskUnit )
|
||||
|
||||
local ProcessUnit = self:GetUnitProcess( TaskUnit )
|
||||
|
||||
ProcessUnit:AddScore( "Failed", Text, Penalty )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
BIN
Moose Presentations/TASK.pptx
Normal file
BIN
Moose Presentations/TASK.pptx
Normal file
Binary file not shown.
BIN
Moose Presentations/TASK_A2G.pptx
Normal file
BIN
Moose Presentations/TASK_A2G.pptx
Normal file
Binary file not shown.
@ -0,0 +1,64 @@
|
||||
---
|
||||
-- Name: TAD-200 - A2G Task Dispatching with SCORING
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 19 Mar 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- This mission demonstrates the scoring of dynamic task dispatching for Air to Ground operations.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the FAC(A)'s detecting targets and grouping them.
|
||||
-- 2. Check that the HQ provides menus to engage on a task set by the FACs.
|
||||
-- 3. Engage on a task and destroy a target. Check if scoring is given for that target.
|
||||
-- 4. Engage all targets in the task, and check if mission success is achieved and that a scoring is given.
|
||||
-- 5. Restart the mission, and crash into the ground, check if you can get penalties.
|
||||
--
|
||||
local HQ = GROUP:FindByName( "HQ", "Bravo HQ" )
|
||||
|
||||
local CommandCenter = COMMANDCENTER:New( HQ, "Lima" )
|
||||
|
||||
local Scoring = SCORING:New( "Detect Demo" )
|
||||
|
||||
local Mission = MISSION
|
||||
:New( CommandCenter, "Overlord", "High", "Attack Detect Mission Briefing", coalition.side.RED )
|
||||
:AddScoring( Scoring )
|
||||
|
||||
local FACSet = SET_GROUP:New():FilterPrefixes( "FAC" ):FilterCoalitions("red"):FilterStart()
|
||||
|
||||
local FACAreas = DETECTION_UNITS:New( FACSet )
|
||||
|
||||
|
||||
local AttackGroups = SET_GROUP:New():FilterCoalitions( "red" ):FilterPrefixes( "Attack" ):FilterStart()
|
||||
|
||||
TaskDispatcher = TASK_A2G_DISPATCHER:New( Mission, AttackGroups, FACAreas )
|
||||
|
||||
--- @param #TaskDispatcher self
|
||||
-- @param From
|
||||
-- @param Event
|
||||
-- @param To
|
||||
-- @param Tasking.Task_A2G#TASK_A2G Task
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit
|
||||
-- @param #string PlayerName
|
||||
function TaskDispatcher:OnAfterAssign( From, Event, To, Task, TaskUnit, PlayerName )
|
||||
Task:SetScoreOnDestroy( "Player " .. PlayerName .. " destroyed a target", 20, TaskUnit )
|
||||
Task:SetScoreOnSuccess( "The task has been successfully completed!", 200, TaskUnit )
|
||||
Task:SetPenaltyOnFailed( "The task has failed completion!", -100, TaskUnit )
|
||||
end
|
||||
|
||||
-- Now this is REALLY neat. I set the goal of the mission to be the destruction of Target #004.
|
||||
-- This is just an example, but many more examples can follow...
|
||||
|
||||
-- Every time a Task becomes Successful, it will trigger the Complete event in the Mission.
|
||||
-- The mission designer NEED TO OVERRIDE the OnBeforeComplete to prevent the mission from getting into completion
|
||||
-- too early!
|
||||
|
||||
function Mission:OnBeforeComplete( From, Event, To )
|
||||
local Group004 = GROUP:FindByName( "Target #004" )
|
||||
if Group004:IsAlive() == false then
|
||||
Mission:GetCommandCenter():MessageToCoalition( "Mission Complete!" )
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
Binary file not shown.
@ -920,9 +920,6 @@ Use the method <a href="##(AI_PATROL_ZONE).ManageDamage">AI<em>PATROL</em>ZONE.M
|
||||
|
||||
|
||||
|
||||
|
||||
<p> This table contains the targets detected during patrol.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
|
||||
@ -2243,7 +2243,7 @@ self</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em>#number</em>
|
||||
<em></em>
|
||||
<a id="#(DETECTION_BASE).DetectionInterval" >
|
||||
<strong>DETECTION_BASE.DetectionInterval</strong>
|
||||
</a>
|
||||
|
||||
@ -1346,6 +1346,7 @@ The new calculated POINT_VEC2.</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em></em>
|
||||
<a id="#(POINT_VEC2).z" >
|
||||
<strong>POINT_VEC2.z</strong>
|
||||
</a>
|
||||
|
||||
@ -1870,9 +1870,6 @@ The group that was spawned. You can use this group for further actions.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<p> Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
@ -2326,9 +2323,6 @@ when nothing was spawned.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<p> Overwrite unit names by default with group name.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
@ -2343,9 +2337,6 @@ when nothing was spawned.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<p> By default, no InitLimit</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
@ -2381,7 +2372,7 @@ when nothing was spawned.</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em>#number</em>
|
||||
<em></em>
|
||||
<a id="#(SPAWN).SpawnMaxGroups" >
|
||||
<strong>SPAWN.SpawnMaxGroups</strong>
|
||||
</a>
|
||||
@ -2398,7 +2389,7 @@ when nothing was spawned.</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em>#number</em>
|
||||
<em></em>
|
||||
<a id="#(SPAWN).SpawnMaxUnitsAlive" >
|
||||
<strong>SPAWN.SpawnMaxUnitsAlive</strong>
|
||||
</a>
|
||||
@ -2716,7 +2707,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em>#boolean</em>
|
||||
<em></em>
|
||||
<a id="#(SPAWN).SpawnUnControlled" >
|
||||
<strong>SPAWN.SpawnUnControlled</strong>
|
||||
</a>
|
||||
@ -2740,7 +2731,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
|
||||
|
||||
|
||||
|
||||
<p> Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.</p>
|
||||
<p> When the first Spawn executes, all the Groups need to be made visible before start.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@ -72,10 +72,13 @@
|
||||
<div id="content">
|
||||
<h1>Module <code>Task_A2G</code></h1>
|
||||
|
||||
<p>This module contains the TASK_A2G classes.</p>
|
||||
<p><strong>Tasking</strong> - The TASK_A2G models tasks for players in Air to Ground engagements.</p>
|
||||
|
||||
|
||||
|
||||
<p><img src="..\Presentations\TASK_A2G\Dia1.JPG" alt="Banner Image"/></p>
|
||||
|
||||
|
||||
<h1>1) <a href="Task_A2G.html##(TASK_A2G)">Task<em>A2G#TASK</em>A2G</a> class, extends <a href="Task.html##(TASK)">Task#TASK</a></h1>
|
||||
|
||||
<p>The <a href="##(TASK_A2G)">#TASK_A2G</a> class defines Air To Ground tasks for a <a href="Set.html">Set</a> of Target Units,
|
||||
@ -90,12 +93,34 @@ The TASK_A2G is implemented using a <a href="Statemachine.html##(FSM_TASK)">Stat
|
||||
<li><strong>Failed</strong>: The A2G task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.</li>
|
||||
</ul>
|
||||
|
||||
<h1>1) <a href="Task_A2G.html##(TASK_SEAD)">Task<em>A2G#TASK</em>SEAD</a> class, extends <a href="Task_A2G.html##(TASK_A2G)">Task<em>A2G#TASK</em>A2G</a></h1>
|
||||
<h1>1.1) Set the scoring of achievements in an A2G attack.</h1>
|
||||
|
||||
<p>Scoring or penalties can be given in the following circumstances:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="##(TASK_A2G).SetScoreOnDestroy">TASK_A2G.SetScoreOnDestroy</a>(): Set a score when a target in scope of the A2G attack, has been destroyed.</li>
|
||||
<li><a href="##(TASK_A2G).SetScoreOnSuccess">TASK_A2G.SetScoreOnSuccess</a>(): Set a score when all the targets in scope of the A2G attack, have been destroyed.</li>
|
||||
<li><a href="##(TASK_A2G).SetPenaltyOnFailed">TASK_A2G.SetPenaltyOnFailed</a>(): Set a penalty when the A2G attack has failed.</li>
|
||||
</ul>
|
||||
|
||||
<h1>2) <a href="Task_A2G.html##(TASK_SEAD)">Task<em>A2G#TASK</em>SEAD</a> class, extends <a href="Task_A2G.html##(TASK_A2G)">Task<em>A2G#TASK</em>A2G</a></h1>
|
||||
|
||||
<p>The <a href="##(TASK_SEAD)">#TASK_SEAD</a> class defines a SEAD task for a <a href="Set.html">Set</a> of Target Units.</p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h1>3) <a href="Task_A2G.html##(TASK_CAS)">Task<em>A2G#TASK</em>CAS</a> class, extends <a href="Task_A2G.html##(TASK_A2G)">Task<em>A2G#TASK</em>A2G</a></h1>
|
||||
|
||||
<p>The <a href="##(TASK_CAS)">#TASK_CAS</a> class defines a CAS task for a <a href="Set.html">Set</a> of Target Units.</p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h1>4) <a href="Task_A2G.html##(TASK_BAI)">Task<em>A2G#TASK</em>BAI</a> class, extends <a href="Task_A2G.html##(TASK_A2G)">Task<em>A2G#TASK</em>A2G</a></h1>
|
||||
|
||||
<p>The <a href="##(TASK_BAI)">#TASK_BAI</a> class defines a BAI task for a <a href="Set.html">Set</a> of Target Units.</p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h1><strong>API CHANGE HISTORY</strong></h1>
|
||||
|
||||
<p>The underlying change log documents the API changes. Please read this carefully. The following notation is used:</p>
|
||||
@ -195,6 +220,12 @@ The TASK_A2G is implemented using a <a href="Statemachine.html##(FSM_TASK)">Stat
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK_A2G).New">TASK_A2G:New(Mission, SetGroup, TaskName, UnitSetTargets, TargetDistance, TargetZone, TargetSetUnit, TaskType)</a></td>
|
||||
<td class="summary">
|
||||
<p>Instantiates a new TASK_A2G.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK_A2G).SetPenaltyOnFailed">TASK_A2G:SetPenaltyOnFailed(Text, Penalty, TaskUnit)</a></td>
|
||||
<td class="summary">
|
||||
<p>Set a penalty when the A2G attack has failed.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -207,6 +238,18 @@ The TASK_A2G is implemented using a <a href="Statemachine.html##(FSM_TASK)">Stat
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK_A2G).SetRendezVousZone">TASK_A2G:SetRendezVousZone(RendezVousZone, TaskUnit)</a></td>
|
||||
<td class="summary">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK_A2G).SetScoreOnDestroy">TASK_A2G:SetScoreOnDestroy(Text, Score, TaskUnit)</a></td>
|
||||
<td class="summary">
|
||||
<p>Set a score when a target in scope of the A2G attack, has been destroyed .</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK_A2G).SetScoreOnSuccess">TASK_A2G:SetScoreOnSuccess(Text, Score, TaskUnit)</a></td>
|
||||
<td class="summary">
|
||||
<p>Set a score when all the targets in scope of the A2G attack, have been destroyed.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -566,6 +609,44 @@ If the TargetZone parameter is specified, the player will be routed to the cente
|
||||
<p><em><a href="##(TASK_A2G)">#TASK_A2G</a>:</em>
|
||||
self</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(TASK_A2G).SetPenaltyOnFailed" >
|
||||
<strong>TASK_A2G:SetPenaltyOnFailed(Text, Penalty, TaskUnit)</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Set a penalty when the A2G attack has failed.</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string Text </em></code>:
|
||||
The text to display to the player, when the A2G attack has failed.</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em>#number Penalty </em></code>:
|
||||
The penalty in points.</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em><a href="Wrapper.Unit.html##(UNIT)">Wrapper.Unit#UNIT</a> TaskUnit </em></code>: </p>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em><a href="##(TASK_A2G)">#TASK_A2G</a>:</em></p>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
@ -631,6 +712,82 @@ The Zone object where the RendezVous is located on the map.</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(TASK_A2G).SetScoreOnDestroy" >
|
||||
<strong>TASK_A2G:SetScoreOnDestroy(Text, Score, TaskUnit)</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Set a score when a target in scope of the A2G attack, has been destroyed .</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string Text </em></code>:
|
||||
The text to display to the player, when the target has been destroyed.</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em>#number Score </em></code>:
|
||||
The score in points.</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em><a href="Wrapper.Unit.html##(UNIT)">Wrapper.Unit#UNIT</a> TaskUnit </em></code>: </p>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em><a href="##(TASK_A2G)">#TASK_A2G</a>:</em></p>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(TASK_A2G).SetScoreOnSuccess" >
|
||||
<strong>TASK_A2G:SetScoreOnSuccess(Text, Score, TaskUnit)</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Set a score when all the targets in scope of the A2G attack, have been destroyed.</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string Text </em></code>:
|
||||
The text to display to the player, when all targets hav been destroyed.</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em>#number Score </em></code>:
|
||||
The score in points.</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em><a href="Wrapper.Unit.html##(UNIT)">Wrapper.Unit#UNIT</a> TaskUnit </em></code>: </p>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em><a href="##(TASK_A2G)">#TASK_A2G</a>:</em></p>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(TASK_A2G).SetTargetPointVec2" >
|
||||
<strong>TASK_A2G:SetTargetPointVec2(TargetPointVec2, TaskUnit)</strong>
|
||||
</a>
|
||||
|
||||
@ -402,7 +402,7 @@ and creates a CSV file logging the scoring events and results for use at team or
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="Task_A2G.html">Task_A2G</a></td>
|
||||
<td class="summary">
|
||||
<p>This module contains the TASK_A2G classes.</p>
|
||||
<p><strong>Tasking</strong> - The TASK_A2G models tasks for players in Air to Ground engagements.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
BIN
docs/Presentations/TASK_A2G/Dia1.JPG
Normal file
BIN
docs/Presentations/TASK_A2G/Dia1.JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 137 KiB |
Loading…
x
Reference in New Issue
Block a user