mirror of
https://github.com/FlightControl-Master/MOOSE_MISSIONS.git
synced 2026-08-23 21:35:45 +00:00
50 lines
1.8 KiB
Lua
50 lines
1.8 KiB
Lua
---
|
|
-- Name: TAD-120 - A2G Task Dispatching DETECTION_UNITS
|
|
-- Author: FlightControl
|
|
-- Date Created: 13 Mar 2017
|
|
--
|
|
-- # Situation:
|
|
--
|
|
-- This mission demonstrates the dynamic task dispatching for Air to Ground operations.
|
|
-- FACA's and FAC's are patrolling around the battle field, while detecting targets.
|
|
-- The detection method used is the DETECTION_UNITS method, which groups detected targets per detected unit.
|
|
--
|
|
-- # 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.
|
|
--
|
|
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 )
|
|
|
|
-- 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 |