mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Changes.
This commit is contained in:
parent
86fab3985b
commit
d037614861
@ -1929,17 +1929,20 @@ do -- COORDINATE
|
||||
-- @param Core.Settings#SETTINGS Settings
|
||||
-- @param Tasking.Task#TASK Task The task for which coordinates need to be calculated.
|
||||
-- @return #string The coordinate Text in the configured coordinate system.
|
||||
function COORDINATE:ToString( Controllable, Settings, Task ) -- R2.2
|
||||
function COORDINATE:ToString( Controllable, Settings, Task )
|
||||
|
||||
self:F2( { Controllable = Controllable and Controllable:GetName() } )
|
||||
|
||||
local Settings = Settings or ( Controllable and _DATABASE:GetPlayerSettings( Controllable:GetPlayerName() ) ) or _SETTINGS
|
||||
|
||||
local ModeA2A = false
|
||||
self:E('A2A false')
|
||||
|
||||
if Task then
|
||||
self:E('Task ' .. Task.ClassName )
|
||||
if Task:IsInstanceOf( TASK_A2A ) then
|
||||
ModeA2A = true
|
||||
self:E('A2A true')
|
||||
else
|
||||
if Task:IsInstanceOf( TASK_A2G ) then
|
||||
ModeA2A = false
|
||||
|
||||
@ -3119,6 +3119,26 @@ do -- SET_STATIC
|
||||
|
||||
end
|
||||
|
||||
--- Calculate the maxium A2G threat level of the SET_STATIC.
|
||||
-- @param #SET_STATIC self
|
||||
-- @return #number The maximum threatlevel
|
||||
function SET_STATIC:CalculateThreatLevelA2G()
|
||||
|
||||
local MaxThreatLevelA2G = 0
|
||||
local MaxThreatText = ""
|
||||
for StaticName, StaticData in pairs( self:GetSet() ) do
|
||||
local ThreatStatic = StaticData -- Wrapper.Static#STATIC
|
||||
local ThreatLevelA2G, ThreatText = ThreatStatic:GetThreatLevel()
|
||||
if ThreatLevelA2G > MaxThreatLevelA2G then
|
||||
MaxThreatLevelA2G = ThreatLevelA2G
|
||||
MaxThreatText = ThreatText
|
||||
end
|
||||
end
|
||||
|
||||
self:F( { MaxThreatLevelA2G = MaxThreatLevelA2G, MaxThreatText = MaxThreatText } )
|
||||
return MaxThreatLevelA2G, MaxThreatText
|
||||
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #SET_STATIC self
|
||||
|
||||
@ -1204,7 +1204,7 @@ function TASK:MenuMarkToGroup( TaskGroup )
|
||||
if TargetCoordinates then
|
||||
for TargetCoordinateID, TargetCoordinate in pairs( TargetCoordinates ) do
|
||||
local Report = REPORT:New():SetIndent( 0 )
|
||||
self.TaskInfo:Report( Report, "M", TaskGroup, TargetCoordinateID )
|
||||
self.TaskInfo:Report( Report, "M", TaskGroup, self )
|
||||
local MarkText = Report:Text( ", " )
|
||||
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
||||
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
||||
@ -1214,7 +1214,7 @@ function TASK:MenuMarkToGroup( TaskGroup )
|
||||
local TargetCoordinate = self.TaskInfo:GetData( "Coordinate" ) -- Core.Point#COORDINATE
|
||||
if TargetCoordinate then
|
||||
local Report = REPORT:New():SetIndent( 0 )
|
||||
self.TaskInfo:Report( Report, "M", TaskGroup )
|
||||
self.TaskInfo:Report( Report, "M", TaskGroup, self )
|
||||
local MarkText = Report:Text( ", " )
|
||||
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
||||
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
||||
@ -1751,7 +1751,7 @@ function TASK:ReportSummary( ReportGroup )
|
||||
-- Determine the status of the Task.
|
||||
Report:Add( "State: <" .. self:GetState() .. ">" )
|
||||
|
||||
self.TaskInfo:Report( Report, "S", ReportGroup )
|
||||
self.TaskInfo:Report( Report, "S", ReportGroup, self )
|
||||
|
||||
return Report:Text( ', ' )
|
||||
end
|
||||
@ -1768,7 +1768,7 @@ function TASK:ReportOverview( ReportGroup )
|
||||
local TaskName = self:GetName()
|
||||
local Report = REPORT:New()
|
||||
|
||||
self.TaskInfo:Report( Report, "O", ReportGroup )
|
||||
self.TaskInfo:Report( Report, "O", ReportGroup, self )
|
||||
|
||||
return Report:Text()
|
||||
end
|
||||
@ -1852,7 +1852,7 @@ function TASK:ReportDetails( ReportGroup )
|
||||
Report:AddIndent( Players )
|
||||
end
|
||||
|
||||
self.TaskInfo:Report( Report, "D", ReportGroup )
|
||||
self.TaskInfo:Report( Report, "D", ReportGroup, self )
|
||||
|
||||
return Report:Text()
|
||||
end
|
||||
|
||||
@ -284,8 +284,9 @@ end
|
||||
-- @param Core.Report#REPORT Report
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @param Wrapper.Group#GROUP ReportGroup
|
||||
-- @param Tasking.Task#TASK Task
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:Report( Report, Detail, ReportGroup )
|
||||
function TASKINFO:Report( Report, Detail, ReportGroup, Task )
|
||||
|
||||
local Line = 0
|
||||
local LineReport = REPORT:New()
|
||||
@ -306,7 +307,7 @@ function TASKINFO:Report( Report, Detail, ReportGroup )
|
||||
end
|
||||
if Key == "Coordinate" then
|
||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||
Text = Coordinate:ToString( ReportGroup:GetUnit(1), nil, self )
|
||||
Text = Coordinate:ToString( ReportGroup:GetUnit(1), nil, Task )
|
||||
end
|
||||
if Key == "Threat" then
|
||||
local DataText = Data.Data -- #string
|
||||
@ -322,15 +323,15 @@ function TASKINFO:Report( Report, Detail, ReportGroup )
|
||||
end
|
||||
if Key == "QFE" then
|
||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||
Text = Coordinate:ToStringPressure( ReportGroup:GetUnit(1), nil, self )
|
||||
Text = Coordinate:ToStringPressure( ReportGroup:GetUnit(1), nil, Task )
|
||||
end
|
||||
if Key == "Temperature" then
|
||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||
Text = Coordinate:ToStringTemperature( ReportGroup:GetUnit(1), nil, self )
|
||||
Text = Coordinate:ToStringTemperature( ReportGroup:GetUnit(1), nil, Task )
|
||||
end
|
||||
if Key == "Wind" then
|
||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||
Text = Coordinate:ToStringWind( ReportGroup:GetUnit(1), nil, self )
|
||||
Text = Coordinate:ToStringWind( ReportGroup:GetUnit(1), nil, Task )
|
||||
end
|
||||
if Key == "Cargo" then
|
||||
local DataText = Data.Data -- #string
|
||||
|
||||
@ -289,16 +289,6 @@ do -- TASK_CARGO_CSAR
|
||||
|
||||
self:F( { CargoDeployed = self.CargoDeployed ~= nil and "true" or "false" } )
|
||||
|
||||
--- OnBefore Transition Handler for Event CargoPickedUp.
|
||||
-- @function [parent=#TASK_CARGO_CSAR] OnBeforeCargoPickedUp
|
||||
-- @param #TASK_CARGO_CSAR self
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
-- @param #string To The To State string.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit The Unit (Client) that PickedUp the cargo. You can use this to retrieve the PlayerName etc.
|
||||
-- @param Core.Cargo#CARGO Cargo The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.
|
||||
-- @return #boolean Return false to cancel Transition.
|
||||
|
||||
--- OnAfter Transition Handler for Event CargoPickedUp.
|
||||
-- @function [parent=#TASK_CARGO_CSAR] OnAfterCargoPickedUp
|
||||
-- @param #TASK_CARGO_CSAR self
|
||||
@ -308,30 +298,6 @@ do -- TASK_CARGO_CSAR
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit The Unit (Client) that PickedUp the cargo. You can use this to retrieve the PlayerName etc.
|
||||
-- @param Core.Cargo#CARGO Cargo The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.
|
||||
|
||||
--- Synchronous Event Trigger for Event CargoPickedUp.
|
||||
-- @function [parent=#TASK_CARGO_CSAR] CargoPickedUp
|
||||
-- @param #TASK_CARGO_CSAR self
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit The Unit (Client) that PickedUp the cargo. You can use this to retrieve the PlayerName etc.
|
||||
-- @param Core.Cargo#CARGO Cargo The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.
|
||||
|
||||
--- Asynchronous Event Trigger for Event CargoPickedUp.
|
||||
-- @function [parent=#TASK_CARGO_CSAR] __CargoPickedUp
|
||||
-- @param #TASK_CARGO_CSAR self
|
||||
-- @param #number Delay The delay in seconds.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit The Unit (Client) that PickedUp the cargo. You can use this to retrieve the PlayerName etc.
|
||||
-- @param Core.Cargo#CARGO Cargo The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.
|
||||
|
||||
--- OnBefore Transition Handler for Event CargoDeployed.
|
||||
-- @function [parent=#TASK_CARGO_CSAR] OnBeforeCargoDeployed
|
||||
-- @param #TASK_CARGO_CSAR self
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
-- @param #string To The To State string.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit The Unit (Client) that Deployed the cargo. You can use this to retrieve the PlayerName etc.
|
||||
-- @param Core.Cargo#CARGO Cargo The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.
|
||||
-- @param Core.Zone#ZONE DeployZone The zone where the Cargo got Deployed or UnBoarded.
|
||||
-- @return #boolean Return false to cancel Transition.
|
||||
|
||||
--- OnAfter Transition Handler for Event CargoDeployed.
|
||||
-- @function [parent=#TASK_CARGO_CSAR] OnAfterCargoDeployed
|
||||
-- @param #TASK_CARGO_CSAR self
|
||||
@ -342,21 +308,6 @@ do -- TASK_CARGO_CSAR
|
||||
-- @param Core.Cargo#CARGO Cargo The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.
|
||||
-- @param Core.Zone#ZONE DeployZone The zone where the Cargo got Deployed or UnBoarded.
|
||||
|
||||
--- Synchronous Event Trigger for Event CargoDeployed.
|
||||
-- @function [parent=#TASK_CARGO_CSAR] CargoDeployed
|
||||
-- @param #TASK_CARGO_CSAR self
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit The Unit (Client) that Deployed the cargo. You can use this to retrieve the PlayerName etc.
|
||||
-- @param Core.Cargo#CARGO Cargo The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.
|
||||
-- @param Core.Zone#ZONE DeployZone The zone where the Cargo got Deployed or UnBoarded.
|
||||
|
||||
--- Asynchronous Event Trigger for Event CargoDeployed.
|
||||
-- @function [parent=#TASK_CARGO_CSAR] __CargoDeployed
|
||||
-- @param #TASK_CARGO_CSAR self
|
||||
-- @param #number Delay The delay in seconds.
|
||||
-- @param Wrapper.Unit#UNIT TaskUnit The Unit (Client) that Deployed the cargo. You can use this to retrieve the PlayerName etc.
|
||||
-- @param Core.Cargo#CARGO Cargo The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.
|
||||
-- @param Core.Zone#ZONE DeployZone The zone where the Cargo got Deployed or UnBoarded.
|
||||
|
||||
local Fsm = self:GetUnitProcess()
|
||||
|
||||
local CargoReport = REPORT:New( "Rescue a downed pilot from the following position:")
|
||||
@ -379,6 +330,8 @@ do -- TASK_CARGO_CSAR
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
|
||||
function TASK_CARGO_CSAR:ReportOrder( ReportGroup )
|
||||
|
||||
|
||||
@ -70,6 +70,7 @@ do -- TASK_CARGO_DISPATCHER
|
||||
-- @type TASK_CARGO_DISPATCHER
|
||||
-- @extends Tasking.Task_Manager#TASK_MANAGER
|
||||
-- @field TASK_CARGO_DISPATCHER.CSAR CSAR
|
||||
-- @field Core.Set#SET_ZONE SetZonesCSAR
|
||||
|
||||
--- @type TASK_CARGO_DISPATCHER.CSAR
|
||||
-- @field Wrapper.Unit#UNIT PilotUnit
|
||||
@ -260,6 +261,18 @@ do -- TASK_CARGO_DISPATCHER
|
||||
--
|
||||
-- Use the @{#TASK_CARGO_DISPATCHER.SetCSARDeployZone}() to setup one deployment zone, and @{#TASK_CARGO_DISPATCHER.SetCSARDeployZones}() to setup multiple default deployment zones in one call.
|
||||
--
|
||||
-- ## 4.4. **CSAR ejection zones**.
|
||||
--
|
||||
-- Setup a set of zones where the pilots will only eject and a task is created for CSAR. When such a set of zones is given, any ejection outside those zones will not result in a pilot created for CSAR!
|
||||
--
|
||||
-- Use the @{#TASK_CARGO_DISPATCHER.SetCSARZones}() to setup the set of zones.
|
||||
--
|
||||
-- ## 4.5. **CSAR ejection maximum**.
|
||||
--
|
||||
-- Setup how many pilots will eject the maximum. This to avoid an overload of CSAR tasks being created :-) The default is endless CSAR tasks.
|
||||
--
|
||||
-- Use the @{#TASK_CARGO_DISPATCHER.SetMaxCSAR}() to setup the maximum of pilots that will eject for CSAR.
|
||||
--
|
||||
--
|
||||
-- # 5) Handle cargo task events.
|
||||
--
|
||||
@ -395,6 +408,9 @@ do -- TASK_CARGO_DISPATCHER
|
||||
self:SetCSARRadius()
|
||||
self:__StartTasks( 5 )
|
||||
|
||||
self.MaxCSAR = nil
|
||||
self.CountCSAR = 0
|
||||
|
||||
-- For CSAR missions, we process the event when a pilot ejects.
|
||||
|
||||
self:HandleEvent( EVENTS.Ejection )
|
||||
@ -403,6 +419,47 @@ do -- TASK_CARGO_DISPATCHER
|
||||
end
|
||||
|
||||
|
||||
--- Sets the set of zones were pilots will only be spawned (eject) when the planes crash.
|
||||
-- Note that because this is a set of zones, the MD can create the zones dynamically within his mission!
|
||||
-- Just provide a set of zones, see usage, but find the tactical situation here:
|
||||
--
|
||||
-- 
|
||||
--
|
||||
-- @param #TASK_CARGO_DISPATCHER self
|
||||
-- @param Core.Set#SET_ZONE SetZonesCSAR The set of zones where pilots will only be spawned for CSAR when they eject.
|
||||
-- @usage
|
||||
--
|
||||
-- TaskDispatcher = TASK_CARGO_DISPATCHER:New( Mission, AttackGroups )
|
||||
--
|
||||
-- -- Use this call to pass the set of zones.
|
||||
-- -- Note that you can create the set of zones inline, because the FilterOnce method (and other SET_ZONE methods return self).
|
||||
-- -- So here the zones can be created as normal trigger zones (MOOSE creates a collection of ZONE objects when teh mission starts of all trigger zones).
|
||||
-- -- Just name them as CSAR zones here.
|
||||
-- TaskDispatcher:SetCSARZones( SET_ZONE:New():FilterPrefixes("CSAR"):FilterOnce() )
|
||||
--
|
||||
function TASK_CARGO_DISPATCHER:SetCSARZones( SetZonesCSAR )
|
||||
|
||||
self.SetZonesCSAR = SetZonesCSAR
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- Sets the maximum of pilots that will be spawned (eject) when the planes crash.
|
||||
-- @param #TASK_CARGO_DISPATCHER self
|
||||
-- @param #number MaxCSAR The maximum of pilots that will eject for CSAR.
|
||||
-- @usage
|
||||
--
|
||||
-- TaskDispatcher = TASK_CARGO_DISPATCHER:New( Mission, AttackGroups )
|
||||
--
|
||||
-- -- Use this call to the maximum of CSAR to 10.
|
||||
-- TaskDispatcher:SetMaxCSAR( 10 )
|
||||
--
|
||||
function TASK_CARGO_DISPATCHER:SetMaxCSAR( MaxCSAR )
|
||||
|
||||
self.MaxCSAR = MaxCSAR
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Handle the event when a pilot ejects.
|
||||
@ -420,8 +477,15 @@ do -- TASK_CARGO_DISPATCHER
|
||||
|
||||
-- Only add a CSAR task if the coalition of the mission is equal to the coalition of the ejected unit.
|
||||
if CSARCoalition == self.Mission:GetCommandCenter():GetCoalition() then
|
||||
local CSARTaskName = self:AddCSARTask( self.CSARTaskName, CSARCoordinate, CSARHeading, CSARCountry, self.CSARBriefing )
|
||||
self:SetCSARDeployZones( CSARTaskName, self.CSARDeployZones )
|
||||
-- And only add if the eject is in one of the zones, if defined.
|
||||
if not self.SetZonesCSAR or ( self.SetZonesCSAR and self.SetZonesCSAR:IsCoordinateInZone( CSARCoordinate ) ) then
|
||||
-- And only if the maximum of pilots is not reached that ejected!
|
||||
if not self.MaxCSAR or ( self.MaxCSAR and self.CountCSAR < self.MaxCSAR ) then
|
||||
local CSARTaskName = self:AddCSARTask( self.CSARTaskName, CSARCoordinate, CSARHeading, CSARCountry, self.CSARBriefing )
|
||||
self:SetCSARDeployZones( CSARTaskName, self.CSARDeployZones )
|
||||
self.CountCSAR = self.CountCSAR + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1217,6 +1217,25 @@ end
|
||||
function GROUP:GetMinHeight()
|
||||
self:F2()
|
||||
|
||||
local DCSGroup = self:GetDCSObject()
|
||||
|
||||
if DCSGroup then
|
||||
local GroupHeightMin = 999999999
|
||||
|
||||
for Index, UnitData in pairs( DCSGroup:getUnits() ) do
|
||||
local UnitData = UnitData -- DCS#Unit
|
||||
|
||||
local UnitHeight = UnitData:getPoint()
|
||||
|
||||
if UnitHeight < GroupHeightMin then
|
||||
GroupHeightMin = UnitHeight
|
||||
end
|
||||
end
|
||||
|
||||
return GroupHeightMin
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns the current maximum height of the group.
|
||||
@ -1226,6 +1245,25 @@ end
|
||||
function GROUP:GetMaxHeight()
|
||||
self:F2()
|
||||
|
||||
local DCSGroup = self:GetDCSObject()
|
||||
|
||||
if DCSGroup then
|
||||
local GroupHeightMax = -999999999
|
||||
|
||||
for Index, UnitData in pairs( DCSGroup:getUnits() ) do
|
||||
local UnitData = UnitData -- DCS#Unit
|
||||
|
||||
local UnitHeight = UnitData:getPoint()
|
||||
|
||||
if UnitHeight > GroupHeightMax then
|
||||
GroupHeightMax = UnitHeight
|
||||
end
|
||||
end
|
||||
|
||||
return GroupHeightMax
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
-- RESPAWNING
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user