diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index 86f47f663..63b5ab355 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -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 + diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index 3c78e6bb9..a64e5a64b 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -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 diff --git a/Moose Development/Moose/Core/Message.lua b/Moose Development/Moose/Core/Message.lua index bc44263bc..6c0f8a798 100644 --- a/Moose Development/Moose/Core/Message.lua +++ b/Moose Development/Moose/Core/Message.lua @@ -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 - self.MessageCategory = MessageCategory .. ": " + if MessageCategory:sub(-1) ~= "\n" then + self.MessageCategory = MessageCategory .. ": " + else + self.MessageCategory = MessageCategory:sub( 1, -2 ) .. ":\n" + end else self.MessageCategory = "" end diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index 4afa912d4..dd7575aad 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -720,7 +720,7 @@ end --- SET_GROUP class -- @type SET_GROUP --- @extends Set#SET_BASE +-- @extends #SET_BASE SET_GROUP = { ClassName = "SET_GROUP", Filter = { diff --git a/Moose Development/Moose/Core/StateMachine.lua b/Moose Development/Moose/Core/StateMachine.lua index caf7492b7..616dcc506 100644 --- a/Moose Development/Moose/Core/StateMachine.lua +++ b/Moose Development/Moose/Core/StateMachine.lua @@ -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 diff --git a/Moose Development/Moose/Moose.lua b/Moose Development/Moose/Moose.lua index 4b3d81f29..dca6ad7ad 100644 --- a/Moose Development/Moose/Moose.lua +++ b/Moose Development/Moose/Moose.lua @@ -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" ) diff --git a/Moose Development/Moose/Tasking/CommandCenter.lua b/Moose Development/Moose/Tasking/CommandCenter.lua new file mode 100644 index 000000000..2aca73ee0 --- /dev/null +++ b/Moose Development/Moose/Tasking/CommandCenter.lua @@ -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 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 + diff --git a/Moose Development/Moose/Tasking/DetectionManager.lua b/Moose Development/Moose/Tasking/DetectionManager.lua index 9aad97773..22ac4c2d9 100644 --- a/Moose Development/Moose/Tasking/DetectionManager.lua +++ b/Moose Development/Moose/Tasking/DetectionManager.lua @@ -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 diff --git a/Moose Development/Moose/Tasking/Mission.lua b/Moose Development/Moose/Tasking/Mission.lua index 2d1481a90..455b8405f 100644 --- a/Moose Development/Moose/Tasking/Mission.lua +++ b/Moose Development/Moose/Tasking/Mission.lua @@ -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 ) - self = MISSION:Meta() + local self = BASE:Inherit( self, STATEMACHINE:New() ) -- Core.StateMachine#STATEMACHINE + 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 + + 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 - 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 - end - 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. diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua index b02d35102..a59dfeff1 100644 --- a/Moose Development/Moose/Tasking/Task.lua +++ b/Moose Development/Moose/Tasking/Task.lua @@ -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 diff --git a/Moose Development/Moose/Tasking/Task_SEAD.lua b/Moose Development/Moose/Tasking/Task_SEAD.lua index bd5aaf225..89fe1ae45 100644 --- a/Moose Development/Moose/Tasking/Task_SEAD.lua +++ b/Moose Development/Moose/Tasking/Task_SEAD.lua @@ -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" ) diff --git a/Moose Development/Moose/Wrapper/Identifiable.lua b/Moose Development/Moose/Wrapper/Identifiable.lua index 36d41e828..826ad217d 100644 --- a/Moose Development/Moose/Wrapper/Identifiable.lua +++ b/Moose Development/Moose/Wrapper/Identifiable.lua @@ -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() diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 586b44bb4..c13354f99 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -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() diff --git a/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Detection_Dispatcher/Moose_Test_Detection_Dispatcher.lua b/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Detection_Dispatcher/Moose_Test_Detection_Dispatcher.lua index 200b3b1c1..a28827b61 100644 --- a/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Detection_Dispatcher/Moose_Test_Detection_Dispatcher.lua +++ b/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Detection_Dispatcher/Moose_Test_Detection_Dispatcher.lua @@ -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 ) diff --git a/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Detection_Dispatcher/Moose_Test_Detection_Dispatcher.miz b/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Detection_Dispatcher/Moose_Test_Detection_Dispatcher.miz index ce493f851..7730129d3 100644 Binary files a/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Detection_Dispatcher/Moose_Test_Detection_Dispatcher.miz and b/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Detection_Dispatcher/Moose_Test_Detection_Dispatcher.miz differ diff --git a/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Task_SEAD/Moose_Test_Task_SEAD.lua b/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Task_SEAD/Moose_Test_Task_SEAD.lua index 8fadd29c7..44c373941 100644 --- a/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Task_SEAD/Moose_Test_Task_SEAD.lua +++ b/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Task_SEAD/Moose_Test_Task_SEAD.lua @@ -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 ) diff --git a/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Task_SEAD/Moose_Test_Task_SEAD.miz b/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Task_SEAD/Moose_Test_Task_SEAD.miz index 3e3ad8037..04f4a2de4 100644 Binary files a/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Task_SEAD/Moose_Test_Task_SEAD.miz and b/Moose Test Missions/Moose_Test_Tasking/Moose_Test_Task_SEAD/Moose_Test_Task_SEAD.miz differ diff --git a/Moose Training/Presentations/DCS World - MOOSE - Tasking - SEAD.pptx b/Moose Training/Presentations/DCS World - MOOSE - Tasking - SEAD.pptx index 1b54eb9a5..fd558d66b 100644 Binary files a/Moose Training/Presentations/DCS World - MOOSE - Tasking - SEAD.pptx and b/Moose Training/Presentations/DCS World - MOOSE - Tasking - SEAD.pptx differ