COMMANDCENTER class added, Event handlers added, HQs working with missions

- Handling menus
- Reporting missions
- ...
This commit is contained in:
FlightControl 2016-11-25 14:08:06 +01:00
parent c27b6efe12
commit 28802ba276
18 changed files with 525 additions and 60 deletions

View File

@ -231,6 +231,84 @@ function BASE:EventRemoveAll()
return self
end
--- Subscribe to a S_EVENT_SHOT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnShot( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOT )
return self
end
--- Subscribe to a S_EVENT_HIT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnHit( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_HIT )
return self
end
--- Subscribe to a S_EVENT_TAKEOFF event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnTakeOff( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_TAKEOFF )
return self
end
--- Subscribe to a S_EVENT_LAND event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnLand( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_LAND )
return self
end
--- Subscribe to a S_EVENT_CRASH event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnCrash( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_CRASH )
return self
end
--- Subscribe to a S_EVENT_EJECTION event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnEjection( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_EJECTION )
return self
end
--- Subscribe to a S_EVENT_REFUELING event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnRefueling( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_REFUELING )
return self
end
--- Subscribe to a S_EVENT_DEAD event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
@ -242,6 +320,171 @@ function BASE:EventOnDead( EventFunction )
return self
end
--- Subscribe to a S_EVENT_PILOT_DEAD event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnPilotDead( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PILOT_DEAD )
return self
end
--- Subscribe to a S_EVENT_BASE_CAPTURED event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnBaseCaptured( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_BASE_CAPTURED )
return self
end
--- Subscribe to a S_EVENT_MISSION_START event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnMissionStart( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_MISSION_START )
return self
end
--- Subscribe to a S_EVENT_MISSION_END event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnPlayerMissionEnd( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_MISSION_END )
return self
end
--- Subscribe to a S_EVENT_TOOK_CONTROL event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnTookControl( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_TOOK_CONTROL )
return self
end
--- Subscribe to a S_EVENT_REFUELING_STOP event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnRefuelingStop( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_REFUELING_STOP )
return self
end
--- Subscribe to a S_EVENT_BIRTH event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnBirth( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_BIRTH )
return self
end
--- Subscribe to a S_EVENT_HUMAN_FAILURE event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnHumanFailure( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_HUMAN_FAILURE )
return self
end
--- Subscribe to a S_EVENT_ENGINE_STARTUP event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnEngineStartup( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_ENGINE_STARTUP )
return self
end
--- Subscribe to a S_EVENT_ENGINE_SHUTDOWN event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnEngineShutdown( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_ENGINE_SHUTDOWN )
return self
end
--- Subscribe to a S_EVENT_PLAYER_ENTER_UNIT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnPlayerEnterUnit( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_ENTER_UNIT )
return self
end
--- Subscribe to a S_EVENT_PLAYER_LEAVE_UNIT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnPlayerLeaveUnit( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_LEAVE_UNIT )
return self
end
--- Subscribe to a S_EVENT_PLAYER_COMMENT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnPlayerComment( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_COMMENT )
return self
end
--- Subscribe to a S_EVENT_SHOOTING_START event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnShootingStart( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOOTING_START )
return self
end
--- Subscribe to a S_EVENT_SHOOTING_END event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
function BASE:EventOnShootingEnd( EventFunction )
_EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOOTING_END )
return self
end

View File

@ -45,13 +45,13 @@ local _EVENTCODES = {
-- @field weapon
-- @field IniDCSUnit
-- @field IniDCSUnitName
-- @field Unit#UNIT IniUnit
-- @field Wrapper.Unit#UNIT IniUnit
-- @field #string IniUnitName
-- @field IniDCSGroup
-- @field IniDCSGroupName
-- @field TgtDCSUnit
-- @field TgtDCSUnitName
-- @field Unit#UNIT TgtUnit
-- @field Wrapper.Unit#UNIT TgtUnit
-- @field #string TgtUnitName
-- @field TgtDCSGroup
-- @field TgtDCSGroupName

View File

@ -54,7 +54,11 @@ function MESSAGE:New( MessageText, MessageDuration, MessageCategory )
-- When no MessageCategory is given, we don't show it as a title...
if MessageCategory and MessageCategory ~= "" then
if MessageCategory:sub(-1) ~= "\n" then
self.MessageCategory = MessageCategory .. ": "
else
self.MessageCategory = MessageCategory:sub( 1, -2 ) .. ":\n"
end
else
self.MessageCategory = ""
end

View File

@ -720,7 +720,7 @@ end
--- SET_GROUP class
-- @type SET_GROUP
-- @extends Set#SET_BASE
-- @extends #SET_BASE
SET_GROUP = {
ClassName = "SET_GROUP",
Filter = {

View File

@ -40,29 +40,29 @@ function STATEMACHINE:New( options )
--setmetatable( self, MT )
--self.__index = self
self.options = options
self.options = options or {}
self.options.subs = self.options.subs or {}
self.current = options.initial or 'none'
self.current = self.options.initial or 'none'
self.events = {}
self.subs = {}
self.endstates = {}
for _, event in pairs(options.events or {}) do
for _, event in pairs( self.options.events or {}) do
self:T3({ "events", event })
self:_eventmap( self.events, event )
end
for name, callback in pairs(options.callbacks or {}) do
for name, callback in pairs( self.options.callbacks or {}) do
self:T3("callbacks")
self[name] = callback
end
for name, sub in pairs( options.subs or {} ) do
for name, sub in pairs( self.options.subs or {} ) do
self:T3("sub")
self:_submap( self.subs, sub, name )
end
for name, endstate in pairs( options.endstates or {} ) do
for name, endstate in pairs( self.options.endstates or {} ) do
self:T3("endstate")
self.endstates[endstate] = endstate
end
@ -104,7 +104,7 @@ function STATEMACHINE:AddProcess( From, Event, Process, ReturnEvents )
self:_submap( self.subs, sub, nil )
self:AddAction( From, Event, "*" )
self:AddAction( From, Event, From )
return Process
end

View File

@ -52,6 +52,7 @@ Include.File( "Process/Account" )
Include.File( "Process/Smoke" )
--- Task Handling Classes
Include.File( "Tasking/CommandCenter" )
Include.File( "Tasking/Mission" )
Include.File( "Tasking/Task" )
Include.File( "Tasking/DetectionManager" )

View File

@ -0,0 +1,148 @@
--- A COMMANDCENTER is the owner of multiple missions within MOOSE.
-- A COMMANDCENTER governs multiple missions, the tasking and the reporting.
-- @module CommandCenter
--- The COMMANDCENTER class
-- @type COMMANDCENTER
-- @field Wrapper.Group#GROUP HQ
-- @list<Tasking.Mission#MISSION> Missions
-- @extends Core.Base#BASE
COMMANDCENTER = {
ClassName = "COMMANDCENTER",
Name = "",
}
--- The REPORT class
-- @type REPORT
-- @extends Core.Base#BASE
REPORT = {
ClassName = "REPORT",
}
--- Create a new REPORT.
-- @param #REPORT self
-- @param #string Title
-- @return #REPORT
function REPORT:New( Title )
local self = BASE:Inherit( self, BASE:New() )
self.Report = {}
self.Report[#self.Report+1] = Title
return self
end
--- Add a new line to a REPORT.
-- @param #REPORT self
-- @param #string Text
-- @return #REPORT
function REPORT:Add( Text )
self.Report[#self.Report+1] = Text
return self.Report[#self.Report+1]
end
function REPORT:Text()
return table.concat( self.Report, "\n" )
end
--- The constructor takes an IDENTIFIABLE as the HQ command center.
-- @param #COMMANDCENTER self
-- @param Wrapper.Positionable#POSITIONABLE HQ
-- @param #string HQName
-- @return #COMMANDCENTER
function COMMANDCENTER:New( HQ, HQName )
local self = BASE:Inherit( self, BASE:New() )
self.HQ = HQ
self.HQName = HQName or HQ:GetName()
self.HQCoalition = HQ:GetCoalition()
self.Missions = {}
setmetatable( self.Missions, { __mode = "v" } )
self:EventOnBirth(
--- @param Core.Event#EVENTDATA EventData
function( HQ, EventData )
self:E( { EventData } )
local EventGroup = GROUP:Find( EventData.IniDCSGroup )
if EventGroup and HQ:HasGroup( EventGroup ) then
local MenuHQ = MENU_GROUP:New( EventGroup, "HQ" )
local MenuReporting = MENU_GROUP:New( EventGroup, "Reporting", MenuHQ )
local MenuMissions = MENU_GROUP_COMMAND:New( EventGroup, "Missions", MenuReporting, HQ.ReportMissions, HQ, EventGroup )
end
end
)
return self
end
--- Gets the name of the HQ command center.
-- @param #COMMANDCENTER self
-- @return #string
function COMMANDCENTER:GetName()
return self.HQName
end
--- Add a MISSION to be governed by the HQ command center.
-- @param #COMMANDCENTER self
-- @param Tasking.Mission#MISSION Mission
-- @return Tasking.Mission#MISSION
function COMMANDCENTER:AddMission( Mission )
self.Missions[Mission] = Mission
return Mission
end
--- Removes a MISSION to be governed by the HQ command center.
-- The given Mission is not nilified.
-- @param #COMMANDCENTER self
-- @param Tasking.Mission#MISSION Mission
-- @return Tasking.Mission#MISSION
function COMMANDCENTER:RemoveMission( Mission )
self.Missions[Mission] = nil
return Mission
end
--- Checks of the COMMANDCENTER has a GROUP.
-- @param #COMMANDCENTER self
-- @param Wrapper.Group#GROUP
-- @return #boolean
function COMMANDCENTER:HasGroup( MissionGroup )
local Has = false
for MissionID, Mission in pairs( self.Missions ) do
local Mission = Mission -- Tasking.Mission#MISSION
if Mission:HasGroup( MissionGroup ) then
Has = true
break
end
end
return Has
end
--- Report the status of all MISSIONs to a GROUP.
function COMMANDCENTER:ReportMissions( ReportGroup )
self:E( ReportGroup )
local Report = REPORT:New()
for MissionID, Mission in pairs( self.Missions ) do
local Mission = Mission -- Tasking.Mission#MISSION
Report:Add( " - " .. Mission:ReportStatus() )
end
MESSAGE:New( Report:Text(), 30, "Status Report Missions from " .. self:GetName() .. "\n" ):ToGroup( ReportGroup )
end

View File

@ -485,6 +485,9 @@ do -- DETECTION_DISPATCHER
end
-- TODO set menus using the HQ coordinator
--Mission:SetMenu()
if #AreaMsg > 0 then
for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
if not TaskGroup:GetState( TaskGroup, "Assigned" ) then

View File

@ -4,10 +4,10 @@
--- The MISSION class
-- @type MISSION
-- @extends Base#BASE
-- @field #MISSION.Clients _Clients
-- @field Menu#MENU_COALITION MissionMenu
-- @field #string MissionBriefing
-- @extends Core.StateMachine#STATEMACHINE
MISSION = {
ClassName = "MISSION",
Name = "",
@ -35,7 +35,6 @@ MISSION = {
function MISSION:Meta()
local self = BASE:Inherit( self, BASE:New() )
return self
end
@ -47,11 +46,14 @@ end
-- @param #string MissionBriefing is a string indicating the mission briefing to be shown when a player joins a @{CLIENT}.
-- @param DCSCoalitionObject#coalition MissionCoalition is a string indicating the coalition or party to which this mission belongs to. It is free format and can be chosen freely by the mission designer. Note that this field is not to be confused with the coalition concept of the ME. Examples of a Mission Coalition could be "NATO", "CCCP", "Intruders", "Terrorists"...
-- @return #MISSION self
function MISSION:New( MissionName, MissionPriority, MissionBriefing, MissionCoalition )
function MISSION:New( HQ, MissionName, MissionPriority, MissionBriefing, MissionCoalition )
local self = BASE:Inherit( self, STATEMACHINE:New() ) -- Core.StateMachine#STATEMACHINE
self = MISSION:Meta()
self:T( { MissionName, MissionPriority, MissionBriefing, MissionCoalition } )
self.HQ = HQ
HQ:AddMission( self )
self.Name = MissionName
self.MissionPriority = MissionPriority
self.MissionBriefing = MissionBriefing
@ -60,6 +62,13 @@ function MISSION:New( MissionName, MissionPriority, MissionBriefing, MissionCoal
self.Tasks = {}
setmetatable( self.Tasks, { __mode = "v" } )
-- Build the Fsm for the mission.
self:SetInitialState( "Idle" )
self:AddAction( "Idle", "Start", "Ongoing" )
self:AddAction( "Ongoing", "Stop", "Idle" )
self:AddAction( "Ongoing", "Finish", "Finished" )
return self
end
@ -85,6 +94,27 @@ function MISSION:GetScoring()
return self.Scoring
end
--- Get the groups for which TASKS are given in the mission
-- @param #MISSION self
-- @return Core.Set#SET_GROUP
function MISSION:GetGroups()
local SetGroup = SET_GROUP:New()
for TaskID, Task in pairs( self:GetTasks() ) do
local Task = Task -- Tasking.Task#TASK_BASE
local GroupSet = Task:GetGroups()
GroupSet:ForEachGroup(
function( TaskGroup )
SetGroup:Add( TaskGroup, TaskGroup )
end
)
end
return SetGroup
end
--- Sets the Planned Task menu.
-- @param #MISSION self
@ -279,25 +309,42 @@ function MISSION:StatusToClients()
end
end
--- Handles the reporting. After certain time intervals, a MISSION report MESSAGE will be shown to All Players.
function MISSION:ReportTrigger()
self:F()
function MISSION:HasGroup( TaskGroup )
local Has = false
if self.MissionReportShow == true then
self.MissionReportShow = false
return true
else
if self.MissionReportFlash == true then
if timer.getTime() >= self.MissionReportTrigger then
self.MissionReportTrigger = timer.getTime() + self.MissionTimeInterval
return true
else
return false
end
else
return false
for TaskID, Task in pairs( self:GetTasks() ) do
local Task = Task -- Tasking.Task#TASK_BASE
if Task:HasGroup( TaskGroup ) then
Has = true
break
end
end
return Has
end
--- Create a summary report of the mission (one line).
-- @param #MISSION self
-- @return #string
function MISSION:ReportStatus()
-- List the name of the mission.
local Name = self:GetName()
-- Determine the status of the mission.
local Status = self:GetState()
-- Determine how many tasks are remaining.
local TasksRemaining = 0
for TaskID, Task in pairs( self:GetTasks() ) do
local Task = Task -- Tasking.Task#TASK_BASE
if Task:IsStateSuccess() or Task:IsStateFailed() then
else
TasksRemaining = TasksRemaining + 1
end
end
return "Mission " .. Name .. " - " .. Status .. " - " .. TasksRemaining .. " tasks remaining."
end
--- Report the status of all MISSIONs to all active Clients.

View File

@ -55,7 +55,7 @@
-- @field Mission#MISSION Mission
-- @field StateMachine#STATEMACHINE Fsm
-- @field Set#SET_GROUP SetGroup The Set of Groups assigned to the Task
-- @extends Core.Base#BASE
-- @extends Core.StateMachine#STATEMACHINE_TASK
TASK_BASE = {
ClassName = "TASK_BASE",
TaskScheduler = nil,
@ -106,6 +106,13 @@ function TASK_BASE:New( Mission, SetGroupAssign, TaskName, TaskType, TaskCategor
return self
end
--- Gets the SET_GROUP assigned to the TASK.
-- @param #TASK_BASE self
-- @return Core.Set#SET_GROUP
function TASK_BASE:GetGroups()
return self.SetGroup
end
--- Cleans all references of a TASK_BASE.
-- @param #TASK_BASE self
-- @return #nil
@ -151,6 +158,16 @@ function TASK_BASE:AssignToGroup( TaskGroup )
return self
end
---
-- @param #TASK_BASE self
-- @param Wrapper.Group#GROUP FindGroup
-- @return #boolean
function TASK_BASE:HasGroup( FindGroup )
return self:GetGroups():IsIncludeObject( FindGroup )
end
--- Assign the @{Task} to an alive @{Unit}.
-- @param #TASK_BASE self
-- @param Unit#UNIT TaskUnit

View File

@ -51,8 +51,8 @@ do -- TASK_SEAD
Fsm:AddProcess( "Assigned", "Route", PROCESS_ROUTE_ZONE:New( self.TargetZone ), { Arrived = "Update" } )
Fsm:AddAction ( "Rejected", "Eject", "Planned" )
Fsm:AddAction ( "Arrived", "Update", "Updated" )
Fsm:AddProcess( "*", "Account", PROCESS_ACCOUNT_DEADS:New( self.TargetSetUnit, "SEAD" ), { Accounted = "Success" } )
Fsm:AddProcess( "*", "Smoke", PROCESS_SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone ) )
Fsm:AddProcess( "Updated", "Account", PROCESS_ACCOUNT_DEADS:New( self.TargetSetUnit, "SEAD" ), { Accounted = "Success" } )
Fsm:AddProcess( "Updated", "Smoke", PROCESS_SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone ) )
Fsm:AddAction ( "Accounted", "Success", "Success" )
Fsm:AddAction ( "Failed", "Fail", "Failed" )

View File

@ -1,8 +1,8 @@
--- This module contains the IDENTIFIABLE class.
--
-- 1) @{Identifiable#IDENTIFIABLE} class, extends @{Object#OBJECT}
-- 1) @{#IDENTIFIABLE} class, extends @{Object#OBJECT}
-- ===============================================================
-- The @{Identifiable#IDENTIFIABLE} class is a wrapper class to handle the DCS Identifiable objects:
-- The @{#IDENTIFIABLE} class is a wrapper class to handle the DCS Identifiable objects:
--
-- * Support all DCS Identifiable APIs.
-- * Enhance with Identifiable specific APIs not in the DCS Identifiable API set.
@ -12,18 +12,18 @@
-- ------------------------------
-- The IDENTIFIABLE class provides the following functions to construct a IDENTIFIABLE instance:
--
-- * @{Identifiable#IDENTIFIABLE.New}(): Create a IDENTIFIABLE instance.
-- * @{#IDENTIFIABLE.New}(): Create a IDENTIFIABLE instance.
--
-- 1.2) IDENTIFIABLE methods:
-- --------------------------
-- The following methods can be used to identify an identifiable object:
--
-- * @{Identifiable#IDENTIFIABLE.GetName}(): Returns the name of the Identifiable.
-- * @{Identifiable#IDENTIFIABLE.IsAlive}(): Returns if the Identifiable is alive.
-- * @{Identifiable#IDENTIFIABLE.GetTypeName}(): Returns the type name of the Identifiable.
-- * @{Identifiable#IDENTIFIABLE.GetCoalition}(): Returns the coalition of the Identifiable.
-- * @{Identifiable#IDENTIFIABLE.GetCountry}(): Returns the country of the Identifiable.
-- * @{Identifiable#IDENTIFIABLE.GetDesc}(): Returns the descriptor structure of the Identifiable.
-- * @{#IDENTIFIABLE.GetName}(): Returns the name of the Identifiable.
-- * @{#IDENTIFIABLE.IsAlive}(): Returns if the Identifiable is alive.
-- * @{#IDENTIFIABLE.GetTypeName}(): Returns the type name of the Identifiable.
-- * @{#IDENTIFIABLE.GetCoalition}(): Returns the coalition of the Identifiable.
-- * @{#IDENTIFIABLE.GetCountry}(): Returns the country of the Identifiable.
-- * @{#IDENTIFIABLE.GetDesc}(): Returns the descriptor structure of the Identifiable.
--
--
-- ===
@ -60,7 +60,7 @@ function IDENTIFIABLE:New( IdentifiableName )
end
--- Returns if the Identifiable is alive.
-- @param Identifiable#IDENTIFIABLE self
-- @param #IDENTIFIABLE self
-- @return #boolean true if Identifiable is alive.
-- @return #nil The DCS Identifiable is not existing or alive.
function IDENTIFIABLE:IsAlive()
@ -81,7 +81,7 @@ end
--- Returns DCS Identifiable object name.
-- The function provides access to non-activated objects too.
-- @param Wrapper.Identifiable#IDENTIFIABLE self
-- @param #IDENTIFIABLE self
-- @return #string The name of the DCS Identifiable.
-- @return #nil The DCS Identifiable is not existing or alive.
function IDENTIFIABLE:GetName()
@ -100,7 +100,7 @@ end
--- Returns the type name of the DCS Identifiable.
-- @param Identifiable#IDENTIFIABLE self
-- @param #IDENTIFIABLE self
-- @return #string The type name of the DCS Identifiable.
-- @return #nil The DCS Identifiable is not existing or alive.
function IDENTIFIABLE:GetTypeName()
@ -137,7 +137,7 @@ end
--- Returns the DCS Identifiable category name as defined within the DCS Identifiable Descriptor.
-- @param Identifiable#IDENTIFIABLE self
-- @param #IDENTIFIABLE self
-- @return #string The DCS Identifiable Category Name
function IDENTIFIABLE:GetCategoryName()
local DCSIdentifiable = self:GetDCSObject()
@ -152,7 +152,7 @@ function IDENTIFIABLE:GetCategoryName()
end
--- Returns coalition of the Identifiable.
-- @param Identifiable#IDENTIFIABLE self
-- @param #IDENTIFIABLE self
-- @return DCSCoalitionObject#coalition.side The side of the coalition.
-- @return #nil The DCS Identifiable is not existing or alive.
function IDENTIFIABLE:GetCoalition()
@ -171,7 +171,7 @@ function IDENTIFIABLE:GetCoalition()
end
--- Returns country of the Identifiable.
-- @param Identifiable#IDENTIFIABLE self
-- @param #IDENTIFIABLE self
-- @return DCScountry#country.id The country identifier.
-- @return #nil The DCS Identifiable is not existing or alive.
function IDENTIFIABLE:GetCountry()
@ -192,7 +192,7 @@ end
--- Returns Identifiable descriptor. Descriptor type depends on Identifiable category.
-- @param Identifiable#IDENTIFIABLE self
-- @param #IDENTIFIABLE self
-- @return DCSIdentifiable#Identifiable.Desc The Identifiable descriptor.
-- @return #nil The DCS Identifiable is not existing or alive.
function IDENTIFIABLE:GetDesc()

View File

@ -342,7 +342,7 @@ function UNIT:GetNumber()
end
--- Returns the unit's group if it exist and nil otherwise.
-- @param Unit#UNIT self
-- @param Wrapper.Unit#UNIT self
-- @return Group#GROUP The Group of the Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetGroup()

View File

@ -1,12 +1,15 @@
local HQ = GROUP:FindByName( "HQ", "Bravo HQ" )
local CommandCenter = COMMANDCENTER:New( HQ )
local Scoring = SCORING:New( "Detect Demo" )
local Mission = MISSION:New( "Attack Detect Mission", "High", "Attack Detect Mission Briefing", coalition.side.RED ):AddScoring( Scoring )
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 FACDetection = DETECTION_AREAS:New( FACSet, 10000, 3000 )
local AttackGroups = SET_GROUP:New():FilterCoalitions( "red" ):FilterPrefixes( "Attack" ):FilterStart()
local CommandCenter = GROUP:FindByName( "HQ" )
local TaskAssign = DETECTION_DISPATCHER:New( Mission, CommandCenter, AttackGroups, FACDetection )
local TaskAssign = DETECTION_DISPATCHER:New( Mission, HQ, AttackGroups, FACDetection )

View File

@ -8,7 +8,9 @@ end
collectgarbage()
local Mission = MISSION:New( 'SEAD Targets', "Strategic", "SEAD the enemy", coalition.side.RED )
local HQ = COMMANDCENTER:New( GROUP:FindByName( "HQ" ) )
local Mission = MISSION:New( HQ, 'SEAD Targets', "Strategic", "SEAD the enemy", coalition.side.RED )
local Scoring = SCORING:New( "SEAD" )
Mission:AddScoring( Scoring )
@ -43,7 +45,4 @@ function FsmSEAD:onenterUpdated( TaskUnit )
self:Smoke()
end
-- Needs to be checked, should not be necessary ...
TaskSEAD:AssignToGroup( SEADSet:Get( "Test SEAD" ) )
Mission:AddTask( TaskSEAD )