* Merge changes from Develop
This commit is contained in:
Applevangelist 2022-09-10 11:41:41 +02:00
parent a61059242c
commit c58e91b956
3 changed files with 54 additions and 50 deletions

View File

@ -216,7 +216,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
local MenuReporting = MENU_GROUP:New( EventGroup, "Missions Reports", CommandCenterMenu ) local MenuReporting = MENU_GROUP:New( EventGroup, "Missions Reports", CommandCenterMenu )
local MenuMissionsSummary = MENU_GROUP_COMMAND:New( EventGroup, "Missions Status Report", MenuReporting, self.ReportSummary, self, EventGroup ) local MenuMissionsSummary = MENU_GROUP_COMMAND:New( EventGroup, "Missions Status Report", MenuReporting, self.ReportSummary, self, EventGroup )
local MenuMissionsDetails = MENU_GROUP_COMMAND:New( EventGroup, "Missions Players Report", MenuReporting, self.ReportMissionsPlayers, self, EventGroup ) local MenuMissionsDetails = MENU_GROUP_COMMAND:New( EventGroup, "Missions Players Report", MenuReporting, self.ReportMissionsPlayers, self, EventGroup )
self:ReportSummary( EventGroup ) --self:ReportSummary( EventGroup )
local PlayerUnit = EventData.IniUnit local PlayerUnit = EventData.IniUnit
for MissionID, Mission in pairs( self:GetMissions() ) do for MissionID, Mission in pairs( self:GetMissions() ) do
local Mission = Mission -- Tasking.Mission#MISSION local Mission = Mission -- Tasking.Mission#MISSION
@ -560,9 +560,11 @@ function COMMANDCENTER:SetAutoAssignTasks( AutoAssign )
self.AutoAssignTasks = AutoAssign or false self.AutoAssignTasks = AutoAssign or false
if self.AutoAssignTasks == true then if self.AutoAssignTasks == true then
self:ScheduleRepeat( 10, 30, 0, nil, self.AssignTasks, self ) self.autoAssignTasksScheduleID=self:ScheduleRepeat( 10, 30, 0, nil, self.AssignTasks, self )
else else
self:ScheduleStop( self.AssignTasks ) self:ScheduleStop()
-- FF this is not the schedule ID
--self:ScheduleStop( self.AssignTasks )
end end
end end

View File

@ -683,6 +683,7 @@ do -- TASK_CARGO_DISPATCHER
-- If no TaskPrefix is given, then "Transport" will be used as the prefix. -- If no TaskPrefix is given, then "Transport" will be used as the prefix.
-- @param Core.SetCargo#SET_CARGO SetCargo The SetCargo to be transported. -- @param Core.SetCargo#SET_CARGO SetCargo The SetCargo to be transported.
-- @param #string Briefing The briefing of the task transport to be shown to the player. -- @param #string Briefing The briefing of the task transport to be shown to the player.
-- @param #boolean Silent If true don't send a message that a new task is available.
-- @return Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT -- @return Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT
-- @usage -- @usage
-- --
@ -705,10 +706,12 @@ do -- TASK_CARGO_DISPATCHER
-- -- Here we set a TransportDeployZone. We use the WorkplaceTask as the reference, and provide a ZONE object. -- -- Here we set a TransportDeployZone. We use the WorkplaceTask as the reference, and provide a ZONE object.
-- TaskDispatcher:SetTransportDeployZone( WorkplaceTask, ZONE:New( "Workplace" ) ) -- TaskDispatcher:SetTransportDeployZone( WorkplaceTask, ZONE:New( "Workplace" ) )
-- --
function TASK_CARGO_DISPATCHER:AddTransportTask( TaskPrefix, SetCargo, Briefing ) function TASK_CARGO_DISPATCHER:AddTransportTask( TaskPrefix, SetCargo, Briefing, Silent )
self.TransportCount = self.TransportCount + 1 self.TransportCount = self.TransportCount + 1
local verbose = Silent or false
local TaskName = string.format( ( TaskPrefix or "Transport" ) .. ".%03d", self.TransportCount ) local TaskName = string.format( ( TaskPrefix or "Transport" ) .. ".%03d", self.TransportCount )
self.Transport[TaskName] = {} self.Transport[TaskName] = {}
@ -717,7 +720,7 @@ do -- TASK_CARGO_DISPATCHER
self.Transport[TaskName].Task = nil self.Transport[TaskName].Task = nil
self.Transport[TaskName].TaskPrefix = TaskPrefix self.Transport[TaskName].TaskPrefix = TaskPrefix
self:ManageTasks() self:ManageTasks(verbose)
return self.Transport[TaskName] and self.Transport[TaskName].Task return self.Transport[TaskName] and self.Transport[TaskName].Task
end end
@ -785,10 +788,11 @@ do -- TASK_CARGO_DISPATCHER
--- Assigns tasks to the @{Core.Set#SET_GROUP}. --- Assigns tasks to the @{Core.Set#SET_GROUP}.
-- @param #TASK_CARGO_DISPATCHER self -- @param #TASK_CARGO_DISPATCHER self
-- @param #boolean Silent Announce new task (nil/false) or not (true).
-- @return #boolean Return true if you want the task assigning to continue... false will cancel the loop. -- @return #boolean Return true if you want the task assigning to continue... false will cancel the loop.
function TASK_CARGO_DISPATCHER:ManageTasks() function TASK_CARGO_DISPATCHER:ManageTasks(Silent)
self:F() self:F()
local verbose = Silent and true
local AreaMsg = {} local AreaMsg = {}
local TaskMsg = {} local TaskMsg = {}
local ChangeMsg = {} local ChangeMsg = {}
@ -897,7 +901,7 @@ do -- TASK_CARGO_DISPATCHER
local TaskText = TaskReport:Text(", ") local TaskText = TaskReport:Text(", ")
for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
if ( not Mission:IsGroupAssigned(TaskGroup) ) and TaskText ~= "" then if ( not Mission:IsGroupAssigned(TaskGroup) ) and TaskText ~= "" and not verbose then
Mission:GetCommandCenter():MessageToGroup( string.format( "%s has tasks %s. Subscribe to a task using the radio menu.", Mission:GetShortText(), TaskText ), TaskGroup ) Mission:GetCommandCenter():MessageToGroup( string.format( "%s has tasks %s. Subscribe to a task using the radio menu.", Mission:GetShortText(), TaskText ), TaskGroup )
end end
end end

View File

@ -2,7 +2,7 @@
-- --
-- **Specific features:** -- **Specific features:**
-- --
-- * Creates a task to transport @{Cargo.Cargo} to and between deployment zones. -- * Creates a task to transport #Cargo.Cargo to and between deployment zones.
-- * Derived from the TASK_CARGO class, which is derived from the TASK class. -- * Derived from the TASK_CARGO class, which is derived from the TASK class.
-- * Orchestrate the task flow, so go from Planned to Assigned to Success, Failed or Cancelled. -- * Orchestrate the task flow, so go from Planned to Assigned to Success, Failed or Cancelled.
-- * Co-operation tasking, so a player joins a group of players executing the same task. -- * Co-operation tasking, so a player joins a group of players executing the same task.
@ -44,7 +44,7 @@
-- --
-- === -- ===
-- --
-- Please read through the @{Tasking.Task_Cargo} process to understand the mechanisms of tasking and cargo tasking and handling. -- Please read through the #Tasking.Task_Cargo process to understand the mechanisms of tasking and cargo tasking and handling.
-- --
-- Enjoy! -- Enjoy!
-- FC -- FC
@ -57,7 +57,7 @@
do -- TASK_CARGO_TRANSPORT do -- TASK_CARGO_TRANSPORT
--- @type TASK_CARGO_TRANSPORT -- @type TASK_CARGO_TRANSPORT
-- @extends Tasking.Task_CARGO#TASK_CARGO -- @extends Tasking.Task_CARGO#TASK_CARGO
--- Orchestrates the task for players to transport cargo to or between deployment zones. --- Orchestrates the task for players to transport cargo to or between deployment zones.
@ -76,7 +76,7 @@ do -- TASK_CARGO_TRANSPORT
-- --
-- ## 1.1) Create a command center. -- ## 1.1) Create a command center.
-- --
-- First you need to create a command center using the @{Tasking.CommandCenter#COMMANDCENTER.New}() constructor. -- First you need to create a command center using the Tasking.CommandCenter#COMMANDCENTER.New constructor.
-- --
-- local CommandCenter = COMMANDCENTER -- local CommandCenter = COMMANDCENTER
-- :New( HQ, "Lima" ) -- Create the CommandCenter. -- :New( HQ, "Lima" ) -- Create the CommandCenter.
@ -85,7 +85,7 @@ do -- TASK_CARGO_TRANSPORT
-- --
-- Tasks work in a mission, which groups these tasks to achieve a joint mission goal. -- Tasks work in a mission, which groups these tasks to achieve a joint mission goal.
-- A command center can govern multiple missions. -- A command center can govern multiple missions.
-- Create a new mission, using the @{Tasking.Mission#MISSION.New}() constructor. -- Create a new mission, using the Tasking.Mission#MISSION.New constructor.
-- --
-- -- Declare the Mission for the Command Center. -- -- Declare the Mission for the Command Center.
-- local Mission = MISSION -- local Mission = MISSION
@ -99,7 +99,7 @@ do -- TASK_CARGO_TRANSPORT
-- ## 1.3) Create the transport cargo task. -- ## 1.3) Create the transport cargo task.
-- --
-- So, now that we have a command center and a mission, we now create the transport task. -- So, now that we have a command center and a mission, we now create the transport task.
-- We create the transport task using the @{#TASK_CARGO_TRANSPORT.New}() constructor. -- We create the transport task using the #TASK_CARGO_TRANSPORT.New constructor.
-- --
-- Because a transport task will not generate the cargo itself, you'll need to create it first. -- Because a transport task will not generate the cargo itself, you'll need to create it first.
-- The cargo in this case will be the downed pilot! -- The cargo in this case will be the downed pilot!
@ -118,7 +118,7 @@ do -- TASK_CARGO_TRANSPORT
-- -- The cargoset "CargoSet" will embed all defined cargo of type "Pilots" (prefix) into its set. -- -- The cargoset "CargoSet" will embed all defined cargo of type "Pilots" (prefix) into its set.
-- local CargoGroup = CARGO_GROUP:New( PilotGroup, "Cargo", "Engineer Team 1", 500 ) -- local CargoGroup = CARGO_GROUP:New( PilotGroup, "Cargo", "Engineer Team 1", 500 )
-- --
-- What is also needed, is to have a set of @{Core.Group}s defined that contains the clients of the players. -- What is also needed, is to have a set of Core.Groups defined that contains the clients of the players.
-- --
-- -- Allocate the Transport, which are the helicopter to retrieve the pilot, that can be manned by players. -- -- Allocate the Transport, which are the helicopter to retrieve the pilot, that can be manned by players.
-- local GroupSet = SET_GROUP:New():FilterPrefixes( "Transport" ):FilterStart() -- local GroupSet = SET_GROUP:New():FilterPrefixes( "Transport" ):FilterStart()
@ -139,10 +139,10 @@ do -- TASK_CARGO_TRANSPORT
-- By doing this, cargo transport tasking will become a dynamic experience. -- By doing this, cargo transport tasking will become a dynamic experience.
-- --
-- --
-- # 2) Create a task using the @{Tasking.Task_Cargo_Dispatcher} module. -- # 2) Create a task using the Tasking.Task_Cargo_Dispatcher module.
-- --
-- Actually, it is better to **GENERATE** these tasks using the @{Tasking.Task_Cargo_Dispatcher} module. -- Actually, it is better to **GENERATE** these tasks using the Tasking.Task_Cargo_Dispatcher module.
-- Using the dispatcher module, transport tasks can be created much more easy. -- Using the dispatcher module, transport tasks can be created easier.
-- --
-- Find below an example how to use the TASK_CARGO_DISPATCHER class: -- Find below an example how to use the TASK_CARGO_DISPATCHER class:
-- --
@ -189,7 +189,7 @@ do -- TASK_CARGO_TRANSPORT
-- In order to properly capture the events and avoid mistakes using the documentation, it is advised that you execute the following actions: -- In order to properly capture the events and avoid mistakes using the documentation, it is advised that you execute the following actions:
-- --
-- * **Copy / Paste** the code section into your script. -- * **Copy / Paste** the code section into your script.
-- * **Change** the CLASS literal to the task object name you have in your script. -- * **Change** the "myclass" literal to the task object name you have in your script.
-- * Within the function, you can now **write your own code**! -- * Within the function, you can now **write your own code**!
-- * **IntelliSense** will recognize the type of the variables provided by the function. Note: the From, Event and To variables can be safely ignored, -- * **IntelliSense** will recognize the type of the variables provided by the function. Note: the From, Event and To variables can be safely ignored,
-- but you need to declare them as they are automatically provided by the event handling system of MOOSE. -- but you need to declare them as they are automatically provided by the event handling system of MOOSE.
@ -210,14 +210,13 @@ do -- TASK_CARGO_TRANSPORT
-- If you want to code your own event handler, use this code fragment to tailor the event when a player carrier has picked up a cargo object in the CarrierGroup. -- If you want to code your own event handler, use this code fragment to tailor the event when a player carrier has picked up a cargo object in the CarrierGroup.
-- You can use this event handler to post messages to players, or provide status updates etc. -- You can use this event handler to post messages to players, or provide status updates etc.
-- --
-- --- CargoPickedUp event handler OnAfter for CLASS. -- --- CargoPickedUp event handler OnAfter for "myclass".
-- -- @param #CLASS self
-- -- @param #string From A string that contains the "*from state name*" when the event was triggered. -- -- @param #string From A string that contains the "*from state name*" when the event was triggered.
-- -- @param #string Event A string that contains the "*event name*" when the event was triggered. -- -- @param #string Event A string that contains the "*event name*" when the event was triggered.
-- -- @param #string To A string that contains the "*to state name*" when the event was triggered. -- -- @param #string To A string that contains the "*to state name*" when the event was triggered.
-- -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has picked up the cargo. -- -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has picked up the cargo.
-- -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been picked up. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object! -- -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been picked up. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object!
-- function CLASS:OnAfterCargoPickedUp( From, Event, To, TaskUnit, Cargo ) -- function myclass:OnAfterCargoPickedUp( From, Event, To, TaskUnit, Cargo )
-- --
-- -- Write here your own code. -- -- Write here your own code.
-- --
@ -240,15 +239,14 @@ do -- TASK_CARGO_TRANSPORT
-- You can use this event handler to post messages to players, or provide status updates etc. -- You can use this event handler to post messages to players, or provide status updates etc.
-- --
-- --
-- --- CargoDeployed event handler OnAfter for CLASS. -- --- CargoDeployed event handler OnAfter foR "myclass".
-- -- @param #CLASS self
-- -- @param #string From A string that contains the "*from state name*" when the event was triggered. -- -- @param #string From A string that contains the "*from state name*" when the event was triggered.
-- -- @param #string Event A string that contains the "*event name*" when the event was triggered. -- -- @param #string Event A string that contains the "*event name*" when the event was triggered.
-- -- @param #string To A string that contains the "*to state name*" when the event was triggered. -- -- @param #string To A string that contains the "*to state name*" when the event was triggered.
-- -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has deployed the cargo. -- -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has deployed the cargo.
-- -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been deployed. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object! -- -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been deployed. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object!
-- -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -- -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
-- function CLASS:OnAfterCargoDeployed( From, Event, To, TaskUnit, Cargo, DeployZone ) -- function myclass:OnAfterCargoDeployed( From, Event, To, TaskUnit, Cargo, DeployZone )
-- --
-- -- Write here your own code. -- -- Write here your own code.
-- --