From 520ee6e459566c752212e5d45493d0897377af84 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Wed, 15 Mar 2017 11:49:47 +0100 Subject: [PATCH] Updated Mission, cleaned it up and removed stuff. --- Moose Development/Moose/Tasking/Mission.lua | 532 +---- .../l10n/DEFAULT/Moose.lua | 534 +---- Moose Mission Setup/Moose.lua | 534 +---- docs/Documentation/AI_Cap.html | 27 + docs/Documentation/AI_Cas.html | 141 +- docs/Documentation/Account.html | 19 - docs/Documentation/Base.html | 3 + docs/Documentation/Cargo.html | 1 + docs/Documentation/Detection.html | 1090 ++++----- docs/Documentation/Fsm.html | 24 + docs/Documentation/Group.html | 4 +- docs/Documentation/MOVEMENT.html | 4 - docs/Documentation/Mission.html | 1955 ++++++++--------- docs/Documentation/ScheduleDispatcher.html | 2 +- docs/Documentation/Spawn.html | 8 +- docs/Documentation/Task.html | 86 +- docs/Documentation/Task_A2G_Dispatcher.html | 14 +- docs/Documentation/Unit.html | 24 + 18 files changed, 1679 insertions(+), 3323 deletions(-) diff --git a/Moose Development/Moose/Tasking/Mission.lua b/Moose Development/Moose/Tasking/Mission.lua index 2d312f677..76337b0ee 100644 --- a/Moose Development/Moose/Tasking/Mission.lua +++ b/Moose Development/Moose/Tasking/Mission.lua @@ -12,22 +12,6 @@ MISSION = { ClassName = "MISSION", Name = "", MissionStatus = "PENDING", - _Clients = {}, - TaskMenus = {}, - TaskCategoryMenus = {}, - TaskTypeMenus = {}, - _ActiveTasks = {}, - GoalFunction = nil, - MissionReportTrigger = 0, - MissionProgressTrigger = 0, - MissionReportShow = false, - MissionReportFlash = false, - MissionTimeInterval = 0, - MissionCoalition = "", - SUCCESS = 1, - FAILED = 2, - REPEAT = 3, - _GoalTasks = {} } --- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc. @@ -234,6 +218,10 @@ function MISSION:New( CommandCenter, MissionName, MissionPriority, MissionBriefi self.MissionCoalition = MissionCoalition self.Tasks = {} + + -- Private implementations + + return self end @@ -524,76 +512,44 @@ function MISSION:GetNextTaskID( Task ) return self.Tasks[TaskName].n end - - ---- old stuff - ---- Returns if a Mission has completed. --- @return bool +--- Is the @{Mission} **Completed**. +-- @param #MISSION self +-- @return #boolean function MISSION:IsCompleted() - self:F() - return self.MissionStatus == "ACCOMPLISHED" + return self:Is( "Completed" ) end ---- Set a Mission to completed. -function MISSION:Completed() - self:F() - self.MissionStatus = "ACCOMPLISHED" - self:StatusToClients() +--- Is the @{Mission} **Idle**. +-- @param #MISSION self +-- @return #boolean +function MISSION:IsIdle() + return self:Is( "Idle" ) end ---- Returns if a Mission is ongoing. --- treturn bool +--- Is the @{Mission} **Ongoing**. +-- @param #MISSION self +-- @return #boolean function MISSION:IsOngoing() - self:F() - return self.MissionStatus == "ONGOING" + return self:Is( "Ongoing" ) end ---- Set a Mission to ongoing. -function MISSION:Ongoing() - self:F() - self.MissionStatus = "ONGOING" - --self:StatusToClients() +--- Is the @{Mission} **Failed**. +-- @param #MISSION self +-- @return #boolean +function MISSION:IsFailed() + return self:Is( "Failed" ) end ---- Returns if a Mission is pending. --- treturn bool -function MISSION:IsPending() - self:F() - return self.MissionStatus == "PENDING" -end - ---- Set a Mission to pending. -function MISSION:Pending() - self:F() - self.MissionStatus = "PENDING" - self:StatusToClients() -end - ---- Returns if a Mission has failed. --- treturn bool -function MISSION:IsFailed() - self:F() - return self.MissionStatus == "FAILED" -end - ---- Set a Mission to failed. -function MISSION:Failed() - self:F() - self.MissionStatus = "FAILED" - self:StatusToClients() -end - ---- Send the status of the MISSION to all Clients. -function MISSION:StatusToClients() - self:F() - if self.MissionReportFlash then - for ClientID, Client in pairs( self._Clients ) do - Client:Message( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. '! ( ' .. self.MissionPriority .. ' mission ) ', 10, "Mission Command: Mission Status") - end - end +--- Is the @{Mission} **Hold**. +-- @param #MISSION self +-- @return #boolean +function MISSION:IsHold() + return self:Is( "Hold" ) end +--- Validates if the Mission has a Group +-- @param #MISSION +-- @return #boolean true if the Mission has a Group. function MISSION:HasGroup( TaskGroup ) local Has = false @@ -686,107 +642,6 @@ function MISSION:ReportDetails() return Report:Text() end ---- Report the status of all MISSIONs to all active Clients. -function MISSION:ReportToAll() - self:F() - - local AlivePlayers = '' - for ClientID, Client in pairs( self._Clients ) do - if Client:GetDCSGroup() then - if Client:GetClientGroupDCSUnit() then - if Client:GetClientGroupDCSUnit():getLife() > 0.0 then - if AlivePlayers == '' then - AlivePlayers = ' Players: ' .. Client:GetClientGroupDCSUnit():getPlayerName() - else - AlivePlayers = AlivePlayers .. ' / ' .. Client:GetClientGroupDCSUnit():getPlayerName() - end - end - end - end - end - local Tasks = self:GetTasks() - local TaskText = "" - for TaskID, TaskData in pairs( Tasks ) do - TaskText = TaskText .. " - Task " .. TaskID .. ": " .. TaskData.Name .. ": " .. TaskData:GetGoalProgress() .. "\n" - end - MESSAGE:New( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. ' ( ' .. self.MissionPriority .. ' mission )' .. AlivePlayers .. "\n" .. TaskText:gsub("\n$",""), 10, "Mission Command: Mission Report" ):ToAll() -end - - ---- Add a goal function to a MISSION. Goal functions are called when a @{TASK} within a mission has been completed. --- @param function GoalFunction is the function defined by the mission designer to evaluate whether a certain goal has been reached after a @{TASK} finishes within the @{MISSION}. A GoalFunction must accept 2 parameters: Mission, Client, which contains the current MISSION object and the current CLIENT object respectively. --- @usage --- PatriotActivation = { --- { "US SAM Patriot Zerti", false }, --- { "US SAM Patriot Zegduleti", false }, --- { "US SAM Patriot Gvleti", false } --- } --- --- function DeployPatriotTroopsGoal( Mission, Client ) --- --- --- -- Check if the cargo is all deployed for mission success. --- for CargoID, CargoData in pairs( Mission._Cargos ) do --- if Group.getByName( CargoData.CargoGroupName ) then --- CargoGroup = Group.getByName( CargoData.CargoGroupName ) --- if CargoGroup then --- -- Check if the cargo is ready to activate --- CurrentLandingZoneID = routines.IsUnitInZones( CargoGroup:getUnits()[1], Mission:GetTask( 2 ).LandingZones ) -- The second task is the Deploytask to measure mission success upon --- if CurrentLandingZoneID then --- if PatriotActivation[CurrentLandingZoneID][2] == false then --- -- Now check if this is a new Mission Task to be completed... --- trigger.action.setGroupAIOn( Group.getByName( PatriotActivation[CurrentLandingZoneID][1] ) ) --- PatriotActivation[CurrentLandingZoneID][2] = true --- MessageToBlue( "Mission Command: Message to all airborne units! The " .. PatriotActivation[CurrentLandingZoneID][1] .. " is armed. Our air defenses are now stronger.", 60, "BLUE/PatriotDefense" ) --- MessageToRed( "Mission Command: Our satellite systems are detecting additional NATO air defenses. To all airborne units: Take care!!!", 60, "RED/PatriotDefense" ) --- Mission:GetTask( 2 ):AddGoalCompletion( "Patriots activated", PatriotActivation[CurrentLandingZoneID][1], 1 ) -- Register Patriot activation as part of mission goal. --- end --- end --- end --- end --- end --- end --- --- local Mission = MISSIONSCHEDULER.AddMission( 'NATO Transport Troops', 'Operational', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.', 'NATO' ) --- Mission:AddGoalFunction( DeployPatriotTroopsGoal ) -function MISSION:AddGoalFunction( GoalFunction ) - self:F() - self.GoalFunction = GoalFunction -end - ---- Register a new @{CLIENT} to participate within the mission. --- @param CLIENT Client is the @{CLIENT} object. The object must have been instantiated with @{CLIENT:New}. --- @return CLIENT --- @usage --- Add a number of Client objects to the Mission. --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*HOT-Deploy Troops 1', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*RAMP-Deploy Troops 3', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*HOT-Deploy Troops 2', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*RAMP-Deploy Troops 4', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) -function MISSION:AddClient( Client ) - self:F( { Client } ) - - local Valid = true - - if Valid then - self._Clients[Client.ClientName] = Client - end - - return Client -end - ---- Find a @{CLIENT} object within the @{MISSION} by its ClientName. --- @param CLIENT ClientName is a string defining the Client Group as defined within the ME. --- @return CLIENT --- @usage --- -- Seach for Client "Bomber" within the Mission. --- local BomberClient = Mission:FindClient( "Bomber" ) -function MISSION:FindClient( ClientName ) - self:F( { self._Clients[ClientName] } ) - return self._Clients[ClientName] -end - - --- Get all the TASKs from the Mission. This function is useful in GoalFunctions. -- @return {TASK,...} Structure of TASKS with the @{TASK} number as the key. -- @usage @@ -800,330 +655,3 @@ function MISSION:GetTasks() end ---[[ - _TransportExecuteStage: Defines the different stages of Transport unload/load execution. This table is internal and is used to control the validity of Transport load/unload timing. - - - _TransportExecuteStage.EXECUTING - - _TransportExecuteStage.SUCCESS - - _TransportExecuteStage.FAILED - ---]] -_TransportExecuteStage = { - NONE = 0, - EXECUTING = 1, - SUCCESS = 2, - FAILED = 3 -} - - ---- The MISSIONSCHEDULER is an OBJECT and is the main scheduler of ALL active MISSIONs registered within this scheduler. It's workings are considered internal and is automatically created when the Mission.lua file is included. --- @type MISSIONSCHEDULER --- @field #MISSIONSCHEDULER.MISSIONS Missions -MISSIONSCHEDULER = { - Missions = {}, - MissionCount = 0, - TimeIntervalCount = 0, - TimeIntervalShow = 150, - TimeSeconds = 14400, - TimeShow = 5 -} - ---- @type MISSIONSCHEDULER.MISSIONS --- @list <#MISSION> Mission - ---- This is the main MISSIONSCHEDULER Scheduler function. It is considered internal and is automatically created when the Mission.lua file is included. -function MISSIONSCHEDULER.Scheduler() - - - -- loop through the missions in the TransportTasks - for MissionName, MissionData in pairs( MISSIONSCHEDULER.Missions ) do - - local Mission = MissionData -- #MISSION - - if not Mission:IsCompleted() then - - -- This flag will monitor if for this mission, there are clients alive. If this flag is still false at the end of the loop, the mission status will be set to Pending (if not Failed or Completed). - local ClientsAlive = false - - for ClientID, ClientData in pairs( Mission._Clients ) do - - local Client = ClientData -- Wrapper.Client#CLIENT - - if Client:IsAlive() then - - -- There is at least one Client that is alive... So the Mission status is set to Ongoing. - ClientsAlive = true - - -- If this Client was not registered as Alive before: - -- 1. We register the Client as Alive. - -- 2. We initialize the Client Tasks and make a link to the original Mission Task. - -- 3. We initialize the Cargos. - -- 4. We flag the Mission as Ongoing. - if not Client.ClientAlive then - Client.ClientAlive = true - Client.ClientBriefingShown = false - for TaskNumber, Task in pairs( Mission._Tasks ) do - -- Note that this a deepCopy. Each client must have their own Tasks with own Stages!!! - Client._Tasks[TaskNumber] = routines.utils.deepCopy( Mission._Tasks[TaskNumber] ) - -- Each MissionTask must point to the original Mission. - Client._Tasks[TaskNumber].MissionTask = Mission._Tasks[TaskNumber] - Client._Tasks[TaskNumber].Cargos = Mission._Tasks[TaskNumber].Cargos - Client._Tasks[TaskNumber].LandingZones = Mission._Tasks[TaskNumber].LandingZones - end - - Mission:Ongoing() - end - - - -- For each Client, check for each Task the state and evolve the mission. - -- This flag will indicate if the Task of the Client is Complete. - local TaskComplete = false - - for TaskNumber, Task in pairs( Client._Tasks ) do - - if not Task.Stage then - Task:SetStage( 1 ) - end - - - local TransportTime = timer.getTime() - - if not Task:IsDone() then - - if Task:Goal() then - Task:ShowGoalProgress( Mission, Client ) - end - - --env.info( 'Scheduler: Mission = ' .. Mission.Name .. ' / Client = ' .. Client.ClientName .. ' / Task = ' .. Task.Name .. ' / Stage = ' .. Task.ActiveStage .. ' - ' .. Task.Stage.Name .. ' - ' .. Task.Stage.StageType ) - - -- Action - if Task:StageExecute() then - Task.Stage:Execute( Mission, Client, Task ) - end - - -- Wait until execution is finished - if Task.ExecuteStage == _TransportExecuteStage.EXECUTING then - Task.Stage:Executing( Mission, Client, Task ) - end - - -- Validate completion or reverse to earlier stage - if Task.Time + Task.Stage.WaitTime <= TransportTime then - Task:SetStage( Task.Stage:Validate( Mission, Client, Task ) ) - end - - if Task:IsDone() then - --env.info( 'Scheduler: Mission '.. Mission.Name .. ' Task ' .. Task.Name .. ' Stage ' .. Task.Stage.Name .. ' done. TaskComplete = ' .. string.format ( "%s", TaskComplete and "true" or "false" ) ) - TaskComplete = true -- when a task is not yet completed, a mission cannot be completed - - else - -- break only if this task is not yet done, so that future task are not yet activated. - TaskComplete = false -- when a task is not yet completed, a mission cannot be completed - --env.info( 'Scheduler: Mission "'.. Mission.Name .. '" Task "' .. Task.Name .. '" Stage "' .. Task.Stage.Name .. '" break. TaskComplete = ' .. string.format ( "%s", TaskComplete and "true" or "false" ) ) - break - end - - if TaskComplete then - - if Mission.GoalFunction ~= nil then - Mission.GoalFunction( Mission, Client ) - end - if MISSIONSCHEDULER.Scoring then - MISSIONSCHEDULER.Scoring:_AddMissionTaskScore( Client:GetClientGroupDCSUnit(), Mission.Name, 25 ) - end - --- if not Mission:IsCompleted() then --- end - end - end - end - - local MissionComplete = true - for TaskNumber, Task in pairs( Mission._Tasks ) do - if Task:Goal() then --- Task:ShowGoalProgress( Mission, Client ) - if Task:IsGoalReached() then - else - MissionComplete = false - end - else - MissionComplete = false -- If there is no goal, the mission should never be ended. The goal status will be set somewhere else. - end - end - - if MissionComplete then - Mission:Completed() - if MISSIONSCHEDULER.Scoring then - MISSIONSCHEDULER.Scoring:_AddMissionScore( Mission.Name, 100 ) - end - else - if TaskComplete then - -- Reset for new tasking of active client - Client.ClientAlive = false -- Reset the client tasks. - end - end - - - else - if Client.ClientAlive then - env.info( 'Scheduler: Client "' .. Client.ClientName .. '" is inactive.' ) - Client.ClientAlive = false - - -- This is tricky. If we sanitize Client._Tasks before sanitizing Client._Tasks[TaskNumber].MissionTask, then the original MissionTask will be sanitized, and will be lost within the garbage collector. - -- So first sanitize Client._Tasks[TaskNumber].MissionTask, after that, sanitize only the whole _Tasks structure... - --Client._Tasks[TaskNumber].MissionTask = nil - --Client._Tasks = nil - end - end - end - - -- If all Clients of this Mission are not activated, then the Mission status needs to be put back into Pending status. - -- But only if the Mission was Ongoing. In case the Mission is Completed or Failed, the Mission status may not be changed. In these cases, this will be the last run of this Mission in the Scheduler. - if ClientsAlive == false then - if Mission:IsOngoing() then - -- Mission status back to pending... - Mission:Pending() - end - end - end - - Mission:StatusToClients() - - if Mission:ReportTrigger() then - Mission:ReportToAll() - end - end - - return true -end - ---- Start the MISSIONSCHEDULER. -function MISSIONSCHEDULER.Start() - if MISSIONSCHEDULER ~= nil then - --MISSIONSCHEDULER.SchedulerId = routines.scheduleFunction( MISSIONSCHEDULER.Scheduler, { }, 0, 2 ) - MISSIONSCHEDULER.SchedulerId = SCHEDULER:New( nil, MISSIONSCHEDULER.Scheduler, { }, 0, 2 ) - end -end - ---- Stop the MISSIONSCHEDULER. -function MISSIONSCHEDULER.Stop() - if MISSIONSCHEDULER.SchedulerId then - routines.removeFunction(MISSIONSCHEDULER.SchedulerId) - MISSIONSCHEDULER.SchedulerId = nil - end -end - ---- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc. --- @param Mission is the MISSION object instantiated by @{MISSION:New}. --- @return MISSION --- @usage --- -- Declare a mission. --- Mission = MISSION:New( 'Russia Transport Troops SA-6', --- 'Operational', --- 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', --- 'Russia' ) --- MISSIONSCHEDULER:AddMission( Mission ) -function MISSIONSCHEDULER.AddMission( Mission ) - MISSIONSCHEDULER.Missions[Mission.Name] = Mission - MISSIONSCHEDULER.MissionCount = MISSIONSCHEDULER.MissionCount + 1 - -- Add an overall AI Client for the AI tasks... This AI Client will facilitate the Events in the background for each Task. - --MissionAdd:AddClient( CLIENT:Register( 'AI' ) ) - - return Mission -end - ---- Remove a MISSION from the MISSIONSCHEDULER. --- @param MissionName is the name of the MISSION given at declaration using @{AddMission}. --- @usage --- -- Declare a mission. --- Mission = MISSION:New( 'Russia Transport Troops SA-6', --- 'Operational', --- 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', --- 'Russia' ) --- MISSIONSCHEDULER:AddMission( Mission ) --- --- -- Now remove the Mission. --- MISSIONSCHEDULER:RemoveMission( 'Russia Transport Troops SA-6' ) -function MISSIONSCHEDULER.RemoveMission( MissionName ) - MISSIONSCHEDULER.Missions[MissionName] = nil - MISSIONSCHEDULER.MissionCount = MISSIONSCHEDULER.MissionCount - 1 -end - ---- Find a MISSION within the MISSIONSCHEDULER. --- @param MissionName is the name of the MISSION given at declaration using @{AddMission}. --- @return MISSION --- @usage --- -- Declare a mission. --- Mission = MISSION:New( 'Russia Transport Troops SA-6', --- 'Operational', --- 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', --- 'Russia' ) --- MISSIONSCHEDULER:AddMission( Mission ) --- --- -- Now find the Mission. --- MissionFind = MISSIONSCHEDULER:FindMission( 'Russia Transport Troops SA-6' ) -function MISSIONSCHEDULER.FindMission( MissionName ) - return MISSIONSCHEDULER.Missions[MissionName] -end - --- Internal function used by the MISSIONSCHEDULER menu. -function MISSIONSCHEDULER.ReportMissionsShow( ) - for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do - Mission.MissionReportShow = true - Mission.MissionReportFlash = false - end -end - --- Internal function used by the MISSIONSCHEDULER menu. -function MISSIONSCHEDULER.ReportMissionsFlash( TimeInterval ) - local Count = 0 - for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do - Mission.MissionReportShow = false - Mission.MissionReportFlash = true - Mission.MissionReportTrigger = timer.getTime() + Count * TimeInterval - Mission.MissionTimeInterval = MISSIONSCHEDULER.MissionCount * TimeInterval - env.info( "TimeInterval = " .. Mission.MissionTimeInterval ) - Count = Count + 1 - end -end - --- Internal function used by the MISSIONSCHEDULER menu. -function MISSIONSCHEDULER.ReportMissionsHide( Prm ) - for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do - Mission.MissionReportShow = false - Mission.MissionReportFlash = false - end -end - ---- Enables a MENU option in the communications menu under F10 to control the status of the active missions. --- This function should be called only once when starting the MISSIONSCHEDULER. -function MISSIONSCHEDULER.ReportMenu() - local ReportMenu = SUBMENU:New( 'Status' ) - local ReportMenuShow = COMMANDMENU:New( 'Show Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsShow, 0 ) - local ReportMenuFlash = COMMANDMENU:New('Flash Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsFlash, 120 ) - local ReportMenuHide = COMMANDMENU:New( 'Hide Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsHide, 0 ) -end - ---- Show the remaining mission time. -function MISSIONSCHEDULER:TimeShow() - self.TimeIntervalCount = self.TimeIntervalCount + 1 - if self.TimeIntervalCount >= self.TimeTriggerShow then - local TimeMsg = string.format("%00d", ( self.TimeSeconds / 60 ) - ( timer.getTime() / 60 )) .. ' minutes left until mission reload.' - MESSAGE:New( TimeMsg, self.TimeShow, "Mission time" ):ToAll() - self.TimeIntervalCount = 0 - end -end - -function MISSIONSCHEDULER:Time( TimeSeconds, TimeIntervalShow, TimeShow ) - - self.TimeIntervalCount = 0 - self.TimeSeconds = TimeSeconds - self.TimeIntervalShow = TimeIntervalShow - self.TimeShow = TimeShow -end - ---- Adds a mission scoring to the game. -function MISSIONSCHEDULER:Scoring( Scoring ) - - self.Scoring = Scoring -end - diff --git a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua index a39115980..a9cb94b4a 100644 --- a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua +++ b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20170315_1007' ) +env.info( 'Moose Generation Timestamp: 20170315_1149' ) local base = _G Include = {} @@ -32319,22 +32319,6 @@ MISSION = { ClassName = "MISSION", Name = "", MissionStatus = "PENDING", - _Clients = {}, - TaskMenus = {}, - TaskCategoryMenus = {}, - TaskTypeMenus = {}, - _ActiveTasks = {}, - GoalFunction = nil, - MissionReportTrigger = 0, - MissionProgressTrigger = 0, - MissionReportShow = false, - MissionReportFlash = false, - MissionTimeInterval = 0, - MissionCoalition = "", - SUCCESS = 1, - FAILED = 2, - REPEAT = 3, - _GoalTasks = {} } --- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc. @@ -32541,6 +32525,10 @@ function MISSION:New( CommandCenter, MissionName, MissionPriority, MissionBriefi self.MissionCoalition = MissionCoalition self.Tasks = {} + + -- Private implementations + + return self end @@ -32831,76 +32819,44 @@ function MISSION:GetNextTaskID( Task ) return self.Tasks[TaskName].n end - - ---- old stuff - ---- Returns if a Mission has completed. --- @return bool +--- Is the @{Mission} **Completed**. +-- @param #MISSION self +-- @return #boolean function MISSION:IsCompleted() - self:F() - return self.MissionStatus == "ACCOMPLISHED" + return self:Is( "Completed" ) end ---- Set a Mission to completed. -function MISSION:Completed() - self:F() - self.MissionStatus = "ACCOMPLISHED" - self:StatusToClients() +--- Is the @{Mission} **Idle**. +-- @param #MISSION self +-- @return #boolean +function MISSION:IsIdle() + return self:Is( "Idle" ) end ---- Returns if a Mission is ongoing. --- treturn bool +--- Is the @{Mission} **Ongoing**. +-- @param #MISSION self +-- @return #boolean function MISSION:IsOngoing() - self:F() - return self.MissionStatus == "ONGOING" + return self:Is( "Ongoing" ) end ---- Set a Mission to ongoing. -function MISSION:Ongoing() - self:F() - self.MissionStatus = "ONGOING" - --self:StatusToClients() +--- Is the @{Mission} **Failed**. +-- @param #MISSION self +-- @return #boolean +function MISSION:IsFailed() + return self:Is( "Failed" ) end ---- Returns if a Mission is pending. --- treturn bool -function MISSION:IsPending() - self:F() - return self.MissionStatus == "PENDING" -end - ---- Set a Mission to pending. -function MISSION:Pending() - self:F() - self.MissionStatus = "PENDING" - self:StatusToClients() -end - ---- Returns if a Mission has failed. --- treturn bool -function MISSION:IsFailed() - self:F() - return self.MissionStatus == "FAILED" -end - ---- Set a Mission to failed. -function MISSION:Failed() - self:F() - self.MissionStatus = "FAILED" - self:StatusToClients() -end - ---- Send the status of the MISSION to all Clients. -function MISSION:StatusToClients() - self:F() - if self.MissionReportFlash then - for ClientID, Client in pairs( self._Clients ) do - Client:Message( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. '! ( ' .. self.MissionPriority .. ' mission ) ', 10, "Mission Command: Mission Status") - end - end +--- Is the @{Mission} **Hold**. +-- @param #MISSION self +-- @return #boolean +function MISSION:IsHold() + return self:Is( "Hold" ) end +--- Validates if the Mission has a Group +-- @param #MISSION +-- @return #boolean true if the Mission has a Group. function MISSION:HasGroup( TaskGroup ) local Has = false @@ -32993,107 +32949,6 @@ function MISSION:ReportDetails() return Report:Text() end ---- Report the status of all MISSIONs to all active Clients. -function MISSION:ReportToAll() - self:F() - - local AlivePlayers = '' - for ClientID, Client in pairs( self._Clients ) do - if Client:GetDCSGroup() then - if Client:GetClientGroupDCSUnit() then - if Client:GetClientGroupDCSUnit():getLife() > 0.0 then - if AlivePlayers == '' then - AlivePlayers = ' Players: ' .. Client:GetClientGroupDCSUnit():getPlayerName() - else - AlivePlayers = AlivePlayers .. ' / ' .. Client:GetClientGroupDCSUnit():getPlayerName() - end - end - end - end - end - local Tasks = self:GetTasks() - local TaskText = "" - for TaskID, TaskData in pairs( Tasks ) do - TaskText = TaskText .. " - Task " .. TaskID .. ": " .. TaskData.Name .. ": " .. TaskData:GetGoalProgress() .. "\n" - end - MESSAGE:New( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. ' ( ' .. self.MissionPriority .. ' mission )' .. AlivePlayers .. "\n" .. TaskText:gsub("\n$",""), 10, "Mission Command: Mission Report" ):ToAll() -end - - ---- Add a goal function to a MISSION. Goal functions are called when a @{TASK} within a mission has been completed. --- @param function GoalFunction is the function defined by the mission designer to evaluate whether a certain goal has been reached after a @{TASK} finishes within the @{MISSION}. A GoalFunction must accept 2 parameters: Mission, Client, which contains the current MISSION object and the current CLIENT object respectively. --- @usage --- PatriotActivation = { --- { "US SAM Patriot Zerti", false }, --- { "US SAM Patriot Zegduleti", false }, --- { "US SAM Patriot Gvleti", false } --- } --- --- function DeployPatriotTroopsGoal( Mission, Client ) --- --- --- -- Check if the cargo is all deployed for mission success. --- for CargoID, CargoData in pairs( Mission._Cargos ) do --- if Group.getByName( CargoData.CargoGroupName ) then --- CargoGroup = Group.getByName( CargoData.CargoGroupName ) --- if CargoGroup then --- -- Check if the cargo is ready to activate --- CurrentLandingZoneID = routines.IsUnitInZones( CargoGroup:getUnits()[1], Mission:GetTask( 2 ).LandingZones ) -- The second task is the Deploytask to measure mission success upon --- if CurrentLandingZoneID then --- if PatriotActivation[CurrentLandingZoneID][2] == false then --- -- Now check if this is a new Mission Task to be completed... --- trigger.action.setGroupAIOn( Group.getByName( PatriotActivation[CurrentLandingZoneID][1] ) ) --- PatriotActivation[CurrentLandingZoneID][2] = true --- MessageToBlue( "Mission Command: Message to all airborne units! The " .. PatriotActivation[CurrentLandingZoneID][1] .. " is armed. Our air defenses are now stronger.", 60, "BLUE/PatriotDefense" ) --- MessageToRed( "Mission Command: Our satellite systems are detecting additional NATO air defenses. To all airborne units: Take care!!!", 60, "RED/PatriotDefense" ) --- Mission:GetTask( 2 ):AddGoalCompletion( "Patriots activated", PatriotActivation[CurrentLandingZoneID][1], 1 ) -- Register Patriot activation as part of mission goal. --- end --- end --- end --- end --- end --- end --- --- local Mission = MISSIONSCHEDULER.AddMission( 'NATO Transport Troops', 'Operational', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.', 'NATO' ) --- Mission:AddGoalFunction( DeployPatriotTroopsGoal ) -function MISSION:AddGoalFunction( GoalFunction ) - self:F() - self.GoalFunction = GoalFunction -end - ---- Register a new @{CLIENT} to participate within the mission. --- @param CLIENT Client is the @{CLIENT} object. The object must have been instantiated with @{CLIENT:New}. --- @return CLIENT --- @usage --- Add a number of Client objects to the Mission. --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*HOT-Deploy Troops 1', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*RAMP-Deploy Troops 3', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*HOT-Deploy Troops 2', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*RAMP-Deploy Troops 4', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) -function MISSION:AddClient( Client ) - self:F( { Client } ) - - local Valid = true - - if Valid then - self._Clients[Client.ClientName] = Client - end - - return Client -end - ---- Find a @{CLIENT} object within the @{MISSION} by its ClientName. --- @param CLIENT ClientName is a string defining the Client Group as defined within the ME. --- @return CLIENT --- @usage --- -- Seach for Client "Bomber" within the Mission. --- local BomberClient = Mission:FindClient( "Bomber" ) -function MISSION:FindClient( ClientName ) - self:F( { self._Clients[ClientName] } ) - return self._Clients[ClientName] -end - - --- Get all the TASKs from the Mission. This function is useful in GoalFunctions. -- @return {TASK,...} Structure of TASKS with the @{TASK} number as the key. -- @usage @@ -33107,333 +32962,6 @@ function MISSION:GetTasks() end ---[[ - _TransportExecuteStage: Defines the different stages of Transport unload/load execution. This table is internal and is used to control the validity of Transport load/unload timing. - - - _TransportExecuteStage.EXECUTING - - _TransportExecuteStage.SUCCESS - - _TransportExecuteStage.FAILED - ---]] -_TransportExecuteStage = { - NONE = 0, - EXECUTING = 1, - SUCCESS = 2, - FAILED = 3 -} - - ---- The MISSIONSCHEDULER is an OBJECT and is the main scheduler of ALL active MISSIONs registered within this scheduler. It's workings are considered internal and is automatically created when the Mission.lua file is included. --- @type MISSIONSCHEDULER --- @field #MISSIONSCHEDULER.MISSIONS Missions -MISSIONSCHEDULER = { - Missions = {}, - MissionCount = 0, - TimeIntervalCount = 0, - TimeIntervalShow = 150, - TimeSeconds = 14400, - TimeShow = 5 -} - ---- @type MISSIONSCHEDULER.MISSIONS --- @list <#MISSION> Mission - ---- This is the main MISSIONSCHEDULER Scheduler function. It is considered internal and is automatically created when the Mission.lua file is included. -function MISSIONSCHEDULER.Scheduler() - - - -- loop through the missions in the TransportTasks - for MissionName, MissionData in pairs( MISSIONSCHEDULER.Missions ) do - - local Mission = MissionData -- #MISSION - - if not Mission:IsCompleted() then - - -- This flag will monitor if for this mission, there are clients alive. If this flag is still false at the end of the loop, the mission status will be set to Pending (if not Failed or Completed). - local ClientsAlive = false - - for ClientID, ClientData in pairs( Mission._Clients ) do - - local Client = ClientData -- Wrapper.Client#CLIENT - - if Client:IsAlive() then - - -- There is at least one Client that is alive... So the Mission status is set to Ongoing. - ClientsAlive = true - - -- If this Client was not registered as Alive before: - -- 1. We register the Client as Alive. - -- 2. We initialize the Client Tasks and make a link to the original Mission Task. - -- 3. We initialize the Cargos. - -- 4. We flag the Mission as Ongoing. - if not Client.ClientAlive then - Client.ClientAlive = true - Client.ClientBriefingShown = false - for TaskNumber, Task in pairs( Mission._Tasks ) do - -- Note that this a deepCopy. Each client must have their own Tasks with own Stages!!! - Client._Tasks[TaskNumber] = routines.utils.deepCopy( Mission._Tasks[TaskNumber] ) - -- Each MissionTask must point to the original Mission. - Client._Tasks[TaskNumber].MissionTask = Mission._Tasks[TaskNumber] - Client._Tasks[TaskNumber].Cargos = Mission._Tasks[TaskNumber].Cargos - Client._Tasks[TaskNumber].LandingZones = Mission._Tasks[TaskNumber].LandingZones - end - - Mission:Ongoing() - end - - - -- For each Client, check for each Task the state and evolve the mission. - -- This flag will indicate if the Task of the Client is Complete. - local TaskComplete = false - - for TaskNumber, Task in pairs( Client._Tasks ) do - - if not Task.Stage then - Task:SetStage( 1 ) - end - - - local TransportTime = timer.getTime() - - if not Task:IsDone() then - - if Task:Goal() then - Task:ShowGoalProgress( Mission, Client ) - end - - --env.info( 'Scheduler: Mission = ' .. Mission.Name .. ' / Client = ' .. Client.ClientName .. ' / Task = ' .. Task.Name .. ' / Stage = ' .. Task.ActiveStage .. ' - ' .. Task.Stage.Name .. ' - ' .. Task.Stage.StageType ) - - -- Action - if Task:StageExecute() then - Task.Stage:Execute( Mission, Client, Task ) - end - - -- Wait until execution is finished - if Task.ExecuteStage == _TransportExecuteStage.EXECUTING then - Task.Stage:Executing( Mission, Client, Task ) - end - - -- Validate completion or reverse to earlier stage - if Task.Time + Task.Stage.WaitTime <= TransportTime then - Task:SetStage( Task.Stage:Validate( Mission, Client, Task ) ) - end - - if Task:IsDone() then - --env.info( 'Scheduler: Mission '.. Mission.Name .. ' Task ' .. Task.Name .. ' Stage ' .. Task.Stage.Name .. ' done. TaskComplete = ' .. string.format ( "%s", TaskComplete and "true" or "false" ) ) - TaskComplete = true -- when a task is not yet completed, a mission cannot be completed - - else - -- break only if this task is not yet done, so that future task are not yet activated. - TaskComplete = false -- when a task is not yet completed, a mission cannot be completed - --env.info( 'Scheduler: Mission "'.. Mission.Name .. '" Task "' .. Task.Name .. '" Stage "' .. Task.Stage.Name .. '" break. TaskComplete = ' .. string.format ( "%s", TaskComplete and "true" or "false" ) ) - break - end - - if TaskComplete then - - if Mission.GoalFunction ~= nil then - Mission.GoalFunction( Mission, Client ) - end - if MISSIONSCHEDULER.Scoring then - MISSIONSCHEDULER.Scoring:_AddMissionTaskScore( Client:GetClientGroupDCSUnit(), Mission.Name, 25 ) - end - --- if not Mission:IsCompleted() then --- end - end - end - end - - local MissionComplete = true - for TaskNumber, Task in pairs( Mission._Tasks ) do - if Task:Goal() then --- Task:ShowGoalProgress( Mission, Client ) - if Task:IsGoalReached() then - else - MissionComplete = false - end - else - MissionComplete = false -- If there is no goal, the mission should never be ended. The goal status will be set somewhere else. - end - end - - if MissionComplete then - Mission:Completed() - if MISSIONSCHEDULER.Scoring then - MISSIONSCHEDULER.Scoring:_AddMissionScore( Mission.Name, 100 ) - end - else - if TaskComplete then - -- Reset for new tasking of active client - Client.ClientAlive = false -- Reset the client tasks. - end - end - - - else - if Client.ClientAlive then - env.info( 'Scheduler: Client "' .. Client.ClientName .. '" is inactive.' ) - Client.ClientAlive = false - - -- This is tricky. If we sanitize Client._Tasks before sanitizing Client._Tasks[TaskNumber].MissionTask, then the original MissionTask will be sanitized, and will be lost within the garbage collector. - -- So first sanitize Client._Tasks[TaskNumber].MissionTask, after that, sanitize only the whole _Tasks structure... - --Client._Tasks[TaskNumber].MissionTask = nil - --Client._Tasks = nil - end - end - end - - -- If all Clients of this Mission are not activated, then the Mission status needs to be put back into Pending status. - -- But only if the Mission was Ongoing. In case the Mission is Completed or Failed, the Mission status may not be changed. In these cases, this will be the last run of this Mission in the Scheduler. - if ClientsAlive == false then - if Mission:IsOngoing() then - -- Mission status back to pending... - Mission:Pending() - end - end - end - - Mission:StatusToClients() - - if Mission:ReportTrigger() then - Mission:ReportToAll() - end - end - - return true -end - ---- Start the MISSIONSCHEDULER. -function MISSIONSCHEDULER.Start() - if MISSIONSCHEDULER ~= nil then - --MISSIONSCHEDULER.SchedulerId = routines.scheduleFunction( MISSIONSCHEDULER.Scheduler, { }, 0, 2 ) - MISSIONSCHEDULER.SchedulerId = SCHEDULER:New( nil, MISSIONSCHEDULER.Scheduler, { }, 0, 2 ) - end -end - ---- Stop the MISSIONSCHEDULER. -function MISSIONSCHEDULER.Stop() - if MISSIONSCHEDULER.SchedulerId then - routines.removeFunction(MISSIONSCHEDULER.SchedulerId) - MISSIONSCHEDULER.SchedulerId = nil - end -end - ---- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc. --- @param Mission is the MISSION object instantiated by @{MISSION:New}. --- @return MISSION --- @usage --- -- Declare a mission. --- Mission = MISSION:New( 'Russia Transport Troops SA-6', --- 'Operational', --- 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', --- 'Russia' ) --- MISSIONSCHEDULER:AddMission( Mission ) -function MISSIONSCHEDULER.AddMission( Mission ) - MISSIONSCHEDULER.Missions[Mission.Name] = Mission - MISSIONSCHEDULER.MissionCount = MISSIONSCHEDULER.MissionCount + 1 - -- Add an overall AI Client for the AI tasks... This AI Client will facilitate the Events in the background for each Task. - --MissionAdd:AddClient( CLIENT:Register( 'AI' ) ) - - return Mission -end - ---- Remove a MISSION from the MISSIONSCHEDULER. --- @param MissionName is the name of the MISSION given at declaration using @{AddMission}. --- @usage --- -- Declare a mission. --- Mission = MISSION:New( 'Russia Transport Troops SA-6', --- 'Operational', --- 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', --- 'Russia' ) --- MISSIONSCHEDULER:AddMission( Mission ) --- --- -- Now remove the Mission. --- MISSIONSCHEDULER:RemoveMission( 'Russia Transport Troops SA-6' ) -function MISSIONSCHEDULER.RemoveMission( MissionName ) - MISSIONSCHEDULER.Missions[MissionName] = nil - MISSIONSCHEDULER.MissionCount = MISSIONSCHEDULER.MissionCount - 1 -end - ---- Find a MISSION within the MISSIONSCHEDULER. --- @param MissionName is the name of the MISSION given at declaration using @{AddMission}. --- @return MISSION --- @usage --- -- Declare a mission. --- Mission = MISSION:New( 'Russia Transport Troops SA-6', --- 'Operational', --- 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', --- 'Russia' ) --- MISSIONSCHEDULER:AddMission( Mission ) --- --- -- Now find the Mission. --- MissionFind = MISSIONSCHEDULER:FindMission( 'Russia Transport Troops SA-6' ) -function MISSIONSCHEDULER.FindMission( MissionName ) - return MISSIONSCHEDULER.Missions[MissionName] -end - --- Internal function used by the MISSIONSCHEDULER menu. -function MISSIONSCHEDULER.ReportMissionsShow( ) - for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do - Mission.MissionReportShow = true - Mission.MissionReportFlash = false - end -end - --- Internal function used by the MISSIONSCHEDULER menu. -function MISSIONSCHEDULER.ReportMissionsFlash( TimeInterval ) - local Count = 0 - for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do - Mission.MissionReportShow = false - Mission.MissionReportFlash = true - Mission.MissionReportTrigger = timer.getTime() + Count * TimeInterval - Mission.MissionTimeInterval = MISSIONSCHEDULER.MissionCount * TimeInterval - env.info( "TimeInterval = " .. Mission.MissionTimeInterval ) - Count = Count + 1 - end -end - --- Internal function used by the MISSIONSCHEDULER menu. -function MISSIONSCHEDULER.ReportMissionsHide( Prm ) - for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do - Mission.MissionReportShow = false - Mission.MissionReportFlash = false - end -end - ---- Enables a MENU option in the communications menu under F10 to control the status of the active missions. --- This function should be called only once when starting the MISSIONSCHEDULER. -function MISSIONSCHEDULER.ReportMenu() - local ReportMenu = SUBMENU:New( 'Status' ) - local ReportMenuShow = COMMANDMENU:New( 'Show Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsShow, 0 ) - local ReportMenuFlash = COMMANDMENU:New('Flash Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsFlash, 120 ) - local ReportMenuHide = COMMANDMENU:New( 'Hide Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsHide, 0 ) -end - ---- Show the remaining mission time. -function MISSIONSCHEDULER:TimeShow() - self.TimeIntervalCount = self.TimeIntervalCount + 1 - if self.TimeIntervalCount >= self.TimeTriggerShow then - local TimeMsg = string.format("%00d", ( self.TimeSeconds / 60 ) - ( timer.getTime() / 60 )) .. ' minutes left until mission reload.' - MESSAGE:New( TimeMsg, self.TimeShow, "Mission time" ):ToAll() - self.TimeIntervalCount = 0 - end -end - -function MISSIONSCHEDULER:Time( TimeSeconds, TimeIntervalShow, TimeShow ) - - self.TimeIntervalCount = 0 - self.TimeSeconds = TimeSeconds - self.TimeIntervalShow = TimeIntervalShow - self.TimeShow = TimeShow -end - ---- Adds a mission scoring to the game. -function MISSIONSCHEDULER:Scoring( Scoring ) - - self.Scoring = Scoring -end - --- This module contains the TASK class. -- -- 1) @{#TASK} class, extends @{Base#BASE} diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua index a39115980..a9cb94b4a 100644 --- a/Moose Mission Setup/Moose.lua +++ b/Moose Mission Setup/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20170315_1007' ) +env.info( 'Moose Generation Timestamp: 20170315_1149' ) local base = _G Include = {} @@ -32319,22 +32319,6 @@ MISSION = { ClassName = "MISSION", Name = "", MissionStatus = "PENDING", - _Clients = {}, - TaskMenus = {}, - TaskCategoryMenus = {}, - TaskTypeMenus = {}, - _ActiveTasks = {}, - GoalFunction = nil, - MissionReportTrigger = 0, - MissionProgressTrigger = 0, - MissionReportShow = false, - MissionReportFlash = false, - MissionTimeInterval = 0, - MissionCoalition = "", - SUCCESS = 1, - FAILED = 2, - REPEAT = 3, - _GoalTasks = {} } --- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc. @@ -32541,6 +32525,10 @@ function MISSION:New( CommandCenter, MissionName, MissionPriority, MissionBriefi self.MissionCoalition = MissionCoalition self.Tasks = {} + + -- Private implementations + + return self end @@ -32831,76 +32819,44 @@ function MISSION:GetNextTaskID( Task ) return self.Tasks[TaskName].n end - - ---- old stuff - ---- Returns if a Mission has completed. --- @return bool +--- Is the @{Mission} **Completed**. +-- @param #MISSION self +-- @return #boolean function MISSION:IsCompleted() - self:F() - return self.MissionStatus == "ACCOMPLISHED" + return self:Is( "Completed" ) end ---- Set a Mission to completed. -function MISSION:Completed() - self:F() - self.MissionStatus = "ACCOMPLISHED" - self:StatusToClients() +--- Is the @{Mission} **Idle**. +-- @param #MISSION self +-- @return #boolean +function MISSION:IsIdle() + return self:Is( "Idle" ) end ---- Returns if a Mission is ongoing. --- treturn bool +--- Is the @{Mission} **Ongoing**. +-- @param #MISSION self +-- @return #boolean function MISSION:IsOngoing() - self:F() - return self.MissionStatus == "ONGOING" + return self:Is( "Ongoing" ) end ---- Set a Mission to ongoing. -function MISSION:Ongoing() - self:F() - self.MissionStatus = "ONGOING" - --self:StatusToClients() +--- Is the @{Mission} **Failed**. +-- @param #MISSION self +-- @return #boolean +function MISSION:IsFailed() + return self:Is( "Failed" ) end ---- Returns if a Mission is pending. --- treturn bool -function MISSION:IsPending() - self:F() - return self.MissionStatus == "PENDING" -end - ---- Set a Mission to pending. -function MISSION:Pending() - self:F() - self.MissionStatus = "PENDING" - self:StatusToClients() -end - ---- Returns if a Mission has failed. --- treturn bool -function MISSION:IsFailed() - self:F() - return self.MissionStatus == "FAILED" -end - ---- Set a Mission to failed. -function MISSION:Failed() - self:F() - self.MissionStatus = "FAILED" - self:StatusToClients() -end - ---- Send the status of the MISSION to all Clients. -function MISSION:StatusToClients() - self:F() - if self.MissionReportFlash then - for ClientID, Client in pairs( self._Clients ) do - Client:Message( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. '! ( ' .. self.MissionPriority .. ' mission ) ', 10, "Mission Command: Mission Status") - end - end +--- Is the @{Mission} **Hold**. +-- @param #MISSION self +-- @return #boolean +function MISSION:IsHold() + return self:Is( "Hold" ) end +--- Validates if the Mission has a Group +-- @param #MISSION +-- @return #boolean true if the Mission has a Group. function MISSION:HasGroup( TaskGroup ) local Has = false @@ -32993,107 +32949,6 @@ function MISSION:ReportDetails() return Report:Text() end ---- Report the status of all MISSIONs to all active Clients. -function MISSION:ReportToAll() - self:F() - - local AlivePlayers = '' - for ClientID, Client in pairs( self._Clients ) do - if Client:GetDCSGroup() then - if Client:GetClientGroupDCSUnit() then - if Client:GetClientGroupDCSUnit():getLife() > 0.0 then - if AlivePlayers == '' then - AlivePlayers = ' Players: ' .. Client:GetClientGroupDCSUnit():getPlayerName() - else - AlivePlayers = AlivePlayers .. ' / ' .. Client:GetClientGroupDCSUnit():getPlayerName() - end - end - end - end - end - local Tasks = self:GetTasks() - local TaskText = "" - for TaskID, TaskData in pairs( Tasks ) do - TaskText = TaskText .. " - Task " .. TaskID .. ": " .. TaskData.Name .. ": " .. TaskData:GetGoalProgress() .. "\n" - end - MESSAGE:New( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. ' ( ' .. self.MissionPriority .. ' mission )' .. AlivePlayers .. "\n" .. TaskText:gsub("\n$",""), 10, "Mission Command: Mission Report" ):ToAll() -end - - ---- Add a goal function to a MISSION. Goal functions are called when a @{TASK} within a mission has been completed. --- @param function GoalFunction is the function defined by the mission designer to evaluate whether a certain goal has been reached after a @{TASK} finishes within the @{MISSION}. A GoalFunction must accept 2 parameters: Mission, Client, which contains the current MISSION object and the current CLIENT object respectively. --- @usage --- PatriotActivation = { --- { "US SAM Patriot Zerti", false }, --- { "US SAM Patriot Zegduleti", false }, --- { "US SAM Patriot Gvleti", false } --- } --- --- function DeployPatriotTroopsGoal( Mission, Client ) --- --- --- -- Check if the cargo is all deployed for mission success. --- for CargoID, CargoData in pairs( Mission._Cargos ) do --- if Group.getByName( CargoData.CargoGroupName ) then --- CargoGroup = Group.getByName( CargoData.CargoGroupName ) --- if CargoGroup then --- -- Check if the cargo is ready to activate --- CurrentLandingZoneID = routines.IsUnitInZones( CargoGroup:getUnits()[1], Mission:GetTask( 2 ).LandingZones ) -- The second task is the Deploytask to measure mission success upon --- if CurrentLandingZoneID then --- if PatriotActivation[CurrentLandingZoneID][2] == false then --- -- Now check if this is a new Mission Task to be completed... --- trigger.action.setGroupAIOn( Group.getByName( PatriotActivation[CurrentLandingZoneID][1] ) ) --- PatriotActivation[CurrentLandingZoneID][2] = true --- MessageToBlue( "Mission Command: Message to all airborne units! The " .. PatriotActivation[CurrentLandingZoneID][1] .. " is armed. Our air defenses are now stronger.", 60, "BLUE/PatriotDefense" ) --- MessageToRed( "Mission Command: Our satellite systems are detecting additional NATO air defenses. To all airborne units: Take care!!!", 60, "RED/PatriotDefense" ) --- Mission:GetTask( 2 ):AddGoalCompletion( "Patriots activated", PatriotActivation[CurrentLandingZoneID][1], 1 ) -- Register Patriot activation as part of mission goal. --- end --- end --- end --- end --- end --- end --- --- local Mission = MISSIONSCHEDULER.AddMission( 'NATO Transport Troops', 'Operational', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.', 'NATO' ) --- Mission:AddGoalFunction( DeployPatriotTroopsGoal ) -function MISSION:AddGoalFunction( GoalFunction ) - self:F() - self.GoalFunction = GoalFunction -end - ---- Register a new @{CLIENT} to participate within the mission. --- @param CLIENT Client is the @{CLIENT} object. The object must have been instantiated with @{CLIENT:New}. --- @return CLIENT --- @usage --- Add a number of Client objects to the Mission. --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*HOT-Deploy Troops 1', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*RAMP-Deploy Troops 3', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*HOT-Deploy Troops 2', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) --- Mission:AddClient( CLIENT:FindByName( 'US UH-1H*RAMP-Deploy Troops 4', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() ) -function MISSION:AddClient( Client ) - self:F( { Client } ) - - local Valid = true - - if Valid then - self._Clients[Client.ClientName] = Client - end - - return Client -end - ---- Find a @{CLIENT} object within the @{MISSION} by its ClientName. --- @param CLIENT ClientName is a string defining the Client Group as defined within the ME. --- @return CLIENT --- @usage --- -- Seach for Client "Bomber" within the Mission. --- local BomberClient = Mission:FindClient( "Bomber" ) -function MISSION:FindClient( ClientName ) - self:F( { self._Clients[ClientName] } ) - return self._Clients[ClientName] -end - - --- Get all the TASKs from the Mission. This function is useful in GoalFunctions. -- @return {TASK,...} Structure of TASKS with the @{TASK} number as the key. -- @usage @@ -33107,333 +32962,6 @@ function MISSION:GetTasks() end ---[[ - _TransportExecuteStage: Defines the different stages of Transport unload/load execution. This table is internal and is used to control the validity of Transport load/unload timing. - - - _TransportExecuteStage.EXECUTING - - _TransportExecuteStage.SUCCESS - - _TransportExecuteStage.FAILED - ---]] -_TransportExecuteStage = { - NONE = 0, - EXECUTING = 1, - SUCCESS = 2, - FAILED = 3 -} - - ---- The MISSIONSCHEDULER is an OBJECT and is the main scheduler of ALL active MISSIONs registered within this scheduler. It's workings are considered internal and is automatically created when the Mission.lua file is included. --- @type MISSIONSCHEDULER --- @field #MISSIONSCHEDULER.MISSIONS Missions -MISSIONSCHEDULER = { - Missions = {}, - MissionCount = 0, - TimeIntervalCount = 0, - TimeIntervalShow = 150, - TimeSeconds = 14400, - TimeShow = 5 -} - ---- @type MISSIONSCHEDULER.MISSIONS --- @list <#MISSION> Mission - ---- This is the main MISSIONSCHEDULER Scheduler function. It is considered internal and is automatically created when the Mission.lua file is included. -function MISSIONSCHEDULER.Scheduler() - - - -- loop through the missions in the TransportTasks - for MissionName, MissionData in pairs( MISSIONSCHEDULER.Missions ) do - - local Mission = MissionData -- #MISSION - - if not Mission:IsCompleted() then - - -- This flag will monitor if for this mission, there are clients alive. If this flag is still false at the end of the loop, the mission status will be set to Pending (if not Failed or Completed). - local ClientsAlive = false - - for ClientID, ClientData in pairs( Mission._Clients ) do - - local Client = ClientData -- Wrapper.Client#CLIENT - - if Client:IsAlive() then - - -- There is at least one Client that is alive... So the Mission status is set to Ongoing. - ClientsAlive = true - - -- If this Client was not registered as Alive before: - -- 1. We register the Client as Alive. - -- 2. We initialize the Client Tasks and make a link to the original Mission Task. - -- 3. We initialize the Cargos. - -- 4. We flag the Mission as Ongoing. - if not Client.ClientAlive then - Client.ClientAlive = true - Client.ClientBriefingShown = false - for TaskNumber, Task in pairs( Mission._Tasks ) do - -- Note that this a deepCopy. Each client must have their own Tasks with own Stages!!! - Client._Tasks[TaskNumber] = routines.utils.deepCopy( Mission._Tasks[TaskNumber] ) - -- Each MissionTask must point to the original Mission. - Client._Tasks[TaskNumber].MissionTask = Mission._Tasks[TaskNumber] - Client._Tasks[TaskNumber].Cargos = Mission._Tasks[TaskNumber].Cargos - Client._Tasks[TaskNumber].LandingZones = Mission._Tasks[TaskNumber].LandingZones - end - - Mission:Ongoing() - end - - - -- For each Client, check for each Task the state and evolve the mission. - -- This flag will indicate if the Task of the Client is Complete. - local TaskComplete = false - - for TaskNumber, Task in pairs( Client._Tasks ) do - - if not Task.Stage then - Task:SetStage( 1 ) - end - - - local TransportTime = timer.getTime() - - if not Task:IsDone() then - - if Task:Goal() then - Task:ShowGoalProgress( Mission, Client ) - end - - --env.info( 'Scheduler: Mission = ' .. Mission.Name .. ' / Client = ' .. Client.ClientName .. ' / Task = ' .. Task.Name .. ' / Stage = ' .. Task.ActiveStage .. ' - ' .. Task.Stage.Name .. ' - ' .. Task.Stage.StageType ) - - -- Action - if Task:StageExecute() then - Task.Stage:Execute( Mission, Client, Task ) - end - - -- Wait until execution is finished - if Task.ExecuteStage == _TransportExecuteStage.EXECUTING then - Task.Stage:Executing( Mission, Client, Task ) - end - - -- Validate completion or reverse to earlier stage - if Task.Time + Task.Stage.WaitTime <= TransportTime then - Task:SetStage( Task.Stage:Validate( Mission, Client, Task ) ) - end - - if Task:IsDone() then - --env.info( 'Scheduler: Mission '.. Mission.Name .. ' Task ' .. Task.Name .. ' Stage ' .. Task.Stage.Name .. ' done. TaskComplete = ' .. string.format ( "%s", TaskComplete and "true" or "false" ) ) - TaskComplete = true -- when a task is not yet completed, a mission cannot be completed - - else - -- break only if this task is not yet done, so that future task are not yet activated. - TaskComplete = false -- when a task is not yet completed, a mission cannot be completed - --env.info( 'Scheduler: Mission "'.. Mission.Name .. '" Task "' .. Task.Name .. '" Stage "' .. Task.Stage.Name .. '" break. TaskComplete = ' .. string.format ( "%s", TaskComplete and "true" or "false" ) ) - break - end - - if TaskComplete then - - if Mission.GoalFunction ~= nil then - Mission.GoalFunction( Mission, Client ) - end - if MISSIONSCHEDULER.Scoring then - MISSIONSCHEDULER.Scoring:_AddMissionTaskScore( Client:GetClientGroupDCSUnit(), Mission.Name, 25 ) - end - --- if not Mission:IsCompleted() then --- end - end - end - end - - local MissionComplete = true - for TaskNumber, Task in pairs( Mission._Tasks ) do - if Task:Goal() then --- Task:ShowGoalProgress( Mission, Client ) - if Task:IsGoalReached() then - else - MissionComplete = false - end - else - MissionComplete = false -- If there is no goal, the mission should never be ended. The goal status will be set somewhere else. - end - end - - if MissionComplete then - Mission:Completed() - if MISSIONSCHEDULER.Scoring then - MISSIONSCHEDULER.Scoring:_AddMissionScore( Mission.Name, 100 ) - end - else - if TaskComplete then - -- Reset for new tasking of active client - Client.ClientAlive = false -- Reset the client tasks. - end - end - - - else - if Client.ClientAlive then - env.info( 'Scheduler: Client "' .. Client.ClientName .. '" is inactive.' ) - Client.ClientAlive = false - - -- This is tricky. If we sanitize Client._Tasks before sanitizing Client._Tasks[TaskNumber].MissionTask, then the original MissionTask will be sanitized, and will be lost within the garbage collector. - -- So first sanitize Client._Tasks[TaskNumber].MissionTask, after that, sanitize only the whole _Tasks structure... - --Client._Tasks[TaskNumber].MissionTask = nil - --Client._Tasks = nil - end - end - end - - -- If all Clients of this Mission are not activated, then the Mission status needs to be put back into Pending status. - -- But only if the Mission was Ongoing. In case the Mission is Completed or Failed, the Mission status may not be changed. In these cases, this will be the last run of this Mission in the Scheduler. - if ClientsAlive == false then - if Mission:IsOngoing() then - -- Mission status back to pending... - Mission:Pending() - end - end - end - - Mission:StatusToClients() - - if Mission:ReportTrigger() then - Mission:ReportToAll() - end - end - - return true -end - ---- Start the MISSIONSCHEDULER. -function MISSIONSCHEDULER.Start() - if MISSIONSCHEDULER ~= nil then - --MISSIONSCHEDULER.SchedulerId = routines.scheduleFunction( MISSIONSCHEDULER.Scheduler, { }, 0, 2 ) - MISSIONSCHEDULER.SchedulerId = SCHEDULER:New( nil, MISSIONSCHEDULER.Scheduler, { }, 0, 2 ) - end -end - ---- Stop the MISSIONSCHEDULER. -function MISSIONSCHEDULER.Stop() - if MISSIONSCHEDULER.SchedulerId then - routines.removeFunction(MISSIONSCHEDULER.SchedulerId) - MISSIONSCHEDULER.SchedulerId = nil - end -end - ---- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc. --- @param Mission is the MISSION object instantiated by @{MISSION:New}. --- @return MISSION --- @usage --- -- Declare a mission. --- Mission = MISSION:New( 'Russia Transport Troops SA-6', --- 'Operational', --- 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', --- 'Russia' ) --- MISSIONSCHEDULER:AddMission( Mission ) -function MISSIONSCHEDULER.AddMission( Mission ) - MISSIONSCHEDULER.Missions[Mission.Name] = Mission - MISSIONSCHEDULER.MissionCount = MISSIONSCHEDULER.MissionCount + 1 - -- Add an overall AI Client for the AI tasks... This AI Client will facilitate the Events in the background for each Task. - --MissionAdd:AddClient( CLIENT:Register( 'AI' ) ) - - return Mission -end - ---- Remove a MISSION from the MISSIONSCHEDULER. --- @param MissionName is the name of the MISSION given at declaration using @{AddMission}. --- @usage --- -- Declare a mission. --- Mission = MISSION:New( 'Russia Transport Troops SA-6', --- 'Operational', --- 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', --- 'Russia' ) --- MISSIONSCHEDULER:AddMission( Mission ) --- --- -- Now remove the Mission. --- MISSIONSCHEDULER:RemoveMission( 'Russia Transport Troops SA-6' ) -function MISSIONSCHEDULER.RemoveMission( MissionName ) - MISSIONSCHEDULER.Missions[MissionName] = nil - MISSIONSCHEDULER.MissionCount = MISSIONSCHEDULER.MissionCount - 1 -end - ---- Find a MISSION within the MISSIONSCHEDULER. --- @param MissionName is the name of the MISSION given at declaration using @{AddMission}. --- @return MISSION --- @usage --- -- Declare a mission. --- Mission = MISSION:New( 'Russia Transport Troops SA-6', --- 'Operational', --- 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', --- 'Russia' ) --- MISSIONSCHEDULER:AddMission( Mission ) --- --- -- Now find the Mission. --- MissionFind = MISSIONSCHEDULER:FindMission( 'Russia Transport Troops SA-6' ) -function MISSIONSCHEDULER.FindMission( MissionName ) - return MISSIONSCHEDULER.Missions[MissionName] -end - --- Internal function used by the MISSIONSCHEDULER menu. -function MISSIONSCHEDULER.ReportMissionsShow( ) - for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do - Mission.MissionReportShow = true - Mission.MissionReportFlash = false - end -end - --- Internal function used by the MISSIONSCHEDULER menu. -function MISSIONSCHEDULER.ReportMissionsFlash( TimeInterval ) - local Count = 0 - for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do - Mission.MissionReportShow = false - Mission.MissionReportFlash = true - Mission.MissionReportTrigger = timer.getTime() + Count * TimeInterval - Mission.MissionTimeInterval = MISSIONSCHEDULER.MissionCount * TimeInterval - env.info( "TimeInterval = " .. Mission.MissionTimeInterval ) - Count = Count + 1 - end -end - --- Internal function used by the MISSIONSCHEDULER menu. -function MISSIONSCHEDULER.ReportMissionsHide( Prm ) - for MissionName, Mission in pairs( MISSIONSCHEDULER.Missions ) do - Mission.MissionReportShow = false - Mission.MissionReportFlash = false - end -end - ---- Enables a MENU option in the communications menu under F10 to control the status of the active missions. --- This function should be called only once when starting the MISSIONSCHEDULER. -function MISSIONSCHEDULER.ReportMenu() - local ReportMenu = SUBMENU:New( 'Status' ) - local ReportMenuShow = COMMANDMENU:New( 'Show Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsShow, 0 ) - local ReportMenuFlash = COMMANDMENU:New('Flash Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsFlash, 120 ) - local ReportMenuHide = COMMANDMENU:New( 'Hide Report Missions', ReportMenu, MISSIONSCHEDULER.ReportMissionsHide, 0 ) -end - ---- Show the remaining mission time. -function MISSIONSCHEDULER:TimeShow() - self.TimeIntervalCount = self.TimeIntervalCount + 1 - if self.TimeIntervalCount >= self.TimeTriggerShow then - local TimeMsg = string.format("%00d", ( self.TimeSeconds / 60 ) - ( timer.getTime() / 60 )) .. ' minutes left until mission reload.' - MESSAGE:New( TimeMsg, self.TimeShow, "Mission time" ):ToAll() - self.TimeIntervalCount = 0 - end -end - -function MISSIONSCHEDULER:Time( TimeSeconds, TimeIntervalShow, TimeShow ) - - self.TimeIntervalCount = 0 - self.TimeSeconds = TimeSeconds - self.TimeIntervalShow = TimeIntervalShow - self.TimeShow = TimeShow -end - ---- Adds a mission scoring to the game. -function MISSIONSCHEDULER:Scoring( Scoring ) - - self.Scoring = Scoring -end - --- This module contains the TASK class. -- -- 1) @{#TASK} class, extends @{Base#BASE} diff --git a/docs/Documentation/AI_Cap.html b/docs/Documentation/AI_Cap.html index 3c943b3aa..f1305bb2a 100644 --- a/docs/Documentation/AI_Cap.html +++ b/docs/Documentation/AI_Cap.html @@ -354,6 +354,12 @@ Use the method AICap#AIAI_CAP_ZONE:OnEnterEngaging(Controllable, From, Event, To)

OnEnter Transition Handler for State Engaging.

+ + + + AI_CAP_ZONE:OnEventDead(EventData) + + @@ -1171,6 +1177,27 @@ The To State string.

+ +AI_CAP_ZONE:OnEventDead(EventData) + +
+
+ + + +

Parameter

+ +
+
+
+
+ AI_CAP_ZONE:OnLeaveEngaging(Controllable, From, Event, To) diff --git a/docs/Documentation/AI_Cas.html b/docs/Documentation/AI_Cas.html index b470c3d95..9ec5cfd1d 100644 --- a/docs/Documentation/AI_Cas.html +++ b/docs/Documentation/AI_Cas.html @@ -163,13 +163,16 @@ It can be notified to go RTB through the RTB event.

1.2.2) AICASZONE Events

    -
  • Start ( Group ): Start the process.
  • -
  • Route ( Group ): Route the AI to a new random 3D point within the Patrol Zone.
  • -
  • Engage ( Group ): Engage the AI to provide CAS in the Engage Zone, destroying any target it finds.
  • -
  • RTB ( Group ): Route the AI to the home base.
  • -
  • Detect ( Group ): The AI is detecting targets.
  • -
  • Detected ( Group ): The AI has detected new targets.
  • -
  • Status ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB.
  • +
  • **AIPatrol#AIPATROL_ZONE.Start**: Start the process.
  • +
  • **AIPatrol#AIPATROL_ZONE.Route**: Route the AI to a new random 3D point within the Patrol Zone.
  • +
  • **AICASZONE.Engage**: Engage the AI to provide CAS in the Engage Zone, destroying any target it finds.
  • +
  • **AICASZONE.Abort**: Aborts the engagement and return patrolling in the patrol zone.
  • +
  • **AIPatrol#AIPATROL_ZONE.RTB**: Route the AI to the home base.
  • +
  • **AIPatrol#AIPATROL_ZONE.Detect**: The AI is detecting targets.
  • +
  • **AIPatrol#AIPATROL_ZONE.Detected**: The AI has detected new targets.
  • +
  • **AICASZONE.Destroy**: The AI has destroyed a target Unit.
  • +
  • **AICASZONE.Destroyed**: The AI has destroyed all target Units assigned in the CAS task.
  • +
  • Status: The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB.

@@ -260,7 +263,7 @@ It can be notified to go RTB through the RTB event.

- AI_CAS_ZONE:Engage(EngageSpeed, EngageAltitude, EngageWeaponExpend, EngageAttackQty, EngageDirection) + AI_CAS_ZONE:Engage(EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)

Synchronous Event Trigger for Event Engage.

@@ -371,18 +374,18 @@ It can be notified to go RTB through the RTB event.

AI_CAS_ZONE:OnBeforeFired(Controllable, From, Event, To)

OnBefore Transition Handler for Event Fired.

- - - - AI_CAS_ZONE:OnDead(EventData) - - AI_CAS_ZONE:OnEnterEngaging(Controllable, From, Event, To)

OnEnter Transition Handler for State Engaging.

+ + + + AI_CAS_ZONE:OnEventDead(EventData) + + @@ -422,7 +425,7 @@ It can be notified to go RTB through the RTB event.

- AI_CAS_ZONE:__Engage(Delay, EngageSpeed, EngageAltitude, EngageWeaponExpend, EngageAttackQty, EngageDirection) + AI_CAS_ZONE:__Engage(Delay, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)

Asynchronous Event Trigger for Event Engage.

@@ -431,6 +434,12 @@ It can be notified to go RTB through the RTB event.

AI_CAS_ZONE:__Fired(Delay)

Asynchronous Event Trigger for Event Fired.

+ + + + AI_CAS_ZONE:onafterAbort(Controllable, From, Event, To) + + @@ -599,7 +608,7 @@ It can be notified to go RTB through the RTB event.

-AI_CAS_ZONE:Engage(EngageSpeed, EngageAltitude, EngageWeaponExpend, EngageAttackQty, EngageDirection) +AI_CAS_ZONE:Engage(EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)
@@ -616,14 +625,14 @@ It can be notified to go RTB through the RTB event.

  • -

    Dcs.DCSTypes#Distance EngageAltitude : -(optional) Desired altitude to perform the unit engagement.

    +

    Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend : +(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.

  • -

    Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend : -(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.

    +

    Dcs.DCSTypes#Distance EngageAltitude : +(optional) Desired altitude to perform the unit engagement.

  • @@ -1222,27 +1231,6 @@ Return false to cancel Transition.

    - -AI_CAS_ZONE:OnDead(EventData) - -
    -
    - - - -

    Parameter

    - -
    -
    -
    -
    - AI_CAS_ZONE:OnEnterEngaging(Controllable, From, Event, To) @@ -1283,6 +1271,27 @@ The To State string.

    + +AI_CAS_ZONE:OnEventDead(EventData) + +
    +
    + + + +

    Parameter

    + +
    +
    +
    +
    + AI_CAS_ZONE:OnLeaveEngaging(Controllable, From, Event, To) @@ -1439,7 +1448,7 @@ The delay in seconds.

    -AI_CAS_ZONE:__Engage(Delay, EngageSpeed, EngageAltitude, EngageWeaponExpend, EngageAttackQty, EngageDirection) +AI_CAS_ZONE:__Engage(Delay, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)
    @@ -1462,14 +1471,14 @@ The delay in seconds.

  • -

    Dcs.DCSTypes#Distance EngageAltitude : -(optional) Desired altitude to perform the unit engagement.

    +

    Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend : +(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.

  • -

    Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend : -(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.

    +

    Dcs.DCSTypes#Distance EngageAltitude : +(optional) Desired altitude to perform the unit engagement.

  • @@ -1512,6 +1521,46 @@ The delay in seconds.

    + +AI_CAS_ZONE:onafterAbort(Controllable, From, Event, To) + +
    +
    + + + +

    Parameters

    +
      +
    • + +

      Wrapper.Controllable#CONTROLLABLE Controllable : +The Controllable Object managed by the FSM.

      + +
    • +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +
    +
    +
    +
    + AI_CAS_ZONE:onafterAccomplish(Controllable, From, Event, To) diff --git a/docs/Documentation/Account.html b/docs/Documentation/Account.html index 8552ecbe8..92e518f35 100644 --- a/docs/Documentation/Account.html +++ b/docs/Documentation/Account.html @@ -276,12 +276,6 @@ Each successful dead will trigger an Account state transition that can be scored ACT_ACCOUNT_DEADS.TaskName - - - - ACT_ACCOUNT_DEADS:_Destructor() - - @@ -683,19 +677,6 @@ Each successful dead will trigger an Account state transition that can be scored -
  • -
    -
    -
    - - -ACT_ACCOUNT_DEADS:_Destructor() - -
    -
    - - -
    diff --git a/docs/Documentation/Base.html b/docs/Documentation/Base.html index ed9ed90be..1a38dc885 100644 --- a/docs/Documentation/Base.html +++ b/docs/Documentation/Base.html @@ -2216,6 +2216,9 @@ A #table or any field.

    + +

    THIS IS WHY WE NEED LUA 5.2 ...

    +
    diff --git a/docs/Documentation/Cargo.html b/docs/Documentation/Cargo.html index 057ed8705..f3bcbd277 100644 --- a/docs/Documentation/Cargo.html +++ b/docs/Documentation/Cargo.html @@ -2425,6 +2425,7 @@ The UNIT carrying the package.

    + AI_CARGO_UNIT.CargoCarrier diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html index f55f9ae2c..63e791daa 100644 --- a/docs/Documentation/Detection.html +++ b/docs/Documentation/Detection.html @@ -369,39 +369,15 @@

    Type DETECTION_AREAS

    - - - - - - - - - - - - - - - - - + @@ -447,39 +423,33 @@ - + - + - + - + - - - - @@ -522,86 +492,6 @@ - -
    DETECTION_AREAS:AcceptChanges(DetectedArea) -

    Accepts changes from the detected zone.

    -
    DETECTION_AREAS:AddChangeArea(DetectedArea, ChangeCode, AreaUnitType) -

    Add a change to the detected zone.

    -
    DETECTION_AREAS:AddChangeUnit(DetectedArea, ChangeCode, ChangeUnitType) -

    Add a change to the detected zone.

    -
    DETECTION_AREAS:AddDetectedItem(Set, Zone) -

    Add a detected DETECTION_AREAS.DetectedItem.

    -
    DETECTION_AREAS:BoundDetectedZones()

    Bound the detected zones

    DETECTION_AREAS:CalculateThreatLevelA2G(DetectedArea)DETECTION_AREAS:CalculateThreatLevelA2G(DetectedItem) -

    Calculate the maxium A2G threat level of the DetectedArea.

    +

    Calculate the maxium A2G threat level of the DetectedItem.

    DETECTION_AREAS:GetChangeText(DetectedArea)DETECTION_AREAS:GetChangeText(DetectedItem)

    Make text documenting the changes of the detected zone.

    DETECTION_AREAS:GetTreatLevelA2G(DetectedArea)DETECTION_AREAS:GetTreatLevelA2G(DetectedItem) -

    Returns the A2G threat level of the units in the DetectedArea

    +

    Returns the A2G threat level of the units in the DetectedItem

    DETECTION_AREAS:IsFriendliesNearBy(DetectedArea)DETECTION_AREAS:IsFriendliesNearBy(DetectedItem)

    Returns if there are friendlies nearby the FAC units ...

    DETECTION_AREAS:NearestFAC(DetectedArea)DETECTION_AREAS:NearestFAC(DetectedItem) -

    Find the nearest FAC of the DetectedArea.

    +

    Find the nearest FAC of the DetectedItem.

    DETECTION_AREAS:New(DetectionSetGroup, DetectionZoneRange)

    DETECTION_AREAS constructor.

    -
    DETECTION_AREAS:ReportFriendliesNearBy(ReportUnit, ReportGroupData) -

    Background worker function to determine if there are friendlies nearby ...

    DETECTION_AREAS._SmokeDetectedZones -
    - -

    Type DETECTION_AREAS.DetectedArea

    - - - - - - - - - - - - - - - - - - - - - -
    DETECTION_AREAS.DetectedArea.Changed - -
    DETECTION_AREAS.DetectedArea.Changes - -
    DETECTION_AREAS.DetectedArea.MaxThreatLevelA2G - -
    DETECTION_AREAS.DetectedArea.NearestFAC - -
    DETECTION_AREAS.DetectedArea.Zone - -
    - -

    Type DETECTION_AREAS.DetectedItem

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    DETECTION_AREAS.DetectedItem.AreaID -

    -- The identifier of the detected area.

    -
    DETECTION_AREAS.DetectedItem.Changed -

    Documents if the detected area has changes.

    -
    DETECTION_AREAS.DetectedItem.Changes -

    A list of the changes reported on the detected area. (It is up to the user of the detected area to consume those changes).

    -
    DETECTION_AREAS.DetectedItem.FriendliesNearBy -

    Indicates if there are friendlies within the detected area.

    -
    DETECTION_AREAS.DetectedItem.NearestFAC -

    The nearest FAC near the Area.

    -
    DETECTION_AREAS.DetectedItem.Set -

    -- The Set of Units in the detected area.

    -
    DETECTION_AREAS.DetectedItem.Zone -

    -- The Zone of the detected area.

    @@ -609,6 +499,12 @@

    Type DETECTION_BASE

    + + + + - + + + + + + + + + + + + + @@ -702,6 +616,12 @@ + + + + @@ -864,6 +784,12 @@ + + + + @@ -954,6 +880,12 @@ + + + + @@ -1093,9 +1025,51 @@

    Type DETECTION_BASE.DetectedItem

    DETECTION_BASE:AcceptChanges(DetectedItem) +

    Accepts changes from the detected item.

    +
    DETECTION_BASE.AcceptRange @@ -621,7 +517,25 @@
    DETECTION_BASE:AddDetectedItem(Set, Zone)DETECTION_BASE:AddChangeItem(DetectedItem, ChangeCode, ItemUnitType) +

    Add a change to the detected zone.

    +
    DETECTION_BASE:AddChangeUnit(DetectedItem, ChangeCode, ChangeUnitType) +

    Add a change to the detected zone.

    +
    DETECTION_BASE:AddDetectedItem(DetectedItemIndex, Set) +

    Adds a new DetectedItem to the DetectedItems list.

    +
    DETECTION_BASE:AddDetectedItemZone(DetectedItemIndex, Set, Zone)

    Adds a new DetectedItem to the DetectedItems list.

    DETECTION_BASE.DetectedItemCount +
    DETECTION_BASE.DetectedItemMax +
    DETECTION_BASE:IsDetectedObjectIdentified(DetectedObject)

    Determines if a detected object has already been identified during detection processing.

    +
    DETECTION_BASE:IsFriendliesNearBy(DetectedItem) +

    Returns if there are friendlies nearby the FAC units ...

    DETECTION_BASE:RemoveDetectedItem(DetectedItemIndex)

    Removes an existing DetectedItem from the DetectedItems list.

    +
    DETECTION_BASE:ReportFriendliesNearBy(ReportGroupData) +

    Background worker function to determine if there are friendlies nearby ...

    - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    DETECTION_BASE.DetectedItem.SetDETECTION_BASE.DetectedItem.Changed +

    Documents if the detected area has changes.

    +
    DETECTION_BASE.DetectedItem.Changes +

    A list of the changes reported on the detected area. (It is up to the user of the detected area to consume those changes).

    +
    DETECTION_BASE.DetectedItem.FriendliesNearBy +

    Indicates if there are friendlies within the detected area.

    +
    DETECTION_BASE.DetectedItem.ItemID +

    -- The identifier of the detected area.

    +
    DETECTION_BASE.DetectedItem.MaxThreatLevelA2G +
    DETECTION_BASE.DetectedItem.NearestFAC +

    The nearest FAC near the Area.

    +
    DETECTION_BASE.DetectedItem.Set +

    -- The Set of Units in the detected area.

    +
    DETECTION_BASE.DetectedItem.Zone +

    -- The Zone of the detected area.

    @@ -1137,12 +1111,6 @@

    Type DETECTION_TYPES

    - - - - - - - - @@ -1179,33 +1141,15 @@ - + - - - - - - - - - - - - @@ -1258,12 +1202,6 @@ - - - - @@ -1276,6 +1214,12 @@ + + + + @@ -1383,137 +1327,6 @@
    - -DETECTION_AREAS:AcceptChanges(DetectedArea) - -
    -
    - -

    Accepts changes from the detected zone.

    - -

    Parameter

    - -

    Return value

    - -

    #DETECTION_AREAS: -self

    - -
    -
    -
    -
    - - -DETECTION_AREAS:AddChangeArea(DetectedArea, ChangeCode, AreaUnitType) - -
    -
    - -

    Add a change to the detected zone.

    - -

    Parameters

    - -

    Return value

    - -

    #DETECTION_AREAS: -self

    - -
    -
    -
    -
    - - -DETECTION_AREAS:AddChangeUnit(DetectedArea, ChangeCode, ChangeUnitType) - -
    -
    - -

    Add a change to the detected zone.

    - -

    Parameters

    - -

    Return value

    - -

    #DETECTION_AREAS: -self

    - -
    -
    -
    -
    - - -DETECTION_AREAS:AddDetectedItem(Set, Zone) - -
    -
    - -

    Add a detected DETECTION_AREAS.DetectedItem.

    - -

    Parameters

    - -

    Return value

    - -

    #DETECTION_AREAS.DetectedItem: -DetectedItem

    - -
    -
    -
    -
    - DETECTION_AREAS:BoundDetectedZones() @@ -1533,18 +1346,18 @@ self

    -DETECTION_AREAS:CalculateThreatLevelA2G(DetectedArea) +DETECTION_AREAS:CalculateThreatLevelA2G(DetectedItem)
    -

    Calculate the maxium A2G threat level of the DetectedArea.

    +

    Calculate the maxium A2G threat level of the DetectedItem.

    Parameter

    @@ -1614,7 +1427,7 @@ self

    - #DETECTION_AREAS.DetectedItems + #DETECTION_BASE.DetectedItems DETECTION_AREAS.DetectedItems @@ -1679,7 +1492,7 @@ self

    -DETECTION_AREAS:GetChangeText(DetectedArea) +DETECTION_AREAS:GetChangeText(DetectedItem)
    @@ -1690,7 +1503,7 @@ self

    @@ -1705,18 +1518,18 @@ The Changes text

    -DETECTION_AREAS:GetTreatLevelA2G(DetectedArea) +DETECTION_AREAS:GetTreatLevelA2G(DetectedItem)
    -

    Returns the A2G threat level of the units in the DetectedArea

    +

    Returns the A2G threat level of the units in the DetectedItem

    Parameter

    @@ -1731,7 +1544,7 @@ a scale from 0 to 10.

    -DETECTION_AREAS:IsFriendliesNearBy(DetectedArea) +DETECTION_AREAS:IsFriendliesNearBy(DetectedItem)
    @@ -1742,7 +1555,7 @@ a scale from 0 to 10.

    • -

      DetectedArea :

      +

      DetectedItem :

    @@ -1757,18 +1570,18 @@ trhe if there are friendlies nearby

    -DETECTION_AREAS:NearestFAC(DetectedArea) +DETECTION_AREAS:NearestFAC(DetectedItem)
    -

    Find the nearest FAC of the DetectedArea.

    +

    Find the nearest FAC of the DetectedItem.

    Parameter

    @@ -1815,32 +1628,6 @@ The range till which targets are grouped upon the first detected target.

    - -DETECTION_AREAS:ReportFriendliesNearBy(ReportUnit, ReportGroupData) - -
    -
    - -

    Background worker function to determine if there are friendlies nearby ...

    - -

    Parameters

    - -
    -
    -
    -
    - DETECTION_AREAS:SmokeDetectedUnits() @@ -1945,185 +1732,6 @@ self

    -

    Type DETECTION_AREAS.DetectedArea

    -

    Field(s)

    -
    -
    - - #boolean - -DETECTION_AREAS.DetectedArea.Changed - -
    -
    - - - -
    -
    -
    -
    - - - -DETECTION_AREAS.DetectedArea.Changes - -
    -
    - - - -
    -
    -
    -
    - - - -DETECTION_AREAS.DetectedArea.MaxThreatLevelA2G - -
    -
    - - - -
    -
    -
    -
    - - - -DETECTION_AREAS.DetectedArea.NearestFAC - -
    -
    - - - -
    -
    -
    -
    - - - -DETECTION_AREAS.DetectedArea.Zone - -
    -
    - - - - -

    Assign the Unit as the new center unit of the detected area.

    - -
    -
    - -

    Type DETECTION_AREAS.DetectedItem

    -

    Field(s)

    -
    -
    - - #number - -DETECTION_AREAS.DetectedItem.AreaID - -
    -
    - -

    -- The identifier of the detected area.

    - -
    -
    -
    -
    - - #boolean - -DETECTION_AREAS.DetectedItem.Changed - -
    -
    - -

    Documents if the detected area has changes.

    - -
    -
    -
    -
    - - #table - -DETECTION_AREAS.DetectedItem.Changes - -
    -
    - -

    A list of the changes reported on the detected area. (It is up to the user of the detected area to consume those changes).

    - -
    -
    -
    -
    - - #boolean - -DETECTION_AREAS.DetectedItem.FriendliesNearBy - -
    -
    - -

    Indicates if there are friendlies within the detected area.

    - -
    -
    -
    -
    - - Wrapper.Unit#UNIT - -DETECTION_AREAS.DetectedItem.NearestFAC - -
    -
    - -

    The nearest FAC near the Area.

    - -
    -
    -
    -
    - - Core.Set#SET_UNIT - -DETECTION_AREAS.DetectedItem.Set - -
    -
    - -

    -- The Set of Units in the detected area.

    - -
    -
    -
    -
    - - Core.Zone#ZONE_UNIT - -DETECTION_AREAS.DetectedItem.Zone - -
    -
    - -

    -- The Zone of the detected area.

    - -
    -
    - -

    Type DETECTION_AREAS.DetectedItems

    -

    Type DETECTION_BASE

    DETECTION_BASE class

    @@ -2132,6 +1740,32 @@ self

    + +DETECTION_BASE:AcceptChanges(DetectedItem) + +
    +
    + +

    Accepts changes from the detected item.

    + +

    Parameter

    + +

    Return value

    + +

    #DETECTION_BASE: +self

    + +
    +
    +
    +
    + DETECTION_BASE.AcceptRange @@ -2155,13 +1789,85 @@ self

    +
    +
    +
    +
    + + +DETECTION_BASE:AddChangeItem(DetectedItem, ChangeCode, ItemUnitType) + +
    +
    + +

    Add a change to the detected zone.

    + +

    Parameters

    + +

    Return value

    + +

    #DETECTION_BASE: +self

    + +
    +
    +
    +
    + + +DETECTION_BASE:AddChangeUnit(DetectedItem, ChangeCode, ChangeUnitType) + +
    +
    + +

    Add a change to the detected zone.

    + +

    Parameters

    + +

    Return value

    + +

    #DETECTION_BASE: +self

    +
    -DETECTION_BASE:AddDetectedItem(Set, Zone) +DETECTION_BASE:AddDetectedItem(DetectedItemIndex, Set)
    @@ -2175,6 +1881,48 @@ self

    • +

      #string DetectedItemIndex : +The index of the DetectedItem.

      + +
    • +
    • + +

      Core.Set#SET_UNIT Set : +(optional) The Set of Units to be added.

      + +
    • +
    +

    Return value

    + +

    #DETECTION_BASE.DetectedItem:

    + + +
    +
    +
    +
    + + +DETECTION_BASE:AddDetectedItemZone(DetectedItemIndex, Set, Zone) + +
    +
    + +

    Adds a new DetectedItem to the DetectedItems list.

    + + +

    The DetectedItem is a table and contains a SET_UNIT in the field Set.

    + +

    Parameters

    +
    +
    +
    +
    + + +DETECTION_BASE.DetectedItemMax + +
    +
    + + +
    @@ -2928,6 +2688,32 @@ true if already identified.

    + +DETECTION_BASE:IsFriendliesNearBy(DetectedItem) + +
    +
    + +

    Returns if there are friendlies nearby the FAC units ...

    + +

    Parameter

    +
      +
    • + +

      DetectedItem :

      + +
    • +
    +

    Return value

    + +

    #boolean: +trhe if there are friendlies nearby

    + +
    +
    +
    +
    + DETECTION_BASE:New(DetectionSetGroup) @@ -3432,6 +3218,27 @@ The index or position in the DetectedItems list where the item needs to be remov
    + +DETECTION_BASE:ReportFriendliesNearBy(ReportGroupData) + +
    +
    + +

    Background worker function to determine if there are friendlies nearby ...

    + +

    Parameter

    +
      +
    • + +

      ReportGroupData :

      + +
    • +
    +
    +
    +
    +
    + DETECTION_BASE:Schedule(DelayTime, RepeatInterval) @@ -3973,6 +3780,90 @@ The To State string.

    + #boolean + +DETECTION_BASE.DetectedItem.Changed + +
    +
    + +

    Documents if the detected area has changes.

    + +
    +
    +
    +
    + + #table + +DETECTION_BASE.DetectedItem.Changes + +
    +
    + +

    A list of the changes reported on the detected area. (It is up to the user of the detected area to consume those changes).

    + +
    +
    +
    +
    + + #boolean + +DETECTION_BASE.DetectedItem.FriendliesNearBy + +
    +
    + +

    Indicates if there are friendlies within the detected area.

    + +
    +
    +
    +
    + + #number + +DETECTION_BASE.DetectedItem.ItemID + +
    +
    + +

    -- The identifier of the detected area.

    + +
    +
    +
    +
    + + + +DETECTION_BASE.DetectedItem.MaxThreatLevelA2G + +
    +
    + + + +
    +
    +
    +
    + + Wrapper.Unit#UNIT + +DETECTION_BASE.DetectedItem.NearestFAC + +
    +
    + +

    The nearest FAC near the Area.

    + +
    +
    +
    +
    + Core.Set#SET_UNIT DETECTION_BASE.DetectedItem.Set @@ -3980,7 +3871,21 @@ The To State string.

    +

    -- The Set of Units in the detected area.

    +
    +
    +
    +
    + + Core.Zone#ZONE_UNIT + +DETECTION_BASE.DetectedItem.Zone + +
    +
    + +

    -- The Zone of the detected area.

    @@ -4070,35 +3975,6 @@ The To State string.

    - -DETECTION_TYPES:AddDetectedItem(TypeName) - -
    -
    - -

    Adds a new DetectedItem to the DetectedItems list.

    - - -

    The DetectedItem is a table and contains a SET_UNIT in the field Set.

    - -

    Parameter

    -
      -
    • - -

      #string TypeName :

      - -
    • -
    -

    Return value

    - -

    #DETECTION_TYPES.DetectedItem:

    - - -
    -
    -
    -
    - #string DETECTION_TYPES.ClassName @@ -4160,20 +4036,6 @@ self

    #string:

    - -
    -
    -
    - - - -DETECTION_TYPES.DetectedItems - -
    -
    - - -
    @@ -4210,70 +4072,26 @@ self

    - -DETECTION_TYPES:GetDetectedItem(TypeName) + +DETECTION_TYPES:GetChangeText(DetectedItem)
    -

    Get a detected item using a given numeric index.

    +

    Make text documenting the changes of the detected zone.

    Parameter

    Return value

    - -

    DETECTION_TYPES.DetectedItem

    - -
    -
    -
    -
    - - -DETECTION_TYPES:GetDetectedItemsCount() - -
    -
    - -

    Get the amount of SETs with detected objects.

    - -

    Return value

    - -

    #number: -Count

    - -
    -
    -
    -
    - - -DETECTION_TYPES:GetDetectedSet(TypeName) - -
    -
    - -

    Get the Set#SET_UNIT of a detecttion area using a given numeric index.

    - -

    Parameter

    -
      -
    • - -

      #string TypeName :

      - -
    • -
    -

    Return value

    - -

    Core.Set#SET_UNIT: -DetectedSet

    +

    #string: +The Changes text

    @@ -4302,30 +4120,6 @@ The Set of GROUPs in the Recce role.

    Functional.Detection#DETECTION_TYPES: self

    - -
    -
    -
    - - -DETECTION_TYPES:RemoveDetectedItem(TypeName) - -
    -
    - -

    Removes an existing DetectedItem from the DetectedItems list.

    - - -

    The DetectedItem is a table and contains a SET_UNIT in the field Set.

    - -

    Parameter

    -
      -
    • - -

      #string TypeName :

      - -
    • -
    @@ -4465,20 +4259,6 @@ self

    #string:

    - -
    -
    -
    - - - -DETECTION_UNITS.DetectedItems - -
    -
    - - -
    @@ -4516,6 +4296,32 @@ self

    + +DETECTION_UNITS:GetChangeText(DetectedItem) + +
    +
    + +

    Make text documenting the changes of the detected zone.

    + +

    Parameter

    + +

    Return value

    + +

    #string: +The Changes text

    + +
    +
    +
    +
    + DETECTION_UNITS:New(DetectionSetGroup) @@ -4611,6 +4417,8 @@ self

    +

    Type DETECTION_UNITS.DetectedItem

    + diff --git a/docs/Documentation/Fsm.html b/docs/Documentation/Fsm.html index 769a40841..a809388d5 100644 --- a/docs/Documentation/Fsm.html +++ b/docs/Documentation/Fsm.html @@ -832,6 +832,12 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    + + + + @@ -2473,6 +2479,24 @@ self

    #FSM_PROCESS:

    + + +
    +
    + + +FSM_PROCESS:Remove() + +
    +
    + +

    Removes an FSM_PROCESS object.

    + +

    Return value

    + +

    #FSM_PROCESS:

    + +
    diff --git a/docs/Documentation/Group.html b/docs/Documentation/Group.html index afa5c8eac..9406c83f5 100644 --- a/docs/Documentation/Group.html +++ b/docs/Documentation/Group.html @@ -262,7 +262,7 @@ Use the following Zone validation methods on the group:

    @@ -748,7 +748,7 @@ The category ID

    -

    Returns the category name of the DCS Group.

    +

    Returns the category name of the #GROUP.

    Return value

    diff --git a/docs/Documentation/MOVEMENT.html b/docs/Documentation/MOVEMENT.html index 824e74b60..f81accb1c 100644 --- a/docs/Documentation/MOVEMENT.html +++ b/docs/Documentation/MOVEMENT.html @@ -190,7 +190,6 @@ on defined intervals (currently every minute).

    - #number MOVEMENT.AliveUnits @@ -199,9 +198,6 @@ on defined intervals (currently every minute).

    - -

    Contains the counter how many units are currently alive

    -
    diff --git a/docs/Documentation/Mission.html b/docs/Documentation/Mission.html index 18ec2f81d..eef696f8f 100644 --- a/docs/Documentation/Mission.html +++ b/docs/Documentation/Mission.html @@ -84,18 +84,6 @@ A CLIENT needs to be registered within the MISSION
    - - - - - - - -
    DETECTION_TYPES:AddDetectedItem(TypeName) -

    Adds a new DetectedItem to the DetectedItems list.

    -
    DETECTION_TYPES.ClassName @@ -1158,12 +1126,6 @@ DETECTION_TYPES:DetectedItemReportSummary(Index, DetectedTypeName)

    Report summary of a DetectedItem using a given numeric index.

    -
    DETECTION_TYPES.DetectedItems -
    DETECTION_TYPES:GetDetectedItem(TypeName)DETECTION_TYPES:GetChangeText(DetectedItem) -

    Get a detected item using a given numeric index.

    -
    DETECTION_TYPES:GetDetectedItemsCount() -

    Get the amount of SETs with detected objects.

    -
    DETECTION_TYPES:GetDetectedSet(TypeName) -

    Get the Set#SET_UNIT of a detecttion area using a given numeric index.

    +

    Make text documenting the changes of the detected zone.

    DETECTION_TYPES:New(DetectionSetGroup)

    DETECTION_TYPES constructor.

    -
    DETECTION_TYPES:RemoveDetectedItem(TypeName) -

    Removes an existing DetectedItem from the DetectedItems list.

    DETECTION_UNITS:DetectedItemReportSummary(Index)

    Report summary of a DetectedItem using a given numeric index.

    -
    DETECTION_UNITS.DetectedItems -
    DETECTION_UNITS.DetectionRange

    The range till which targets are detected.

    +
    DETECTION_UNITS:GetChangeText(DetectedItem) +

    Make text documenting the changes of the detected zone.

    FSM_PROCESS:New(Controllable, Task)

    Creates a new FSM_PROCESS object.

    +
    FSM_PROCESS:Remove() +

    Removes an FSM_PROCESS object.

    GROUP:GetCategoryName() -

    Returns the category name of the DCS Group.

    +

    Returns the category name of the #GROUP.

    -
    MISSIONSCHEDULER - -
    _TransportExecuteStage -
    @@ -105,18 +93,6 @@ A CLIENT needs to be registered within the MISSION:AbortUnit(PlayerUnit)

    Aborts a PlayerUnit from the Mission.

    - - - - MISSION.AddClient(CLIENT, self, Client) - -

    Register a new CLIENT to participate within the mission.

    - - - - MISSION.AddGoalFunction(function, self, GoalFunction) - -

    Add a goal function to a MISSION.

    @@ -144,9 +120,9 @@ A CLIENT needs to be registered within the MISSION:Completed() + MISSION:Complete() -

    Set a Mission to completed.

    +

    Synchronous Event Trigger for Event Complete.

    @@ -156,21 +132,9 @@ A CLIENT needs to be registered within the MISSION.FAILED + MISSION:Fail() - - - - - MISSION:Failed() - -

    Set a Mission to failed.

    - - - - MISSION.FindClient(CLIENT, self, ClientName) - -

    Find a CLIENT object within the MISSION by its ClientName.

    +

    Synchronous Event Trigger for Event Fail.

    @@ -222,39 +186,39 @@ A CLIENT needs to be registered within the MISSION.GoalFunction + MISSION.HasGroup(#, self, TaskGroup) - - - - - MISSION:HasGroup(TaskGroup) - - +

    Validates if the Mission has a Group

    MISSION:IsCompleted() -

    Returns if a Mission has completed.

    +

    Is the Mission Completed.

    MISSION:IsFailed() -

    Returns if a Mission has failed.

    +

    Is the Mission Failed.

    + + + + MISSION:IsHold() + +

    Is the Mission Hold.

    + + + + MISSION:IsIdle() + +

    Is the Mission Idle.

    MISSION:IsOngoing() -

    Returns if a Mission is ongoing.

    - - - - MISSION:IsPending() - -

    Returns if a Mission is pending.

    +

    Is the Mission Ongoing.

    @@ -267,54 +231,18 @@ A CLIENT needs to be registered within the MISSION.MissionBriefing - - - - MISSION.MissionCoalition - - MISSION.MissionMenu - - - - MISSION.MissionProgressTrigger - - - - - - MISSION.MissionReportFlash - - - - - - MISSION.MissionReportShow - - - - - - MISSION.MissionReportTrigger - - MISSION.MissionStatus - - - - MISSION.MissionTimeInterval - - @@ -330,21 +258,99 @@ A CLIENT needs to be registered within the MISSION:Ongoing() + MISSION:OnAfterComplete(From, Event, To) -

    Set a Mission to ongoing.

    +

    OnAfter Transition Handler for Event Complete.

    - MISSION:Pending() + MISSION:OnAfterFail(From, Event, To) -

    Set a Mission to pending.

    +

    OnAfter Transition Handler for Event Fail.

    - MISSION.REPEAT + MISSION:OnAfterStart(From, Event, To) - +

    OnAfter Transition Handler for Event Start.

    + + + + MISSION:OnAfterStop(From, Event, To) + +

    OnAfter Transition Handler for Event Stop.

    + + + + MISSION:OnBeforeComplete(From, Event, To) + +

    OnBefore Transition Handler for Event Complete.

    + + + + MISSION:OnBeforeFail(From, Event, To) + +

    OnBefore Transition Handler for Event Fail.

    + + + + MISSION:OnBeforeStart(From, Event, To) + +

    OnBefore Transition Handler for Event Start.

    + + + + MISSION:OnBeforeStop(From, Event, To) + +

    OnBefore Transition Handler for Event Stop.

    + + + + MISSION:OnEnterCompleted(From, Event, To) + +

    OnEnter Transition Handler for State Completed.

    + + + + MISSION:OnEnterFailed(From, Event, To) + +

    OnEnter Transition Handler for State Failed.

    + + + + MISSION:OnEnterIdle(From, Event, To) + +

    OnEnter Transition Handler for State Idle.

    + + + + MISSION:OnEnterOngoing(From, Event, To) + +

    OnEnter Transition Handler for State Ongoing.

    + + + + MISSION:OnLeaveCompleted(From, Event, To) + +

    OnLeave Transition Handler for State Completed.

    + + + + MISSION:OnLeaveFailed(From, Event, To) + +

    OnLeave Transition Handler for State Failed.

    + + + + MISSION:OnLeaveIdle(From, Event, To) + +

    OnLeave Transition Handler for State Idle.

    + + + + MISSION:OnLeaveOngoing(From, Event, To) + +

    OnLeave Transition Handler for State Ongoing.

    @@ -381,18 +387,6 @@ A CLIENT needs to be registered within the MISSION:ReportSummary()

    Create a summary report of the Mission (one line).

    - - - - MISSION:ReportToAll() - -

    Report the status of all MISSIONs to all active Clients.

    - - - - MISSION.SUCCESS - - @@ -414,33 +408,15 @@ A CLIENT needs to be registered within the MISSION:StatusToClients() + MISSION:Start() -

    Send the status of the MISSION to all Clients.

    +

    Synchronous Event Trigger for Event Start.

    - MISSION.TaskCategoryMenus + MISSION:Stop() - - - - - MISSION.TaskMenus - - - - - - MISSION.TaskTypeMenus - - - - - - MISSION._ActiveTasks - - +

    Synchronous Event Trigger for Event Stop.

    @@ -450,137 +426,37 @@ A CLIENT needs to be registered within the MISSION._GoalTasks + MISSION:__Complete(Delay) + +

    Asynchronous Event Trigger for Event Complete.

    + + + + MISSION:__Fail(Delay) + +

    Asynchronous Event Trigger for Event Fail.

    + + + + MISSION:__Start(Delay) + +

    Asynchronous Event Trigger for Event Start.

    + + + + MISSION:__Stop(Delay) + +

    Asynchronous Event Trigger for Event Stop.

    + + + + MISSION:onbeforeComplete(From, Event, To) - MISSION:onbeforeComplete(Event, From, To) - -

    FSM function for a MISSION

    - - - - MISSION:onenterCompleted(Event, From, To) - -

    FSM function for a MISSION

    - - - - -

    Type MISSIONSCHEDULER

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -600,45 +476,6 @@ A CLIENT needs to be registered within the -
    - - #MISSIONSCHEDULER - -MISSIONSCHEDULER - -
    -
    - - - -
    - -
    -
    - - - -_TransportExecuteStage - -
    -
    - - - - -

    _TransportExecuteStage: Defines the different stages of Transport unload/load execution. This table is internal and is used to control the validity of Transport load/unload timing.

    - -
      -
    • _TransportExecuteStage.EXECUTING
    • -
    • _TransportExecuteStage.SUCCESS
    • -
    • _TransportExecuteStage.FAILED
    • -
    - -

    --

    -

    Type Mission

    @@ -683,120 +520,6 @@ true if Unit is part of a Task in the Mission.

    - -MISSION.AddClient(CLIENT, self, Client) - -
    -
    - -

    Register a new CLIENT to participate within the mission.

    - -

    Parameters

    -
      -
    • - -

      CLIENT : -Client is the CLIENT object. The object must have been instantiated with CLIENT.

      - -
    • -
    • - -

      self :

      - -
    • -
    • - -

      Client :

      - -
    • -
    -

    Return value

    - - -

    CLIENT

    - -

    Usage:

    -
    Add a number of Client objects to the Mission.
    -	Mission:AddClient( CLIENT:FindByName( 'US UH-1H*HOT-Deploy Troops 1', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
    -	Mission:AddClient( CLIENT:FindByName( 'US UH-1H*RAMP-Deploy Troops 3', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
    -	Mission:AddClient( CLIENT:FindByName( 'US UH-1H*HOT-Deploy Troops 2', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
    -	Mission:AddClient( CLIENT:FindByName( 'US UH-1H*RAMP-Deploy Troops 4', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
    - -
    -
    -
    -
    - - -MISSION.AddGoalFunction(function, self, GoalFunction) - -
    -
    - -

    Add a goal function to a MISSION.

    - - -

    Goal functions are called when a TASK within a mission has been completed.

    - -

    Parameters

    -
      -
    • - -

      function : -GoalFunction is the function defined by the mission designer to evaluate whether a certain goal has been reached after a TASK finishes within the MISSION. A GoalFunction must accept 2 parameters: Mission, Client, which contains the current MISSION object and the current CLIENT object respectively.

      - -
    • -
    • - -

      self :

      - -
    • -
    • - -

      GoalFunction :

      - -
    • -
    -

    Usage:

    -
     PatriotActivation = { 
    -		{ "US SAM Patriot Zerti", false },
    -		{ "US SAM Patriot Zegduleti", false },
    -		{ "US SAM Patriot Gvleti", false }
    -	}
    -
    -	function DeployPatriotTroopsGoal( Mission, Client )
    -
    -
    -		-- Check if the cargo is all deployed for mission success.
    -		for CargoID, CargoData in pairs( Mission._Cargos ) do
    -			if Group.getByName( CargoData.CargoGroupName ) then
    -				CargoGroup = Group.getByName( CargoData.CargoGroupName )
    -				if CargoGroup then
    -					-- Check if the cargo is ready to activate
    -					CurrentLandingZoneID = routines.IsUnitInZones( CargoGroup:getUnits()[1], Mission:GetTask( 2 ).LandingZones ) -- The second task is the Deploytask to measure mission success upon
    -					if CurrentLandingZoneID then
    -						if PatriotActivation[CurrentLandingZoneID][2] == false then
    -							-- Now check if this is a new Mission Task to be completed...
    -							trigger.action.setGroupAIOn( Group.getByName( PatriotActivation[CurrentLandingZoneID][1] ) )
    -							PatriotActivation[CurrentLandingZoneID][2] = true
    -							MessageToBlue( "Mission Command: Message to all airborne units! The " .. PatriotActivation[CurrentLandingZoneID][1] .. " is armed. Our air defenses are now stronger.", 60, "BLUE/PatriotDefense" )
    -							MessageToRed( "Mission Command: Our satellite systems are detecting additional NATO air defenses. To all airborne units: Take care!!!", 60, "RED/PatriotDefense" )
    -							Mission:GetTask( 2 ):AddGoalCompletion( "Patriots activated", PatriotActivation[CurrentLandingZoneID][1], 1 ) -- Register Patriot activation as part of mission goal.
    -						end
    -					end
    -				end
    -			end
    -		end
    -	end
    -
    -	local Mission = MISSIONSCHEDULER.AddMission( 'NATO Transport Troops', 'Operational', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.', 'NATO' )
    -	Mission:AddGoalFunction( DeployPatriotTroopsGoal )
    - -
    -
    -
    -
    - MISSION:AddScoring(Scoring) @@ -886,13 +609,13 @@ self

    - -MISSION:Completed() + +MISSION:Complete()
    -

    Set a Mission to completed.

    +

    Synchronous Event Trigger for Event Complete.

    @@ -931,68 +654,13 @@ true if Unit is part of a Task in the Mission.

    - #number - -MISSION.FAILED + +MISSION:Fail()
    - - -
    -
    -
    -
    - - -MISSION:Failed() - -
    -
    - -

    Set a Mission to failed.

    - -
    -
    -
    -
    - - -MISSION.FindClient(CLIENT, self, ClientName) - -
    -
    - -

    Find a CLIENT object within the MISSION by its ClientName.

    - -

    Parameters

    -
      -
    • - -

      CLIENT : -ClientName is a string defining the Client Group as defined within the ME.

      - -
    • -
    • - -

      self :

      - -
    • -
    • - -

      ClientName :

      - -
    • -
    -

    Return value

    - - -

    CLIENT

    - -

    Usage:

    -
    -- Seach for Client "Bomber" within the Mission.
    -local BomberClient = Mission:FindClient( "Bomber" )
    +

    Synchronous Event Trigger for Event Fail.

    @@ -1190,40 +858,43 @@ Returns nil if no task was found.

    Tasks = Mission:GetTasks() env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" ) - -
    -
    -
    - - -MISSION.GoalFunction - -
    -
    - - -
    -MISSION:HasGroup(TaskGroup) +MISSION.HasGroup(#, self, TaskGroup)
    +

    Validates if the Mission has a Group

    - -

    Parameter

    +

    Parameters

    • +

      # : +ISSION

      + +
    • +
    • + +

      self :

      + +
    • +
    • +

      TaskGroup :

    +

    Return value

    + +

    #boolean: +true if the Mission has a Group.

    +
    @@ -1235,12 +906,12 @@ env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" )
    -

    Returns if a Mission has completed.

    +

    Is the Mission Completed.

    Return value

    +

    #boolean:

    -

    bool

    @@ -1253,10 +924,48 @@ env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" )
    -

    Returns if a Mission has failed.

    +

    Is the Mission Failed.

    +

    Return value

    + +

    #boolean:

    + + +
    + +
    +
    + + +MISSION:IsHold() + +
    +
    -

    treturn bool

    +

    Is the Mission Hold.

    + +

    Return value

    + +

    #boolean:

    + + +
    +
    +
    +
    + + +MISSION:IsIdle() + +
    +
    + +

    Is the Mission Idle.

    + +

    Return value

    + +

    #boolean:

    +
    @@ -1269,26 +978,12 @@ env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" )
    -

    Returns if a Mission is ongoing.

    +

    Is the Mission Ongoing.

    - -

    treturn bool

    +

    Return value

    + +

    #boolean:

    -
    - -
    -
    - - -MISSION:IsPending() - -
    -
    - -

    Returns if a Mission is pending.

    - - -

    treturn bool

    @@ -1342,20 +1037,6 @@ true if Unit is part of a Task in the Mission.

    - - -
    -
    - - #string - -MISSION.MissionCoalition - -
    -
    - - -
    @@ -1370,62 +1051,6 @@ true if Unit is part of a Task in the Mission.

    - -
    -
    -
    - - #number - -MISSION.MissionProgressTrigger - -
    -
    - - - -
    -
    -
    -
    - - #boolean - -MISSION.MissionReportFlash - -
    -
    - - - -
    -
    -
    -
    - - #boolean - -MISSION.MissionReportShow - -
    -
    - - - -
    -
    -
    -
    - - #number - -MISSION.MissionReportTrigger - -
    -
    - - -
    @@ -1440,20 +1065,6 @@ true if Unit is part of a Task in the Mission.

    - -
    -
    -
    - - #number - -MISSION.MissionTimeInterval - -
    -
    - - -
    @@ -1526,40 +1137,584 @@ self

    - -MISSION:Ongoing() + +MISSION:OnAfterComplete(From, Event, To)
    -

    Set a Mission to ongoing.

    +

    OnAfter Transition Handler for Event Complete.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +
    +
    +
    +
    + + +MISSION:OnAfterFail(From, Event, To) + +
    +
    + +

    OnAfter Transition Handler for Event Fail.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +
    +
    +
    +
    + + +MISSION:OnAfterStart(From, Event, To) + +
    +
    + +

    OnAfter Transition Handler for Event Start.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +
    +
    +
    +
    + + +MISSION:OnAfterStop(From, Event, To) + +
    +
    + +

    OnAfter Transition Handler for Event Stop.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +
    +
    +
    +
    + + +MISSION:OnBeforeComplete(From, Event, To) + +
    +
    + +

    OnBefore Transition Handler for Event Complete.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +

    Return value

    + +

    #boolean: +Return false to cancel Transition.

    - -MISSION:Pending() + +MISSION:OnBeforeFail(From, Event, To)
    -

    Set a Mission to pending.

    +

    OnBefore Transition Handler for Event Fail.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +

    Return value

    + +

    #boolean: +Return false to cancel Transition.

    - #number - -MISSION.REPEAT + +MISSION:OnBeforeStart(From, Event, To)
    +

    OnBefore Transition Handler for Event Start.

    +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +

    Return value

    + +

    #boolean: +Return false to cancel Transition.

    + +
    +
    +
    +
    + + +MISSION:OnBeforeStop(From, Event, To) + +
    +
    + +

    OnBefore Transition Handler for Event Stop.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +

    Return value

    + +

    #boolean: +Return false to cancel Transition.

    + +
    +
    +
    +
    + + +MISSION:OnEnterCompleted(From, Event, To) + +
    +
    + +

    OnEnter Transition Handler for State Completed.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +
    +
    +
    +
    + + +MISSION:OnEnterFailed(From, Event, To) + +
    +
    + +

    OnEnter Transition Handler for State Failed.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +
    +
    +
    +
    + + +MISSION:OnEnterIdle(From, Event, To) + +
    +
    + +

    OnEnter Transition Handler for State Idle.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +
    +
    +
    +
    + + +MISSION:OnEnterOngoing(From, Event, To) + +
    +
    + +

    OnEnter Transition Handler for State Ongoing.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +
    +
    +
    +
    + + +MISSION:OnLeaveCompleted(From, Event, To) + +
    +
    + +

    OnLeave Transition Handler for State Completed.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +

    Return value

    + +

    #boolean: +Return false to cancel Transition.

    + +
    +
    +
    +
    + + +MISSION:OnLeaveFailed(From, Event, To) + +
    +
    + +

    OnLeave Transition Handler for State Failed.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +

    Return value

    + +

    #boolean: +Return false to cancel Transition.

    + +
    +
    +
    +
    + + +MISSION:OnLeaveIdle(From, Event, To) + +
    +
    + +

    OnLeave Transition Handler for State Idle.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +

    Return value

    + +

    #boolean: +Return false to cancel Transition.

    + +
    +
    +
    +
    + + +MISSION:OnLeaveOngoing(From, Event, To) + +
    +
    + +

    OnLeave Transition Handler for State Ongoing.

    + +

    Parameters

    +
      +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    +

    Return value

    + +

    #boolean: +Return false to cancel Transition.

    @@ -1685,33 +1840,6 @@ self

    #string:

    - -
    -
    -
    - - -MISSION:ReportToAll() - -
    -
    - -

    Report the status of all MISSIONs to all active Clients.

    - -
    -
    -
    -
    - - #number - -MISSION.SUCCESS - -
    -
    - - -
    @@ -1776,69 +1904,26 @@ self

    - -MISSION:StatusToClients() + +MISSION:Start()
    -

    Send the status of the MISSION to all Clients.

    +

    Synchronous Event Trigger for Event Start.

    - - -MISSION.TaskCategoryMenus + +MISSION:Stop()
    - - -
    -
    -
    -
    - - - -MISSION.TaskMenus - -
    -
    - - - -
    -
    -
    -
    - - - -MISSION.TaskTypeMenus - -
    -
    - - - -
    -
    -
    -
    - - - -MISSION._ActiveTasks - -
    -
    - - +

    Synchronous Event Trigger for Event Stop.

    @@ -1859,43 +1944,124 @@ self

    - - -MISSION._GoalTasks + +MISSION:__Complete(Delay)
    +

    Asynchronous Event Trigger for Event Complete.

    +

    Parameter

    +
      +
    • + +

      #number Delay : +The delay in seconds.

      +
    • +
    +
    +
    +
    +
    + + +MISSION:__Fail(Delay) + +
    +
    + +

    Asynchronous Event Trigger for Event Fail.

    + +

    Parameter

    +
      +
    • + +

      #number Delay : +The delay in seconds.

      + +
    • +
    +
    +
    +
    +
    + + +MISSION:__Start(Delay) + +
    +
    + +

    Asynchronous Event Trigger for Event Start.

    + +

    Parameter

    +
      +
    • + +

      #number Delay : +The delay in seconds.

      + +
    • +
    +
    +
    +
    +
    + + +MISSION:__Stop(Delay) + +
    +
    + +

    Asynchronous Event Trigger for Event Stop.

    + +

    Parameter

    +
      +
    • + +

      #number Delay : +The delay in seconds.

      + +
    • +
    -MISSION:onbeforeComplete(Event, From, To) +MISSION:onbeforeComplete(From, Event, To)
    -

    FSM function for a MISSION

    + + + +

    FSM function for a MISSION + @param #MISSION self + @param #string From + @param #string Event + @param #string To

    Parameters

    • -

      #string Event :

      +

      From :

    • -

      #string From :

      +

      Event :

    • -

      #string To :

      +

      To :

    @@ -1905,28 +2071,35 @@ self

    -MISSION:onenterCompleted(Event, From, To) +MISSION:onenterCompleted(From, Event, To)
    -

    FSM function for a MISSION

    + + + +

    FSM function for a MISSION + @param #MISSION self + @param #string From + @param #string Event + @param #string To

    Parameters

    • -

      #string Event :

      +

      From :

    • -

      #string From :

      +

      Event :

    • -

      #string To :

      +

      To :

    @@ -1935,402 +2108,6 @@ self

    Type MISSION.Clients

    -

    Type MISSIONSCHEDULER

    - -

    The MISSIONSCHEDULER is an OBJECT and is the main scheduler of ALL active MISSIONs registered within this scheduler.

    - - -

    It's workings are considered internal and is automatically created when the Mission.lua file is included.

    - -

    Field(s)

    -
    -
    - - -MISSIONSCHEDULER.AddMission(Mission) - -
    -
    - -

    This is the main MISSION declaration method.

    - - -

    Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc.

    - -

    Parameter

    -
      -
    • - -

      Mission : -is the MISSION object instantiated by MISSION.

      - -
    • -
    -

    Return value

    - - -

    MISSION

    - -

    Usage:

    -
    
    --- Declare a mission.
    -Mission = MISSION:New( 'Russia Transport Troops SA-6', 
    -                       'Operational', 
    -                       'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', 
    -                       'Russia' )
    -MISSIONSCHEDULER:AddMission( Mission )
    - -
    -
    -
    -
    - - -MISSIONSCHEDULER.FindMission(MissionName) - -
    -
    - -

    Find a MISSION within the MISSIONSCHEDULER.

    - -

    Parameter

    -
      -
    • - -

      MissionName : -is the name of the MISSION given at declaration using AddMission.

      - -
    • -
    -

    Return value

    - - -

    MISSION

    - -

    Usage:

    -
    -- Declare a mission.
    -Mission = MISSION:New( 'Russia Transport Troops SA-6', 
    -                       'Operational', 
    -                       'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', 
    -                       'Russia' )
    -MISSIONSCHEDULER:AddMission( Mission )
    -
    --- Now find the Mission.
    -MissionFind = MISSIONSCHEDULER:FindMission( 'Russia Transport Troops SA-6' )
    - -
    -
    -
    -
    - - #number - -MISSIONSCHEDULER.MissionCount - -
    -
    - - - -
    -
    -
    -
    - - #MISSIONSCHEDULER.MISSIONS - -MISSIONSCHEDULER.Missions - -
    -
    - - - -
    -
    -
    -
    - - -MISSIONSCHEDULER.RemoveMission(MissionName) - -
    -
    - -

    Remove a MISSION from the MISSIONSCHEDULER.

    - -

    Parameter

    -
      -
    • - -

      MissionName : -is the name of the MISSION given at declaration using AddMission.

      - -
    • -
    -

    Usage:

    -
    -- Declare a mission.
    -Mission = MISSION:New( 'Russia Transport Troops SA-6', 
    -                       'Operational', 
    -                       'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', 
    -                       'Russia' )
    -MISSIONSCHEDULER:AddMission( Mission )
    -
    --- Now remove the Mission.
    -MISSIONSCHEDULER:RemoveMission( 'Russia Transport Troops SA-6' )
    - -
    -
    -
    -
    - - -MISSIONSCHEDULER.ReportMenu() - -
    -
    - -

    Enables a MENU option in the communications menu under F10 to control the status of the active missions.

    - - -

    This function should be called only once when starting the MISSIONSCHEDULER.

    - -
    -
    -
    -
    - - -MISSIONSCHEDULER.ReportMissionsFlash(TimeInterval) - -
    -
    - - - - -

    Internal function used by the MISSIONSCHEDULER menu.

    - -

    Parameter

    -
      -
    • - -

      TimeInterval :

      - -
    • -
    -
    -
    -
    -
    - - -MISSIONSCHEDULER.ReportMissionsHide(Prm) - -
    -
    - - - - -

    Internal function used by the MISSIONSCHEDULER menu.

    - -

    Parameter

    -
      -
    • - -

      Prm :

      - -
    • -
    -
    -
    -
    -
    - - -MISSIONSCHEDULER.ReportMissionsShow() - -
    -
    - - - - -

    Internal function used by the MISSIONSCHEDULER menu.

    - -
    -
    -
    -
    - - -MISSIONSCHEDULER.Scheduler() - -
    -
    - -

    This is the main MISSIONSCHEDULER Scheduler function.

    - - -

    It is considered internal and is automatically created when the Mission.lua file is included.

    - -
    -
    -
    -
    - - - -MISSIONSCHEDULER.SchedulerId - -
    -
    - - - - -

    MISSIONSCHEDULER.SchedulerId = routines.scheduleFunction( MISSIONSCHEDULER.Scheduler, { }, 0, 2 )

    - -
    -
    -
    -
    - - -MISSIONSCHEDULER:Scoring(Scoring) - -
    -
    - -

    Adds a mission scoring to the game.

    - -

    Parameter

    -
      -
    • - -

      Scoring :

      - -
    • -
    -
    -
    -
    -
    - - -MISSIONSCHEDULER.Start() - -
    -
    - -

    Start the MISSIONSCHEDULER.

    - -
    -
    -
    -
    - - -MISSIONSCHEDULER.Stop() - -
    -
    - -

    Stop the MISSIONSCHEDULER.

    - -
    -
    -
    -
    - - -MISSIONSCHEDULER:Time(TimeSeconds, TimeIntervalShow, TimeShow) - -
    -
    - - - -

    Parameters

    -
      -
    • - -

      TimeSeconds :

      - -
    • -
    • - -

      TimeIntervalShow :

      - -
    • -
    • - -

      TimeShow :

      - -
    • -
    -
    -
    -
    -
    - - #number - -MISSIONSCHEDULER.TimeIntervalCount - -
    -
    - - - -
    -
    -
    -
    - - #number - -MISSIONSCHEDULER.TimeIntervalShow - -
    -
    - - - -
    -
    -
    -
    - - #number - -MISSIONSCHEDULER.TimeSeconds - -
    -
    - - - -
    -
    -
    -
    - - #number - -MISSIONSCHEDULER.TimeShow - -
    -
    - - - -
    -
    - -

    Type MISSIONSCHEDULER.MISSIONS

    -

    Type SCORING

    diff --git a/docs/Documentation/ScheduleDispatcher.html b/docs/Documentation/ScheduleDispatcher.html index 298ef4de0..c2bc197cc 100644 --- a/docs/Documentation/ScheduleDispatcher.html +++ b/docs/Documentation/ScheduleDispatcher.html @@ -342,7 +342,7 @@ Nothing of this code should be modified without testing it thoroughly.

    -

    setmetatable( {}, { __mode = "v" } )

    +

    or {}

    diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html index 6422bbc81..65c4b81cc 100644 --- a/docs/Documentation/Spawn.html +++ b/docs/Documentation/Spawn.html @@ -1870,6 +1870,9 @@ The group that was spawned. You can use this group for further actions.

    + +

    Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.

    +
    @@ -2323,6 +2326,9 @@ when nothing was spawned.

    + +

    Overwrite unit names by default with group name.

    +
    @@ -2710,7 +2716,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
    - + #boolean SPAWN.SpawnUnControlled diff --git a/docs/Documentation/Task.html b/docs/Documentation/Task.html index 5093f8138..d7aa1af49 100644 --- a/docs/Documentation/Task.html +++ b/docs/Documentation/Task.html @@ -297,12 +297,24 @@ Use the method TASK.AddScore() to add scores whe
    + + + + + + + + @@ -354,9 +366,9 @@ Use the method TASK.AddScore() to add scores whe - + @@ -537,12 +549,24 @@ Use the method TASK.AddScore() to add scores whe + + + + + + + + @@ -1299,6 +1323,19 @@ self

    #boolean:

    + + +
    +
    + + +TASK:IsStateAborted() + +
    +
    + +

    Is the Task status Aborted.

    +
    @@ -1317,6 +1354,19 @@ self

    + +TASK:IsStateCancelled() + +
    +
    + +

    Is the Task status Cancelled.

    + +
    +
    +
    +
    + TASK:IsStateFailed() @@ -1456,18 +1506,18 @@ true if Unit is part of the Task.

    -TASK.MenuTaskAbort(MenuParam) +TASK:MenuTaskAbort(TaskGroup)
    - +

    Report the task status.

    Parameter

    • -

      MenuParam :

      +

      TaskGroup :

    @@ -2143,6 +2193,19 @@ Fsm#FSM_PROCESS

    + +TASK:StateAborted() + +
    +
    + +

    Sets a Task to status Aborted.

    + +
    +
    +
    +
    + TASK:StateAssigned() @@ -2156,6 +2219,19 @@ Fsm#FSM_PROCESS

    + +TASK:StateCancelled() + +
    +
    + +

    Sets a Task to status Cancelled.

    + +
    +
    +
    +
    + TASK:StateFailed() diff --git a/docs/Documentation/Task_A2G_Dispatcher.html b/docs/Documentation/Task_A2G_Dispatcher.html index a6b227934..dfdf88251 100644 --- a/docs/Documentation/Task_A2G_Dispatcher.html +++ b/docs/Documentation/Task_A2G_Dispatcher.html @@ -153,13 +153,13 @@ Find a summary below describing for which situation a task type is created:

    - + - + @@ -270,7 +270,7 @@ Find a summary below describing for which situation a task type is created:

    -TASK_A2G_DISPATCHER:EvaluateBAI(DetectedArea, FriendlyCoalition) +TASK_A2G_DISPATCHER:EvaluateBAI(DetectedItem, FriendlyCoalition)
    @@ -281,7 +281,7 @@ Find a summary below describing for which situation a task type is created:

    + + + + @@ -693,6 +699,24 @@ The DCS Unit is not existing or alive.

    + +UNIT:GetCategoryName() + +
    +
    + +

    Returns the category name of the #UNIT.

    + +

    Return value

    + +

    #string: +Category name = Helicopter, Airplane, Ground Unit, Ship

    + +
    +
    +
    +
    + UNIT:GetDCSObject()
    MISSIONSCHEDULER.AddMission(Mission) -

    This is the main MISSION declaration method.

    -
    MISSIONSCHEDULER.FindMission(MissionName) -

    Find a MISSION within the MISSIONSCHEDULER.

    -
    MISSIONSCHEDULER.MissionCount - -
    MISSIONSCHEDULER.Missions - -
    MISSIONSCHEDULER.RemoveMission(MissionName) -

    Remove a MISSION from the MISSIONSCHEDULER.

    -
    MISSIONSCHEDULER.ReportMenu() -

    Enables a MENU option in the communications menu under F10 to control the status of the active missions.

    -
    MISSIONSCHEDULER.ReportMissionsFlash(TimeInterval) - -
    MISSIONSCHEDULER.ReportMissionsHide(Prm) - -
    MISSIONSCHEDULER.ReportMissionsShow() - -
    MISSIONSCHEDULER.Scheduler() -

    This is the main MISSIONSCHEDULER Scheduler function.

    -
    MISSIONSCHEDULER.SchedulerId - -
    MISSIONSCHEDULER:Scoring(Scoring) -

    Adds a mission scoring to the game.

    -
    MISSIONSCHEDULER.Start() -

    Start the MISSIONSCHEDULER.

    -
    MISSIONSCHEDULER.Stop() -

    Stop the MISSIONSCHEDULER.

    -
    MISSIONSCHEDULER:Time(TimeSeconds, TimeIntervalShow, TimeShow) - -
    MISSIONSCHEDULER.TimeIntervalCount - -
    MISSIONSCHEDULER.TimeIntervalShow - -
    MISSIONSCHEDULER.TimeSeconds - -
    MISSIONSCHEDULER.TimeShowMISSION:onenterCompleted(From, Event, To) TASK:IsAssignedToGroup(TaskGroup)

    Returns if the Task is assigned to the Group.

    +
    TASK:IsStateAborted() +

    Is the Task status Aborted.

    TASK:IsStateAssigned()

    Is the Task status Assigned.

    +
    TASK:IsStateCancelled() +

    Is the Task status Cancelled.

    TASK.MenuTaskAbort(MenuParam)TASK:MenuTaskAbort(TaskGroup) - +

    Report the task status.

    TASK:SetUnitProcess(Core, FsmTemplate)

    Sets the Task FSM Process Template

    +
    TASK:StateAborted() +

    Sets a Task to status Aborted.

    TASK:StateAssigned()

    Sets a Task to status Assigned.

    +
    TASK:StateCancelled() +

    Sets a Task to status Cancelled.

    TASK_A2G_DISPATCHER:EvaluateBAI(DetectedArea, FriendlyCoalition)TASK_A2G_DISPATCHER:EvaluateBAI(DetectedItem, FriendlyCoalition)

    Creates a BAI task when there are targets for it.

    TASK_A2G_DISPATCHER:EvaluateCAS(DetectedArea)TASK_A2G_DISPATCHER:EvaluateCAS(DetectedItem)

    Creates a CAS task when there are targets for it.

    UNIT:GetCallsign()

    Returns the Unit's callsign - the localized string.

    +
    UNIT:GetCategoryName() +

    Returns the category name of the #UNIT.