mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Sync
This commit is contained in:
parent
68e3472c49
commit
2d3ee93d9e
@ -205,8 +205,11 @@ function STATEMACHINE._handler( self, EventName, ... )
|
|||||||
end
|
end
|
||||||
|
|
||||||
if execute then
|
if execute then
|
||||||
|
-- only execute the call if the From state is not equal to the To state! Otherwise this function should never execute!
|
||||||
|
if from ~= to then
|
||||||
self:T3( { onenter = "onenter" .. to, callback = self["onenter" .. to] } )
|
self:T3( { onenter = "onenter" .. to, callback = self["onenter" .. to] } )
|
||||||
self:_call_handler("onenter" .. to, params)
|
self:_call_handler("onenter" .. to, params)
|
||||||
|
end
|
||||||
|
|
||||||
self:T3( { On = "OnBefore" .. to, callback = self["OnBefore" .. to] } )
|
self:T3( { On = "OnBefore" .. to, callback = self["OnBefore" .. to] } )
|
||||||
if ( self:_call_handler("OnBefore" .. to, params ) ~= false ) then
|
if ( self:_call_handler("OnBefore" .. to, params ) ~= false ) then
|
||||||
@ -434,6 +437,8 @@ function STATEMACHINE_PROCESS:Assign( Task, ProcessUnit )
|
|||||||
self:SetTask( Task )
|
self:SetTask( Task )
|
||||||
|
|
||||||
self.ProcessGroup = ProcessUnit:GetGroup()
|
self.ProcessGroup = ProcessUnit:GetGroup()
|
||||||
|
--Task:RemoveMenuForGroup( self.ProcessGroup )
|
||||||
|
--Task:SetAssignedMenuForGroup( self.ProcessGroup )
|
||||||
|
|
||||||
--self:Activate()
|
--self:Activate()
|
||||||
|
|
||||||
|
|||||||
@ -2,15 +2,7 @@
|
|||||||
-- A COMMANDCENTER governs multiple missions, the tasking and the reporting.
|
-- A COMMANDCENTER governs multiple missions, the tasking and the reporting.
|
||||||
-- @module CommandCenter
|
-- @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
|
--- The REPORT class
|
||||||
-- @type REPORT
|
-- @type REPORT
|
||||||
@ -46,19 +38,31 @@ function REPORT:Text()
|
|||||||
return table.concat( self.Report, "\n" )
|
return table.concat( self.Report, "\n" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- The COMMANDCENTER class
|
||||||
|
-- @type COMMANDCENTER
|
||||||
|
-- @field Wrapper.Group#GROUP HQ
|
||||||
|
-- @field Dcs.DCSCoalitionObject#coalition CommandCenterCoalition
|
||||||
|
-- @list<Tasking.Mission#MISSION> Missions
|
||||||
|
-- @extends Core.Base#BASE
|
||||||
|
COMMANDCENTER = {
|
||||||
|
ClassName = "COMMANDCENTER",
|
||||||
|
CommandCenterName = "",
|
||||||
|
CommandCenterCoalition = nil,
|
||||||
|
CommandCenterPositionable = nil,
|
||||||
|
Name = "",
|
||||||
|
}
|
||||||
--- The constructor takes an IDENTIFIABLE as the HQ command center.
|
--- The constructor takes an IDENTIFIABLE as the HQ command center.
|
||||||
-- @param #COMMANDCENTER self
|
-- @param #COMMANDCENTER self
|
||||||
-- @param Wrapper.Positionable#POSITIONABLE HQ
|
-- @param Wrapper.Positionable#POSITIONABLE CommandCenterPositionable
|
||||||
-- @param #string HQName
|
-- @param #string CommandCenterName
|
||||||
-- @return #COMMANDCENTER
|
-- @return #COMMANDCENTER
|
||||||
function COMMANDCENTER:New( HQ, HQName )
|
function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, BASE:New() )
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
|
|
||||||
self.HQ = HQ
|
self.CommandCenterPositionable = CommandCenterPositionable
|
||||||
self.HQName = HQName or HQ:GetName()
|
self.CommandCenterName = CommandCenterName or CommandCenterPositionable:GetName()
|
||||||
self.HQCoalition = HQ:GetCoalition()
|
self.CommandCenterCoalition = CommandCenterPositionable:GetCoalition()
|
||||||
|
|
||||||
self.Missions = {}
|
self.Missions = {}
|
||||||
setmetatable( self.Missions, { __mode = "v" } )
|
setmetatable( self.Missions, { __mode = "v" } )
|
||||||
@ -69,8 +73,7 @@ function COMMANDCENTER:New( HQ, HQName )
|
|||||||
self:E( { EventData } )
|
self:E( { EventData } )
|
||||||
local EventGroup = GROUP:Find( EventData.IniDCSGroup )
|
local EventGroup = GROUP:Find( EventData.IniDCSGroup )
|
||||||
if EventGroup and HQ:HasGroup( EventGroup ) then
|
if EventGroup and HQ:HasGroup( EventGroup ) then
|
||||||
local MenuHQ = MENU_GROUP:New( EventGroup, "HQ" )
|
local MenuReporting = MENU_GROUP:New( EventGroup, "Reporting", self.CommandCenterMenu )
|
||||||
local MenuReporting = MENU_GROUP:New( EventGroup, "Reporting", MenuHQ )
|
|
||||||
local MenuMissions = MENU_GROUP_COMMAND:New( EventGroup, "Missions", MenuReporting, HQ.ReportMissions, HQ, EventGroup )
|
local MenuMissions = MENU_GROUP_COMMAND:New( EventGroup, "Missions", MenuReporting, HQ.ReportMissions, HQ, EventGroup )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -115,6 +118,8 @@ end
|
|||||||
-- @param #COMMANDCENTER self
|
-- @param #COMMANDCENTER self
|
||||||
function COMMANDCENTER:SetMenu()
|
function COMMANDCENTER:SetMenu()
|
||||||
|
|
||||||
|
self.CommandCenterMenu = MENU_COALITION:New( self.CommandCenterCoalition, "HQ" )
|
||||||
|
|
||||||
for MissionID, Mission in pairs( self.Missions ) do
|
for MissionID, Mission in pairs( self.Missions ) do
|
||||||
local Mission = Mission -- Tasking.Mission#MISSION
|
local Mission = Mission -- Tasking.Mission#MISSION
|
||||||
Mission:SetMenu()
|
Mission:SetMenu()
|
||||||
|
|||||||
@ -41,19 +41,21 @@ end
|
|||||||
|
|
||||||
--- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc.
|
--- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc.
|
||||||
-- @param #MISSION self
|
-- @param #MISSION self
|
||||||
|
-- @param Tasking.CommandCenter#COMMANDCENTER CommandCenter
|
||||||
-- @param #string MissionName is the name of the mission. This name will be used to reference the status of each mission by the players.
|
-- @param #string MissionName is the name of the mission. This name will be used to reference the status of each mission by the players.
|
||||||
-- @param #string MissionPriority is a string indicating the "priority" of the Mission. f.e. "Primary", "Secondary" or "First", "Second". It is free format and up to the Mission designer to choose. There are no rules behind this field.
|
-- @param #string MissionPriority is a string indicating the "priority" of the Mission. f.e. "Primary", "Secondary" or "First", "Second". It is free format and up to the Mission designer to choose. There are no rules behind this field.
|
||||||
-- @param #string MissionBriefing is a string indicating the mission briefing to be shown when a player joins a @{CLIENT}.
|
-- @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"...
|
-- @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
|
-- @return #MISSION self
|
||||||
function MISSION:New( HQ, MissionName, MissionPriority, MissionBriefing, MissionCoalition )
|
function MISSION:New( CommandCenter, MissionName, MissionPriority, MissionBriefing, MissionCoalition )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, STATEMACHINE:New() ) -- Core.StateMachine#STATEMACHINE
|
local self = BASE:Inherit( self, STATEMACHINE:New() ) -- Core.StateMachine#STATEMACHINE
|
||||||
|
|
||||||
self:T( { MissionName, MissionPriority, MissionBriefing, MissionCoalition } )
|
self:T( { MissionName, MissionPriority, MissionBriefing, MissionCoalition } )
|
||||||
|
|
||||||
self.HQ = HQ
|
self.CommandCenter = CommandCenter
|
||||||
HQ:AddMission( self )
|
CommandCenter:AddMission( self )
|
||||||
|
|
||||||
self.Name = MissionName
|
self.Name = MissionName
|
||||||
self.MissionPriority = MissionPriority
|
self.MissionPriority = MissionPriority
|
||||||
self.MissionBriefing = MissionBriefing
|
self.MissionBriefing = MissionBriefing
|
||||||
@ -118,15 +120,19 @@ end
|
|||||||
|
|
||||||
--- Sets the Planned Task menu.
|
--- Sets the Planned Task menu.
|
||||||
-- @param #MISSION self
|
-- @param #MISSION self
|
||||||
|
-- @param Core.Menu#MENU_COALITION CommandCenterMenu
|
||||||
function MISSION:SetMenu()
|
function MISSION:SetMenu()
|
||||||
|
|
||||||
for _, Task in pairs( self.Tasks ) do
|
for _, Task in pairs( self.Tasks ) do
|
||||||
local Task = Task -- Tasking.Task#TASK_BASE
|
local Task = Task -- Tasking.Task#TASK_BASE
|
||||||
Task:RemoveMenu()
|
|
||||||
Task:SetMenu()
|
Task:SetMenu()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function MISSION:GetCommandCenter()
|
||||||
|
return self.CommandCenter
|
||||||
|
end
|
||||||
|
|
||||||
--- Sets the Assigned Task menu.
|
--- Sets the Assigned Task menu.
|
||||||
-- @param #MISSION self
|
-- @param #MISSION self
|
||||||
-- @param Task#TASK_BASE Task
|
-- @param Task#TASK_BASE Task
|
||||||
|
|||||||
@ -106,6 +106,11 @@ function TASK_BASE:New( Mission, SetGroupAssign, TaskName, TaskType, TaskCategor
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function TASK_BASE:GetMission()
|
||||||
|
|
||||||
|
return self.Mission
|
||||||
|
end
|
||||||
|
|
||||||
--- Gets the SET_GROUP assigned to the TASK.
|
--- Gets the SET_GROUP assigned to the TASK.
|
||||||
-- @param #TASK_BASE self
|
-- @param #TASK_BASE self
|
||||||
-- @return Core.Set#SET_GROUP
|
-- @return Core.Set#SET_GROUP
|
||||||
@ -142,6 +147,7 @@ function TASK_BASE:AssignToGroup( TaskGroup )
|
|||||||
|
|
||||||
TaskGroup:SetState( TaskGroup, "Assigned", self )
|
TaskGroup:SetState( TaskGroup, "Assigned", self )
|
||||||
|
|
||||||
|
self:RemoveMenuForGroup( TaskGroup )
|
||||||
self:SetAssignedMenuForGroup( TaskGroup )
|
self:SetAssignedMenuForGroup( TaskGroup )
|
||||||
|
|
||||||
local TaskUnits = TaskGroup:GetUnits()
|
local TaskUnits = TaskGroup:GetUnits()
|
||||||
@ -291,8 +297,7 @@ function TASK_BASE:SetMenu()
|
|||||||
|
|
||||||
for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
|
for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
|
||||||
if not self:IsAssignedToGroup( TaskGroup ) then
|
if not self:IsAssignedToGroup( TaskGroup ) then
|
||||||
local MenuText = self:GetPlannedMenuText()
|
self:SetPlannedMenuForGroup( TaskGroup, self:GetTaskName() )
|
||||||
self:SetPlannedMenuForGroup( TaskGroup, MenuText )
|
|
||||||
else
|
else
|
||||||
self:SetAssignedMenuForGroup( TaskGroup )
|
self:SetAssignedMenuForGroup( TaskGroup )
|
||||||
end
|
end
|
||||||
@ -319,37 +324,16 @@ end
|
|||||||
function TASK_BASE:SetPlannedMenuForGroup( TaskGroup, MenuText )
|
function TASK_BASE:SetPlannedMenuForGroup( TaskGroup, MenuText )
|
||||||
self:E( TaskGroup:GetName() )
|
self:E( TaskGroup:GetName() )
|
||||||
|
|
||||||
local TaskMission = self.Mission:GetName()
|
local Mission = self:GetMission()
|
||||||
local TaskCategory = self:GetCategory()
|
local CommandCenter = Mission:GetCommandCenter()
|
||||||
|
local CommandCenterMenu = CommandCenter.CommandCenterMenu
|
||||||
|
|
||||||
|
local MissionName = Mission:GetName()
|
||||||
local TaskType = self:GetType()
|
local TaskType = self:GetType()
|
||||||
|
|
||||||
local Mission = self.Mission
|
local MissionMenu = MENU_GROUP:New( TaskGroup, MissionName, CommandCenterMenu )
|
||||||
|
local TaskTypeMenu = MENU_GROUP:New( TaskGroup, TaskType, MissionMenu )
|
||||||
Mission.MenuMission = Mission.MenuMission or {}
|
local TaskMenu = MENU_GROUP_COMMAND:New( TaskGroup, MenuText, TaskTypeMenu, self.MenuAssignToGroup, { self = self, TaskGroup = TaskGroup } )
|
||||||
local MenuMission = Mission.MenuMission
|
|
||||||
|
|
||||||
Mission.MenuCategory = Mission.MenuCategory or {}
|
|
||||||
local MenuCategory = Mission.MenuCategory
|
|
||||||
|
|
||||||
Mission.MenuType = Mission.MenuType or {}
|
|
||||||
local MenuType = Mission.MenuType
|
|
||||||
|
|
||||||
self.Menu = self.Menu or {}
|
|
||||||
local Menu = self.Menu
|
|
||||||
|
|
||||||
local TaskGroupName = TaskGroup:GetName()
|
|
||||||
MenuMission[TaskGroupName] = MenuMission[TaskGroupName] or MENU_GROUP:New( TaskGroup, TaskMission, nil )
|
|
||||||
|
|
||||||
MenuCategory[TaskGroupName] = MenuCategory[TaskGroupName] or {}
|
|
||||||
MenuCategory[TaskGroupName][TaskCategory] = MenuCategory[TaskGroupName][TaskCategory] or MENU_GROUP:New( TaskGroup, TaskCategory, MenuMission[TaskGroupName] )
|
|
||||||
|
|
||||||
MenuType[TaskGroupName] = MenuType[TaskGroupName] or {}
|
|
||||||
MenuType[TaskGroupName][TaskType] = MenuType[TaskGroupName][TaskType] or MENU_GROUP:New( TaskGroup, TaskType, MenuCategory[TaskGroupName][TaskCategory] )
|
|
||||||
|
|
||||||
if Menu[TaskGroupName] then
|
|
||||||
Menu[TaskGroupName]:Remove()
|
|
||||||
end
|
|
||||||
Menu[TaskGroupName] = MENU_GROUP_COMMAND:New( TaskGroup, MenuText, MenuType[TaskGroupName][TaskType], self.MenuAssignToGroup, { self = self, TaskGroup = TaskGroup } )
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -361,24 +345,17 @@ end
|
|||||||
function TASK_BASE:SetAssignedMenuForGroup( TaskGroup )
|
function TASK_BASE:SetAssignedMenuForGroup( TaskGroup )
|
||||||
self:E( TaskGroup:GetName() )
|
self:E( TaskGroup:GetName() )
|
||||||
|
|
||||||
local TaskMission = self.Mission:GetName()
|
local Mission = self:GetMission()
|
||||||
|
local CommandCenter = Mission:GetCommandCenter()
|
||||||
|
local CommandCenterMenu = CommandCenter.CommandCenterMenu
|
||||||
|
|
||||||
local Mission = self.Mission
|
local MissionName = Mission:GetName()
|
||||||
|
|
||||||
Mission.MenuMission = Mission.MenuMission or {}
|
|
||||||
local MenuMission = Mission.MenuMission
|
|
||||||
|
|
||||||
self.MenuStatus = self.MenuStatus or {}
|
|
||||||
local MenuStatus = self.MenuStatus
|
|
||||||
|
|
||||||
|
|
||||||
self.MenuAbort = self.MenuAbort or {}
|
|
||||||
local MenuAbort = self.MenuAbort
|
|
||||||
|
|
||||||
local TaskGroupName = TaskGroup:GetName()
|
local TaskGroupName = TaskGroup:GetName()
|
||||||
MenuMission[TaskGroupName] = MenuMission[TaskGroupName] or MENU_GROUP:New( TaskGroup, TaskMission, nil )
|
local MissionMenu = MENU_GROUP:New( TaskGroup, MissionName, CommandCenterMenu )
|
||||||
MenuStatus[TaskGroupName] = MENU_GROUP_COMMAND:New( TaskGroup, "Task Status", MenuMission[TaskGroupName], self.MenuTaskStatus, { self = self, TaskGroup = TaskGroup } )
|
self:E( { MissionMenu = MissionMenu } )
|
||||||
MenuAbort[TaskGroupName] = MENU_GROUP_COMMAND:New( TaskGroup, "Abort Task", MenuMission[TaskGroupName], self.MenuTaskAbort, { self = self, TaskGroup = TaskGroup } )
|
local TaskTypeMenu = MENU_GROUP_COMMAND:New( TaskGroup, "Task Status", MissionMenu, self.MenuTaskStatus, { self = self, TaskGroup = TaskGroup } )
|
||||||
|
local TaskMenu = MENU_GROUP_COMMAND:New( TaskGroup, "Abort Task", MissionMenu, self.MenuTaskAbort, { self = self, TaskGroup = TaskGroup } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -389,50 +366,11 @@ end
|
|||||||
-- @return #TASK_BASE self
|
-- @return #TASK_BASE self
|
||||||
function TASK_BASE:RemoveMenuForGroup( TaskGroup )
|
function TASK_BASE:RemoveMenuForGroup( TaskGroup )
|
||||||
|
|
||||||
local TaskGroupName = TaskGroup:GetName()
|
local Mission = self:GetMission()
|
||||||
|
local MissionName = Mission:GetName()
|
||||||
local Mission = self.Mission
|
|
||||||
local MenuMission = Mission.MenuMission
|
|
||||||
local MenuCategory = Mission.MenuCategory
|
|
||||||
local MenuType = Mission.MenuType
|
|
||||||
local MenuStatus = self.MenuStatus
|
|
||||||
local MenuAbort = self.MenuAbort
|
|
||||||
local Menu = self.Menu
|
|
||||||
|
|
||||||
Menu = Menu or {}
|
|
||||||
if Menu[TaskGroupName] then
|
|
||||||
Menu[TaskGroupName]:Remove()
|
|
||||||
Menu[TaskGroupName] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
MenuType = MenuType or {}
|
|
||||||
if MenuType[TaskGroupName] then
|
|
||||||
for _, Menu in pairs( MenuType[TaskGroupName] ) do
|
|
||||||
Menu:Remove()
|
|
||||||
end
|
|
||||||
MenuType[TaskGroupName] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
MenuCategory = MenuCategory or {}
|
|
||||||
if MenuCategory[TaskGroupName] then
|
|
||||||
for _, Menu in pairs( MenuCategory[TaskGroupName] ) do
|
|
||||||
Menu:Remove()
|
|
||||||
end
|
|
||||||
MenuCategory[TaskGroupName] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
MenuStatus = MenuStatus or {}
|
|
||||||
if MenuStatus[TaskGroupName] then
|
|
||||||
MenuStatus[TaskGroupName]:Remove()
|
|
||||||
MenuStatus[TaskGroupName] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
MenuAbort = MenuAbort or {}
|
|
||||||
if MenuAbort[TaskGroupName] then
|
|
||||||
MenuAbort[TaskGroupName]:Remove()
|
|
||||||
MenuAbort[TaskGroupName] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
|
local MissionMenu = MENU_GROUP:New( TaskGroup, MissionName )
|
||||||
|
MissionMenu:Remove()
|
||||||
end
|
end
|
||||||
|
|
||||||
function TASK_BASE.MenuAssignToGroup( MenuParam )
|
function TASK_BASE.MenuAssignToGroup( MenuParam )
|
||||||
@ -830,6 +768,7 @@ function TASK_BASE:onenterAssigned( Event, From, To )
|
|||||||
|
|
||||||
self:E("Assigned")
|
self:E("Assigned")
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -46,3 +46,5 @@ function FsmSEAD:onenterUpdated( TaskUnit )
|
|||||||
end
|
end
|
||||||
|
|
||||||
Mission:AddTask( TaskSEAD )
|
Mission:AddTask( TaskSEAD )
|
||||||
|
|
||||||
|
HQ:SetMenu()
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user