mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Final commit ...
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
---
|
||||
-- Name: TAD-010 - A2G Task Dispatching Destroy Test
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 17 Mar 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- This tests if an accepted task successful completion does finish the processes correctly.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
--
|
||||
local HQ = GROUP:FindByName( "HQ", "Bravo HQ" )
|
||||
|
||||
local CommandCenter = COMMANDCENTER:New( HQ, "Lima" )
|
||||
|
||||
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()
|
||||
|
||||
local 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 and Group004:IsAlive() == false then
|
||||
Mission:GetCommandCenter():MessageToCoalition( "Mission Complete!" )
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user