This commit is contained in:
FlightControl
2016-12-15 09:50:21 +01:00
parent 63e46ad029
commit 51d8e2b7d8
7 changed files with 263 additions and 24 deletions

View File

@@ -1,4 +1,12 @@
--- Task Modelling - SEAD
--
-- ===
--
-- Author: FlightControl
-- Date Created: 15 Dec 2016
--
-- # Situation
--
-- This test mission is a test bed for the TASKING framework.
-- It creates an head quarters (HQ), which contains one mission with one task to be accomplished.
-- When the pilot joins the plane, it will need to accept the task using the HQ menu.
@@ -7,6 +15,56 @@
-- A smoking system is available that the pilot can use the acquire targets.
-- Once all targets are elimitated, the task is finished, and the mission is set to complete.
-- If the pilot crashes during flying, the task will fail, and the mission is set to failed.
--
-- Uses the Tracing functions from BASE within the DCS.log file. Check the DCS.log file for the results.
-- Create a new SCHEDULER object.
-- Check the DCS.log.
--
-- # Test cases:
--
-- There should only be one Task listed under Others Menu -> HQ -> SEAD Targets -> SEAD. This is the TaskSEAD2, that is copied from TaskSEAD.
-- TaskSEAD is removed from the mission once TaskSEAD2 is created.
--
-- ## Run this mission in DCS Single Player:
--
-- * Once started, a slot.
-- * When in the plane, join the SEAD task through the Others Menu -> HQ -> SEAD Targets -> SEAD -> SEAD Radars Vector 2.
-- * When flying, watch the messages appear. It should say that you've been assigned to the task, and that you need to route your plane to a coordinate.
-- * Exit your plane by pressing ESC, and go back to the spectators. When in single player mode, just click on Back, and then click Spectators.
-- * Immediately rejoin a Slot, select an other plane.
-- * When in the plane, you should now not be able to join the Task. No menu options are given. That is because the Task is "Aborted".
-- * However, the aborted task is replanned within 30 seconds. As such, go back to spectators, and after 30 seconds, rejoin a slot in a plane.
-- * When in the plane, you should not be able to join the Task through the Others Menu -> HQ -> SEAD Targets -> SEAD -> SEAD Radars Vector 2.
-- * Once accepted, watch the messages appear. Route to the attach zone, following the coordinates.
-- * Once at the attack zone, you'll see a message how many targets are left to be destroyed. Attack the radar emitting SAM with a kh-25.
-- * When you HIT the SAM, you'll see a scoring message appear. One point is granted.
-- * Maybe you've fired two missiles, so, you'll see another HIT maybe on the SAM, again granting a point.
-- * When the SAM is DEAD (it may take a while), you'll see a scoring message that 10 points have been granted.
-- * You'll see a scoring message appear that grants 25 points because you've hit a target of the Task. (This was programmed below).
-- * You'll see a scoring message appear that grants 250 points because all Task targets have been elimitated. (This was also programmed below).
-- * You'll see a message appear that you have Task success. The Task will be flagged as 'Success', and cannot be joined anymore.
-- * You'll see a message appear that the Mission "SEAD Targets" has been "Completed".
--
-- ## Run this mission in DCS Multiple Player, with one player:
--
-- * Retry the above scenario, but now running this scenario on a multi player server, while connecting with one player to the mission. Watch the consistency of the messages.
--
-- ## Run this mission in DCS Multiple Player, with two to three players simultaneously:
--
-- * Retry the above scenario running this scenario on a multi player server, while connecting with two or three players to the mission. Watch the consistency of the messages.
-- * When the first player has accepted the Task, the 2nd and 3rd player joining the Task, will be automatically assigned to the Task.
--
-- ## Others things to watch out for:
--
-- * When flying to the attack zone, a message should appear every 30 seconds with the coordinates.
-- * When in the attack zone, a message should appear every 30 seconds how many targes are left within the task.
-- * When a player aborts the task, a message is displayed of the player aborting, but only to the group assigned to execute the task.
-- * When a player joins the task, a message is displayed of the player joining, but only to the group assigned to execute the task.
-- * When a player crashes into the ground, a message is displayed of that event.
-- * In multi player, when the Task was assigned to the group, but all players in that group aborted the Task, the Task should become Aborted. It will be replanned in 30 seconds.
--
-- # Status: TESTING - 15 Dec 2016
-- Create the HQ object.
local HQ = COMMANDCENTER:New( GROUP:FindByName( "HQ" ) )
@@ -64,7 +122,7 @@ local SEADTask = TASK_BASE:New( Mission, SEADSet, "SEAD Radars Vector 1", "SEAD"
-- The reason why this is done, is that each unit as a role within the Task, and can have different status.
-- Therefore, the FsmSEAD is a TEMPLATE PROCESS of the TASK, and must be designed as a UNIT with a player is executing that PROCESS.
local SEADProcess = SEADTask:GetFsmTemplate()
local SEADProcess = SEADTask:GetUnitProcess()
-- Adding a new sub-process to the Task Template.
-- At first, the task needs to be accepted by a pilot.
@@ -115,15 +173,16 @@ end
-- we check if the SEADTask has still AlivePlayers assigned to the Task.
-- If not, the Task will Abort.
-- And it will be Replanned within 30 seconds.
function SEADTask:OnAfterPlayerAborted( PlayerUnit, PlayerName )
function SEADTask:OnAfterPlayerCrashed( PlayerUnit, PlayerName )
if not SEADTask:HasAliveUnits() then
SEADTask:__Abort()
SEADTask:__Replan( 30 )
end
end
local TaskSEAD2 = TASK_BASE:New( Mission, SEADSet, "SEAD Radars Vector 2", "SEAD" ) -- Tasking.Task#TASK_BASE
TaskSEAD2:SetFsmTemplate( SEADTask:GetFsmTemplate():Copy() )
TaskSEAD2:SetUnitProcess( SEADTask:GetUnitProcess():Copy() )
Mission:AddTask( TaskSEAD2 )
Mission:RemoveTask(SEADTask)