mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop' into FF/Develop
This commit is contained in:
commit
e990db8070
@ -400,7 +400,6 @@ end
|
|||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
function AI_A2A:onafterStart( Controllable, From, Event, To )
|
function AI_A2A:onafterStart( Controllable, From, Event, To )
|
||||||
self:F2()
|
|
||||||
|
|
||||||
self:__Status( 10 ) -- Check status status every 30 seconds.
|
self:__Status( 10 ) -- Check status status every 30 seconds.
|
||||||
|
|
||||||
@ -423,8 +422,6 @@ end
|
|||||||
--- @param #AI_A2A self
|
--- @param #AI_A2A self
|
||||||
function AI_A2A:onafterStatus()
|
function AI_A2A:onafterStatus()
|
||||||
|
|
||||||
self:F( " Checking Status" )
|
|
||||||
|
|
||||||
if self.Controllable and self.Controllable:IsAlive() then
|
if self.Controllable and self.Controllable:IsAlive() then
|
||||||
|
|
||||||
local RTB = false
|
local RTB = false
|
||||||
@ -452,7 +449,7 @@ function AI_A2A:onafterStatus()
|
|||||||
|
|
||||||
if not self:Is( "Fuel" ) and not self:Is( "Home" ) then
|
if not self:Is( "Fuel" ) and not self:Is( "Home" ) then
|
||||||
local Fuel = self.Controllable:GetFuelMin()
|
local Fuel = self.Controllable:GetFuelMin()
|
||||||
self:F({Fuel=Fuel})
|
self:F({Fuel=Fuel, PatrolFuelThresholdPercentage=self.PatrolFuelThresholdPercentage})
|
||||||
if Fuel < self.PatrolFuelThresholdPercentage then
|
if Fuel < self.PatrolFuelThresholdPercentage then
|
||||||
if self.TankerName then
|
if self.TankerName then
|
||||||
self:E( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
self:E( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
||||||
|
|||||||
@ -282,13 +282,14 @@ function AI_A2A_CAP:New( AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAl
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- onafter State Transition for Event Patrol.
|
--- onafter State Transition for Event Patrol.
|
||||||
-- @param #AI_A2A_GCI self
|
-- @param #AI_A2A_CAP self
|
||||||
-- @param Wrapper.Group#GROUP AICap The AI Group managed by the FSM.
|
-- @param Wrapper.Group#GROUP AICap The AI Group managed by the FSM.
|
||||||
-- @param #string From The From State string.
|
-- @param #string From The From State string.
|
||||||
-- @param #string Event The Event string.
|
-- @param #string Event The Event string.
|
||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
function AI_A2A_CAP:onafterStart( AICap, From, Event, To )
|
function AI_A2A_CAP:onafterStart( AICap, From, Event, To )
|
||||||
|
|
||||||
|
self:GetParent( self ).onafterStart( self, AICap, From, Event, To )
|
||||||
AICap:HandleEvent( EVENTS.Takeoff, nil, self )
|
AICap:HandleEvent( EVENTS.Takeoff, nil, self )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2365,7 +2365,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )
|
-- A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )
|
||||||
--
|
--
|
||||||
-- -- Now Setup the default fuel treshold.
|
-- -- Now Setup the default fuel treshold.
|
||||||
-- A2ADispatcher:SetDefaultRefuelThreshold( 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank.
|
-- A2ADispatcher:SetDefaultFuelThreshold( 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank.
|
||||||
--
|
--
|
||||||
function AI_A2A_DISPATCHER:SetDefaultFuelThreshold( FuelThreshold )
|
function AI_A2A_DISPATCHER:SetDefaultFuelThreshold( FuelThreshold )
|
||||||
|
|
||||||
@ -2407,7 +2407,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )
|
-- A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )
|
||||||
--
|
--
|
||||||
-- -- Now Setup the default fuel treshold.
|
-- -- Now Setup the default fuel treshold.
|
||||||
-- A2ADispatcher:SetDefaultRefuelThreshold( 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank.
|
-- A2ADispatcher:SetDefaultFuelThreshold( 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank.
|
||||||
--
|
--
|
||||||
-- -- Now Setup the default tanker.
|
-- -- Now Setup the default tanker.
|
||||||
-- A2ADispatcher:SetDefaultTanker( "Tanker" ) -- The group name of the tanker is "Tanker" in the Mission Editor.
|
-- A2ADispatcher:SetDefaultTanker( "Tanker" ) -- The group name of the tanker is "Tanker" in the Mission Editor.
|
||||||
|
|||||||
@ -290,6 +290,7 @@ end
|
|||||||
-- @param #string To The To State string.
|
-- @param #string To The To State string.
|
||||||
function AI_A2A_GCI:onafterStart( AIIntercept, From, Event, To )
|
function AI_A2A_GCI:onafterStart( AIIntercept, From, Event, To )
|
||||||
|
|
||||||
|
self:GetParent( self ).onafterStart( self, AIIntercept, From, Event, To )
|
||||||
AIIntercept:HandleEvent( EVENTS.Takeoff, nil, self )
|
AIIntercept:HandleEvent( EVENTS.Takeoff, nil, self )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -362,7 +362,7 @@ do -- ACT_ROUTE_POINT
|
|||||||
local Distance = self.Coordinate:Get2DDistance( ProcessUnit:GetCoordinate() )
|
local Distance = self.Coordinate:Get2DDistance( ProcessUnit:GetCoordinate() )
|
||||||
|
|
||||||
if Distance <= self.Range then
|
if Distance <= self.Range then
|
||||||
local RouteText = "You have arrived."
|
local RouteText = "Task \"" .. self:GetTask():GetName() .. "\", you have arrived."
|
||||||
self:GetCommandCenter():MessageTypeToGroup( RouteText, ProcessUnit:GetGroup(), MESSAGE.Type.Information )
|
self:GetCommandCenter():MessageTypeToGroup( RouteText, ProcessUnit:GetGroup(), MESSAGE.Type.Information )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -381,7 +381,7 @@ do -- ACT_ROUTE_POINT
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACT_ROUTE_POINT:onafterReport( ProcessUnit, From, Event, To )
|
function ACT_ROUTE_POINT:onafterReport( ProcessUnit, From, Event, To )
|
||||||
|
|
||||||
local RouteText = self:GetRouteText( ProcessUnit )
|
local RouteText = "Task \"" .. self:GetTask():GetName() .. "\", " .. self:GetRouteText( ProcessUnit )
|
||||||
|
|
||||||
self:GetCommandCenter():MessageTypeToGroup( RouteText, ProcessUnit:GetGroup(), MESSAGE.Type.Update )
|
self:GetCommandCenter():MessageTypeToGroup( RouteText, ProcessUnit:GetGroup(), MESSAGE.Type.Update )
|
||||||
end
|
end
|
||||||
@ -453,7 +453,7 @@ do -- ACT_ROUTE_ZONE
|
|||||||
function ACT_ROUTE_ZONE:onfuncHasArrived( ProcessUnit )
|
function ACT_ROUTE_ZONE:onfuncHasArrived( ProcessUnit )
|
||||||
|
|
||||||
if ProcessUnit:IsInZone( self.Zone ) then
|
if ProcessUnit:IsInZone( self.Zone ) then
|
||||||
local RouteText = "You have arrived within the zone."
|
local RouteText = "Task \"" .. self:GetTask():GetName() .. "\", you have arrived within the zone."
|
||||||
self:GetCommandCenter():MessageTypeToGroup( RouteText, ProcessUnit:GetGroup(), MESSAGE.Type.Information )
|
self:GetCommandCenter():MessageTypeToGroup( RouteText, ProcessUnit:GetGroup(), MESSAGE.Type.Information )
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ do -- ACT_ROUTE_ZONE
|
|||||||
function ACT_ROUTE_ZONE:onafterReport( ProcessUnit, From, Event, To )
|
function ACT_ROUTE_ZONE:onafterReport( ProcessUnit, From, Event, To )
|
||||||
self:F( { ProcessUnit = ProcessUnit } )
|
self:F( { ProcessUnit = ProcessUnit } )
|
||||||
|
|
||||||
local RouteText = self:GetRouteText( ProcessUnit )
|
local RouteText = "Task \"" .. self:GetTask():GetName() .. "\", " .. self:GetRouteText( ProcessUnit )
|
||||||
self:GetCommandCenter():MessageTypeToGroup( RouteText, ProcessUnit:GetGroup(), MESSAGE.Type.Update )
|
self:GetCommandCenter():MessageTypeToGroup( RouteText, ProcessUnit:GetGroup(), MESSAGE.Type.Update )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1929,17 +1929,20 @@ do -- COORDINATE
|
|||||||
-- @param Core.Settings#SETTINGS Settings
|
-- @param Core.Settings#SETTINGS Settings
|
||||||
-- @param Tasking.Task#TASK Task The task for which coordinates need to be calculated.
|
-- @param Tasking.Task#TASK Task The task for which coordinates need to be calculated.
|
||||||
-- @return #string The coordinate Text in the configured coordinate system.
|
-- @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() } )
|
self:F2( { Controllable = Controllable and Controllable:GetName() } )
|
||||||
|
|
||||||
local Settings = Settings or ( Controllable and _DATABASE:GetPlayerSettings( Controllable:GetPlayerName() ) ) or _SETTINGS
|
local Settings = Settings or ( Controllable and _DATABASE:GetPlayerSettings( Controllable:GetPlayerName() ) ) or _SETTINGS
|
||||||
|
|
||||||
local ModeA2A = false
|
local ModeA2A = false
|
||||||
|
self:E('A2A false')
|
||||||
|
|
||||||
if Task then
|
if Task then
|
||||||
|
self:E('Task ' .. Task.ClassName )
|
||||||
if Task:IsInstanceOf( TASK_A2A ) then
|
if Task:IsInstanceOf( TASK_A2A ) then
|
||||||
ModeA2A = true
|
ModeA2A = true
|
||||||
|
self:E('A2A true')
|
||||||
else
|
else
|
||||||
if Task:IsInstanceOf( TASK_A2G ) then
|
if Task:IsInstanceOf( TASK_A2G ) then
|
||||||
ModeA2A = false
|
ModeA2A = false
|
||||||
|
|||||||
@ -1229,6 +1229,29 @@ do -- SET_GROUP
|
|||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Iterate the SET_GROUP and call an iterator function for each alive GROUP that has any unit in the @{Core.Zone}, providing the GROUP and optional parameters to the called function.
|
||||||
|
-- @param #SET_GROUP self
|
||||||
|
-- @param Core.Zone#ZONE ZoneObject The Zone to be tested for.
|
||||||
|
-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter.
|
||||||
|
-- @return #SET_GROUP self
|
||||||
|
function SET_GROUP:ForEachGroupAnyInZone( ZoneObject, IteratorFunction, ... )
|
||||||
|
self:F2( arg )
|
||||||
|
|
||||||
|
self:ForEach( IteratorFunction, arg, self:GetSet(),
|
||||||
|
--- @param Core.Zone#ZONE_BASE ZoneObject
|
||||||
|
-- @param Wrapper.Group#GROUP GroupObject
|
||||||
|
function( ZoneObject, GroupObject )
|
||||||
|
if GroupObject:IsAnyInZone( ZoneObject ) then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end, { ZoneObject } )
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Iterate the SET_GROUP and return true if at least one of the @{Wrapper.Group#GROUP} is completely inside the @{Core.Zone#ZONE}
|
--- Iterate the SET_GROUP and return true if at least one of the @{Wrapper.Group#GROUP} is completely inside the @{Core.Zone#ZONE}
|
||||||
-- @param #SET_GROUP self
|
-- @param #SET_GROUP self
|
||||||
@ -3119,6 +3142,26 @@ do -- SET_STATIC
|
|||||||
|
|
||||||
end
|
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
|
-- @param #SET_STATIC self
|
||||||
|
|||||||
@ -1204,7 +1204,7 @@ function TASK:MenuMarkToGroup( TaskGroup )
|
|||||||
if TargetCoordinates then
|
if TargetCoordinates then
|
||||||
for TargetCoordinateID, TargetCoordinate in pairs( TargetCoordinates ) do
|
for TargetCoordinateID, TargetCoordinate in pairs( TargetCoordinates ) do
|
||||||
local Report = REPORT:New():SetIndent( 0 )
|
local Report = REPORT:New():SetIndent( 0 )
|
||||||
self.TaskInfo:Report( Report, "M", TaskGroup, TargetCoordinateID )
|
self.TaskInfo:Report( Report, "M", TaskGroup, self )
|
||||||
local MarkText = Report:Text( ", " )
|
local MarkText = Report:Text( ", " )
|
||||||
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
||||||
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
||||||
@ -1214,7 +1214,7 @@ function TASK:MenuMarkToGroup( TaskGroup )
|
|||||||
local TargetCoordinate = self.TaskInfo:GetData( "Coordinate" ) -- Core.Point#COORDINATE
|
local TargetCoordinate = self.TaskInfo:GetData( "Coordinate" ) -- Core.Point#COORDINATE
|
||||||
if TargetCoordinate then
|
if TargetCoordinate then
|
||||||
local Report = REPORT:New():SetIndent( 0 )
|
local Report = REPORT:New():SetIndent( 0 )
|
||||||
self.TaskInfo:Report( Report, "M", TaskGroup )
|
self.TaskInfo:Report( Report, "M", TaskGroup, self )
|
||||||
local MarkText = Report:Text( ", " )
|
local MarkText = Report:Text( ", " )
|
||||||
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
||||||
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
||||||
@ -1751,7 +1751,7 @@ function TASK:ReportSummary( ReportGroup )
|
|||||||
-- Determine the status of the Task.
|
-- Determine the status of the Task.
|
||||||
Report:Add( "State: <" .. self:GetState() .. ">" )
|
Report:Add( "State: <" .. self:GetState() .. ">" )
|
||||||
|
|
||||||
self.TaskInfo:Report( Report, "S", ReportGroup )
|
self.TaskInfo:Report( Report, "S", ReportGroup, self )
|
||||||
|
|
||||||
return Report:Text( ', ' )
|
return Report:Text( ', ' )
|
||||||
end
|
end
|
||||||
@ -1768,7 +1768,7 @@ function TASK:ReportOverview( ReportGroup )
|
|||||||
local TaskName = self:GetName()
|
local TaskName = self:GetName()
|
||||||
local Report = REPORT:New()
|
local Report = REPORT:New()
|
||||||
|
|
||||||
self.TaskInfo:Report( Report, "O", ReportGroup )
|
self.TaskInfo:Report( Report, "O", ReportGroup, self )
|
||||||
|
|
||||||
return Report:Text()
|
return Report:Text()
|
||||||
end
|
end
|
||||||
@ -1852,7 +1852,7 @@ function TASK:ReportDetails( ReportGroup )
|
|||||||
Report:AddIndent( Players )
|
Report:AddIndent( Players )
|
||||||
end
|
end
|
||||||
|
|
||||||
self.TaskInfo:Report( Report, "D", ReportGroup )
|
self.TaskInfo:Report( Report, "D", ReportGroup, self )
|
||||||
|
|
||||||
return Report:Text()
|
return Report:Text()
|
||||||
end
|
end
|
||||||
|
|||||||
@ -284,8 +284,9 @@ end
|
|||||||
-- @param Core.Report#REPORT Report
|
-- @param Core.Report#REPORT Report
|
||||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||||
-- @param Wrapper.Group#GROUP ReportGroup
|
-- @param Wrapper.Group#GROUP ReportGroup
|
||||||
|
-- @param Tasking.Task#TASK Task
|
||||||
-- @return #TASKINFO self
|
-- @return #TASKINFO self
|
||||||
function TASKINFO:Report( Report, Detail, ReportGroup )
|
function TASKINFO:Report( Report, Detail, ReportGroup, Task )
|
||||||
|
|
||||||
local Line = 0
|
local Line = 0
|
||||||
local LineReport = REPORT:New()
|
local LineReport = REPORT:New()
|
||||||
@ -306,7 +307,7 @@ function TASKINFO:Report( Report, Detail, ReportGroup )
|
|||||||
end
|
end
|
||||||
if Key == "Coordinate" then
|
if Key == "Coordinate" then
|
||||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||||
Text = Coordinate:ToString( ReportGroup:GetUnit(1), nil, self )
|
Text = Coordinate:ToString( ReportGroup:GetUnit(1), nil, Task )
|
||||||
end
|
end
|
||||||
if Key == "Threat" then
|
if Key == "Threat" then
|
||||||
local DataText = Data.Data -- #string
|
local DataText = Data.Data -- #string
|
||||||
@ -322,15 +323,15 @@ function TASKINFO:Report( Report, Detail, ReportGroup )
|
|||||||
end
|
end
|
||||||
if Key == "QFE" then
|
if Key == "QFE" then
|
||||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||||
Text = Coordinate:ToStringPressure( ReportGroup:GetUnit(1), nil, self )
|
Text = Coordinate:ToStringPressure( ReportGroup:GetUnit(1), nil, Task )
|
||||||
end
|
end
|
||||||
if Key == "Temperature" then
|
if Key == "Temperature" then
|
||||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||||
Text = Coordinate:ToStringTemperature( ReportGroup:GetUnit(1), nil, self )
|
Text = Coordinate:ToStringTemperature( ReportGroup:GetUnit(1), nil, Task )
|
||||||
end
|
end
|
||||||
if Key == "Wind" then
|
if Key == "Wind" then
|
||||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||||
Text = Coordinate:ToStringWind( ReportGroup:GetUnit(1), nil, self )
|
Text = Coordinate:ToStringWind( ReportGroup:GetUnit(1), nil, Task )
|
||||||
end
|
end
|
||||||
if Key == "Cargo" then
|
if Key == "Cargo" then
|
||||||
local DataText = Data.Data -- #string
|
local DataText = Data.Data -- #string
|
||||||
|
|||||||
@ -289,16 +289,6 @@ do -- TASK_CARGO_CSAR
|
|||||||
|
|
||||||
self:F( { CargoDeployed = self.CargoDeployed ~= nil and "true" or "false" } )
|
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.
|
--- OnAfter Transition Handler for Event CargoPickedUp.
|
||||||
-- @function [parent=#TASK_CARGO_CSAR] OnAfterCargoPickedUp
|
-- @function [parent=#TASK_CARGO_CSAR] OnAfterCargoPickedUp
|
||||||
-- @param #TASK_CARGO_CSAR self
|
-- @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 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.
|
-- @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.
|
--- OnAfter Transition Handler for Event CargoDeployed.
|
||||||
-- @function [parent=#TASK_CARGO_CSAR] OnAfterCargoDeployed
|
-- @function [parent=#TASK_CARGO_CSAR] OnAfterCargoDeployed
|
||||||
-- @param #TASK_CARGO_CSAR self
|
-- @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.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.
|
-- @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 Fsm = self:GetUnitProcess()
|
||||||
|
|
||||||
local CargoReport = REPORT:New( "Rescue a downed pilot from the following position:")
|
local CargoReport = REPORT:New( "Rescue a downed pilot from the following position:")
|
||||||
@ -379,6 +330,8 @@ do -- TASK_CARGO_CSAR
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function TASK_CARGO_CSAR:ReportOrder( ReportGroup )
|
function TASK_CARGO_CSAR:ReportOrder( ReportGroup )
|
||||||
|
|
||||||
|
|||||||
@ -70,6 +70,7 @@ do -- TASK_CARGO_DISPATCHER
|
|||||||
-- @type TASK_CARGO_DISPATCHER
|
-- @type TASK_CARGO_DISPATCHER
|
||||||
-- @extends Tasking.Task_Manager#TASK_MANAGER
|
-- @extends Tasking.Task_Manager#TASK_MANAGER
|
||||||
-- @field TASK_CARGO_DISPATCHER.CSAR CSAR
|
-- @field TASK_CARGO_DISPATCHER.CSAR CSAR
|
||||||
|
-- @field Core.Set#SET_ZONE SetZonesCSAR
|
||||||
|
|
||||||
--- @type TASK_CARGO_DISPATCHER.CSAR
|
--- @type TASK_CARGO_DISPATCHER.CSAR
|
||||||
-- @field Wrapper.Unit#UNIT PilotUnit
|
-- @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.
|
-- 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.
|
-- # 5) Handle cargo task events.
|
||||||
--
|
--
|
||||||
@ -395,6 +408,9 @@ do -- TASK_CARGO_DISPATCHER
|
|||||||
self:SetCSARRadius()
|
self:SetCSARRadius()
|
||||||
self:__StartTasks( 5 )
|
self:__StartTasks( 5 )
|
||||||
|
|
||||||
|
self.MaxCSAR = nil
|
||||||
|
self.CountCSAR = 0
|
||||||
|
|
||||||
-- For CSAR missions, we process the event when a pilot ejects.
|
-- For CSAR missions, we process the event when a pilot ejects.
|
||||||
|
|
||||||
self:HandleEvent( EVENTS.Ejection )
|
self:HandleEvent( EVENTS.Ejection )
|
||||||
@ -403,6 +419,47 @@ do -- TASK_CARGO_DISPATCHER
|
|||||||
end
|
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.
|
--- 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.
|
-- 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
|
if CSARCoalition == self.Mission:GetCommandCenter():GetCoalition() then
|
||||||
local CSARTaskName = self:AddCSARTask( self.CSARTaskName, CSARCoordinate, CSARHeading, CSARCountry, self.CSARBriefing )
|
-- And only add if the eject is in one of the zones, if defined.
|
||||||
self:SetCSARDeployZones( CSARTaskName, self.CSARDeployZones )
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1654,7 +1654,6 @@ end
|
|||||||
-- RouteToZone( GroundGroup, ZoneList[1] )
|
-- RouteToZone( GroundGroup, ZoneList[1] )
|
||||||
--
|
--
|
||||||
function CONTROLLABLE:TaskFunction( FunctionString, ... )
|
function CONTROLLABLE:TaskFunction( FunctionString, ... )
|
||||||
self:E({TaskFunction=FunctionString, arguments=arg})
|
|
||||||
|
|
||||||
local DCSTask
|
local DCSTask
|
||||||
|
|
||||||
|
|||||||
@ -1008,6 +1008,23 @@ function GROUP:IsNotInZone( Zone )
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Returns true if any units of the group are within a @{Core.Zone}.
|
||||||
|
-- @param #GROUP self
|
||||||
|
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
||||||
|
-- @return #boolean Returns true if any unit of the Group is within the @{Core.Zone#ZONE_BASE}
|
||||||
|
function GROUP:IsAnyInZone( Zone )
|
||||||
|
|
||||||
|
if not self:IsAlive() then return false end
|
||||||
|
|
||||||
|
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
||||||
|
local Unit = UnitData -- Wrapper.Unit#UNIT
|
||||||
|
if Zone:IsVec3InZone( Unit:GetVec3() ) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
--- Returns the number of UNITs that are in the @{Zone}
|
--- Returns the number of UNITs that are in the @{Zone}
|
||||||
-- @param #GROUP self
|
-- @param #GROUP self
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
|
||||||
@ -1217,6 +1234,25 @@ end
|
|||||||
function GROUP:GetMinHeight()
|
function GROUP:GetMinHeight()
|
||||||
self:F2()
|
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
|
end
|
||||||
|
|
||||||
--- Returns the current maximum height of the group.
|
--- Returns the current maximum height of the group.
|
||||||
@ -1226,6 +1262,25 @@ end
|
|||||||
function GROUP:GetMaxHeight()
|
function GROUP:GetMaxHeight()
|
||||||
self:F2()
|
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
|
end
|
||||||
|
|
||||||
-- RESPAWNING
|
-- RESPAWNING
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user