mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#AI* minor fixes
This commit is contained in:
parent
8b2237d183
commit
2a4e242eb2
@ -1151,14 +1151,14 @@ do -- AI_A2A_DISPATCHER
|
|||||||
|
|
||||||
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
||||||
|
|
||||||
self:I( "Captured " .. AirbaseName )
|
self:T( "Captured " .. AirbaseName )
|
||||||
|
|
||||||
-- Now search for all squadrons located at the airbase, and sanitize them.
|
-- Now search for all squadrons located at the airbase, and sanitize them.
|
||||||
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
||||||
if Squadron.AirbaseName == AirbaseName then
|
if Squadron.AirbaseName == AirbaseName then
|
||||||
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
||||||
Squadron.Captured = true
|
Squadron.Captured = true
|
||||||
self:I( "Squadron " .. SquadronName .. " captured." )
|
self:T( "Squadron " .. SquadronName .. " captured." )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1828,7 +1828,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
|
|
||||||
self:SetSquadronCapInterval( SquadronName, self.DefenderDefault.CapLimit, self.DefenderDefault.CapMinSeconds, self.DefenderDefault.CapMaxSeconds, 1 )
|
self:SetSquadronCapInterval( SquadronName, self.DefenderDefault.CapLimit, self.DefenderDefault.CapMinSeconds, self.DefenderDefault.CapMaxSeconds, 1 )
|
||||||
|
|
||||||
self:I( { CAP = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, Zone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageAltType } } )
|
self:T( { CAP = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, Zone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageAltType } } )
|
||||||
|
|
||||||
-- Add the CAP to the EWR network.
|
-- Add the CAP to the EWR network.
|
||||||
|
|
||||||
@ -2085,7 +2085,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
Intercept.EngageCeilingAltitude = EngageCeilingAltitude
|
Intercept.EngageCeilingAltitude = EngageCeilingAltitude
|
||||||
Intercept.EngageAltType = EngageAltType
|
Intercept.EngageAltType = EngageAltType
|
||||||
|
|
||||||
self:I( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set squadron GCI.
|
--- Set squadron GCI.
|
||||||
@ -3000,17 +3000,17 @@ do -- AI_A2A_DISPATCHER
|
|||||||
for FriendlyDistance, AIFriendly in UTILS.spairs( DefenderFriendlies or {} ) do
|
for FriendlyDistance, AIFriendly in UTILS.spairs( DefenderFriendlies or {} ) do
|
||||||
-- We only allow to ENGAGE targets as long as the Units on both sides are balanced.
|
-- We only allow to ENGAGE targets as long as the Units on both sides are balanced.
|
||||||
if AttackerCount > DefenderCount then
|
if AttackerCount > DefenderCount then
|
||||||
--self:I("***** AI_A2A_DISPATCHER:CountDefendersToBeEngaged() *****\nThis is supposed to be a UNIT:")
|
--self:T("***** AI_A2A_DISPATCHER:CountDefendersToBeEngaged() *****\nThis is supposed to be a UNIT:")
|
||||||
if AIFriendly then
|
if AIFriendly then
|
||||||
local classname = AIFriendly.ClassName or "No Class Name"
|
local classname = AIFriendly.ClassName or "No Class Name"
|
||||||
local unitname = AIFriendly.IdentifiableName or "No Unit Name"
|
local unitname = AIFriendly.IdentifiableName or "No Unit Name"
|
||||||
--self:I("Class Name: " .. classname)
|
--self:T("Class Name: " .. classname)
|
||||||
--self:I("Unit Name: " .. unitname)
|
--self:T("Unit Name: " .. unitname)
|
||||||
--self:I({AIFriendly})
|
--self:T({AIFriendly})
|
||||||
end
|
end
|
||||||
local Friendly = nil
|
local Friendly = nil
|
||||||
if AIFriendly and AIFriendly:IsAlive() then
|
if AIFriendly and AIFriendly:IsAlive() then
|
||||||
--self:I("AIFriendly alive, getting GROUP")
|
--self:T("AIFriendly alive, getting GROUP")
|
||||||
Friendly = AIFriendly:GetGroup() -- Wrapper.Group#GROUP
|
Friendly = AIFriendly:GetGroup() -- Wrapper.Group#GROUP
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3952,7 +3952,7 @@ end
|
|||||||
|
|
||||||
do
|
do
|
||||||
|
|
||||||
--- @type AI_A2A_GCICAP
|
-- @type AI_A2A_GCICAP
|
||||||
-- @extends #AI_A2A_DISPATCHER
|
-- @extends #AI_A2A_DISPATCHER
|
||||||
|
|
||||||
--- Create an automatic air defence system for a coalition setting up GCI and CAP air defenses.
|
--- Create an automatic air defence system for a coalition setting up GCI and CAP air defenses.
|
||||||
@ -4322,23 +4322,23 @@ do
|
|||||||
|
|
||||||
-- Setup squadrons
|
-- Setup squadrons
|
||||||
|
|
||||||
self:I( { Airbases = AirbaseNames } )
|
self:T( { Airbases = AirbaseNames } )
|
||||||
|
|
||||||
self:I( "Defining Templates for Airbases ..." )
|
self:T( "Defining Templates for Airbases ..." )
|
||||||
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
||||||
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
||||||
local AirbaseName = Airbase:GetName()
|
local AirbaseName = Airbase:GetName()
|
||||||
local AirbaseCoord = Airbase:GetCoordinate()
|
local AirbaseCoord = Airbase:GetCoordinate()
|
||||||
local AirbaseZone = ZONE_RADIUS:New( "Airbase", AirbaseCoord:GetVec2(), 3000 )
|
local AirbaseZone = ZONE_RADIUS:New( "Airbase", AirbaseCoord:GetVec2(), 3000 )
|
||||||
local Templates = nil
|
local Templates = nil
|
||||||
self:I( { Airbase = AirbaseName } )
|
self:T( { Airbase = AirbaseName } )
|
||||||
for TemplateID, Template in pairs( self.Templates:GetSet() ) do
|
for TemplateID, Template in pairs( self.Templates:GetSet() ) do
|
||||||
local Template = Template -- Wrapper.Group#GROUP
|
local Template = Template -- Wrapper.Group#GROUP
|
||||||
local TemplateCoord = Template:GetCoordinate()
|
local TemplateCoord = Template:GetCoordinate()
|
||||||
if AirbaseZone:IsVec2InZone( TemplateCoord:GetVec2() ) then
|
if AirbaseZone:IsVec2InZone( TemplateCoord:GetVec2() ) then
|
||||||
Templates = Templates or {}
|
Templates = Templates or {}
|
||||||
table.insert( Templates, Template:GetName() )
|
table.insert( Templates, Template:GetName() )
|
||||||
self:I( { Template = Template:GetName() } )
|
self:T( { Template = Template:GetName() } )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Templates then
|
if Templates then
|
||||||
@ -4354,13 +4354,13 @@ do
|
|||||||
self.CAPTemplates:FilterPrefixes( CapPrefixes )
|
self.CAPTemplates:FilterPrefixes( CapPrefixes )
|
||||||
self.CAPTemplates:FilterOnce()
|
self.CAPTemplates:FilterOnce()
|
||||||
|
|
||||||
self:I( "Setting up CAP ..." )
|
self:T( "Setting up CAP ..." )
|
||||||
for CAPID, CAPTemplate in pairs( self.CAPTemplates:GetSet() ) do
|
for CAPID, CAPTemplate in pairs( self.CAPTemplates:GetSet() ) do
|
||||||
local CAPZone = ZONE_POLYGON:New( CAPTemplate:GetName(), CAPTemplate )
|
local CAPZone = ZONE_POLYGON:New( CAPTemplate:GetName(), CAPTemplate )
|
||||||
-- Now find the closest airbase from the ZONE (start or center)
|
-- Now find the closest airbase from the ZONE (start or center)
|
||||||
local AirbaseDistance = 99999999
|
local AirbaseDistance = 99999999
|
||||||
local AirbaseClosest = nil -- Wrapper.Airbase#AIRBASE
|
local AirbaseClosest = nil -- Wrapper.Airbase#AIRBASE
|
||||||
self:I( { CAPZoneGroup = CAPID } )
|
self:T( { CAPZoneGroup = CAPID } )
|
||||||
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
||||||
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
||||||
local AirbaseName = Airbase:GetName()
|
local AirbaseName = Airbase:GetName()
|
||||||
@ -4368,7 +4368,7 @@ do
|
|||||||
local Squadron = self.DefenderSquadrons[AirbaseName]
|
local Squadron = self.DefenderSquadrons[AirbaseName]
|
||||||
if Squadron then
|
if Squadron then
|
||||||
local Distance = AirbaseCoord:Get2DDistance( CAPZone:GetCoordinate() )
|
local Distance = AirbaseCoord:Get2DDistance( CAPZone:GetCoordinate() )
|
||||||
self:I( { AirbaseDistance = Distance } )
|
self:T( { AirbaseDistance = Distance } )
|
||||||
if Distance < AirbaseDistance then
|
if Distance < AirbaseDistance then
|
||||||
AirbaseDistance = Distance
|
AirbaseDistance = Distance
|
||||||
AirbaseClosest = Airbase
|
AirbaseClosest = Airbase
|
||||||
@ -4376,7 +4376,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if AirbaseClosest then
|
if AirbaseClosest then
|
||||||
self:I( { CAPAirbase = AirbaseClosest:GetName() } )
|
self:T( { CAPAirbase = AirbaseClosest:GetName() } )
|
||||||
self:SetSquadronCap( AirbaseClosest:GetName(), CAPZone, 6000, 10000, 500, 800, 800, 1200, "RADIO" )
|
self:SetSquadronCap( AirbaseClosest:GetName(), CAPZone, 6000, 10000, 500, 800, 800, 1200, "RADIO" )
|
||||||
self:SetSquadronCapInterval( AirbaseClosest:GetName(), CapLimit, 300, 600, 1 )
|
self:SetSquadronCapInterval( AirbaseClosest:GetName(), CapLimit, 300, 600, 1 )
|
||||||
end
|
end
|
||||||
@ -4384,14 +4384,14 @@ do
|
|||||||
|
|
||||||
-- Setup GCI.
|
-- Setup GCI.
|
||||||
-- GCI is setup for all Squadrons.
|
-- GCI is setup for all Squadrons.
|
||||||
self:I( "Setting up GCI ..." )
|
self:T( "Setting up GCI ..." )
|
||||||
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
|
||||||
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
|
||||||
local AirbaseName = Airbase:GetName()
|
local AirbaseName = Airbase:GetName()
|
||||||
local Squadron = self.DefenderSquadrons[AirbaseName]
|
local Squadron = self.DefenderSquadrons[AirbaseName]
|
||||||
self:F( { Airbase = AirbaseName } )
|
self:F( { Airbase = AirbaseName } )
|
||||||
if Squadron then
|
if Squadron then
|
||||||
self:I( { GCIAirbase = AirbaseName } )
|
self:T( { GCIAirbase = AirbaseName } )
|
||||||
self:SetSquadronGci( AirbaseName, 800, 1200 )
|
self:SetSquadronGci( AirbaseName, 800, 1200 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -904,14 +904,14 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- @type AI_A2G_DISPATCHER.DefenseCoordinates
|
-- @type AI_A2G_DISPATCHER.DefenseCoordinates
|
||||||
-- @map <#string,Core.Point#COORDINATE> A list of all defense coordinates mapped per defense coordinate name.
|
-- @map <#string,Core.Point#COORDINATE> A list of all defense coordinates mapped per defense coordinate name.
|
||||||
|
|
||||||
--- @field #AI_A2G_DISPATCHER.DefenseCoordinates DefenseCoordinates
|
-- @field #AI_A2G_DISPATCHER.DefenseCoordinates DefenseCoordinates
|
||||||
AI_A2G_DISPATCHER.DefenseCoordinates = {}
|
AI_A2G_DISPATCHER.DefenseCoordinates = {}
|
||||||
|
|
||||||
--- Enumerator for spawns at airbases.
|
--- Enumerator for spawns at airbases.
|
||||||
-- @type AI_A2G_DISPATCHER.Takeoff
|
-- @type AI_A2G_DISPATCHER.Takeoff
|
||||||
-- @extends Wrapper.Group#GROUP.Takeoff
|
-- @extends Wrapper.Group#GROUP.Takeoff
|
||||||
|
|
||||||
--- @field #AI_A2G_DISPATCHER.Takeoff Takeoff
|
-- @field #AI_A2G_DISPATCHER.Takeoff Takeoff
|
||||||
AI_A2G_DISPATCHER.Takeoff = GROUP.Takeoff
|
AI_A2G_DISPATCHER.Takeoff = GROUP.Takeoff
|
||||||
|
|
||||||
--- Defines Landing location.
|
--- Defines Landing location.
|
||||||
@ -942,7 +942,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- @type AI_A2G_DISPATCHER.DefenseQueue
|
-- @type AI_A2G_DISPATCHER.DefenseQueue
|
||||||
-- @list<#AI_A2G_DISPATCHER.DefenseQueueItem> DefenseQueueItem A list of all defenses being queued ...
|
-- @list<#AI_A2G_DISPATCHER.DefenseQueueItem> DefenseQueueItem A list of all defenses being queued ...
|
||||||
|
|
||||||
--- @field #AI_A2G_DISPATCHER.DefenseQueue DefenseQueue
|
-- @field #AI_A2G_DISPATCHER.DefenseQueue DefenseQueue
|
||||||
AI_A2G_DISPATCHER.DefenseQueue = {}
|
AI_A2G_DISPATCHER.DefenseQueue = {}
|
||||||
|
|
||||||
--- Defense approach types.
|
--- Defense approach types.
|
||||||
@ -1136,7 +1136,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:onafterStart( From, Event, To )
|
function AI_A2G_DISPATCHER:onafterStart( From, Event, To )
|
||||||
|
|
||||||
self:GetParent( self ).onafterStart( self, From, Event, To )
|
self:GetParent( self ).onafterStart( self, From, Event, To )
|
||||||
@ -1147,7 +1147,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
for Resource = 1, DefenderSquadron.ResourceCount or 0 do
|
for Resource = 1, DefenderSquadron.ResourceCount or 0 do
|
||||||
self:ResourcePark( DefenderSquadron )
|
self:ResourcePark( DefenderSquadron )
|
||||||
end
|
end
|
||||||
self:I( "Parked resources for squadron " .. DefenderSquadron.Name )
|
self:T( "Parked resources for squadron " .. DefenderSquadron.Name )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -1201,7 +1201,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:ResourcePark( DefenderSquadron )
|
function AI_A2G_DISPATCHER:ResourcePark( DefenderSquadron )
|
||||||
local TemplateID = math.random( 1, #DefenderSquadron.Spawn )
|
local TemplateID = math.random( 1, #DefenderSquadron.Spawn )
|
||||||
local Spawn = DefenderSquadron.Spawn[ TemplateID ] -- Core.Spawn#SPAWN
|
local Spawn = DefenderSquadron.Spawn[ TemplateID ] -- Core.Spawn#SPAWN
|
||||||
@ -1218,33 +1218,33 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_A2G_DISPATCHER:OnEventBaseCaptured( EventData )
|
function AI_A2G_DISPATCHER:OnEventBaseCaptured( EventData )
|
||||||
|
|
||||||
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
||||||
|
|
||||||
self:I( "Captured " .. AirbaseName )
|
self:T( "Captured " .. AirbaseName )
|
||||||
|
|
||||||
-- Now search for all squadrons located at the airbase, and sanitize them.
|
-- Now search for all squadrons located at the airbase, and sanitize them.
|
||||||
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
||||||
if Squadron.AirbaseName == AirbaseName then
|
if Squadron.AirbaseName == AirbaseName then
|
||||||
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
||||||
Squadron.Captured = true
|
Squadron.Captured = true
|
||||||
self:I( "Squadron " .. SquadronName .. " captured." )
|
self:T( "Squadron " .. SquadronName .. " captured." )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_A2G_DISPATCHER:OnEventCrashOrDead( EventData )
|
function AI_A2G_DISPATCHER:OnEventCrashOrDead( EventData )
|
||||||
self.Detection:ForgetDetectedUnit( EventData.IniUnitName )
|
self.Detection:ForgetDetectedUnit( EventData.IniUnitName )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_A2G_DISPATCHER:OnEventLand( EventData )
|
function AI_A2G_DISPATCHER:OnEventLand( EventData )
|
||||||
self:F( "Landed" )
|
self:F( "Landed" )
|
||||||
@ -1261,7 +1261,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron, Defender )
|
self:ResourcePark( Squadron )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
||||||
@ -1273,7 +1273,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_A2G_DISPATCHER:OnEventEngineShutdown( EventData )
|
function AI_A2G_DISPATCHER:OnEventEngineShutdown( EventData )
|
||||||
local DefenderUnit = EventData.IniUnit
|
local DefenderUnit = EventData.IniUnit
|
||||||
@ -1289,7 +1289,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron, Defender )
|
self:ResourcePark( Squadron )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1297,7 +1297,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
|
|
||||||
do -- Manage the defensive behaviour
|
do -- Manage the defensive behaviour
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string DefenseCoordinateName The name of the coordinate to be defended by A2G defenses.
|
-- @param #string DefenseCoordinateName The name of the coordinate to be defended by A2G defenses.
|
||||||
-- @param Core.Point#COORDINATE DefenseCoordinate The coordinate to be defended by A2G defenses.
|
-- @param Core.Point#COORDINATE DefenseCoordinate The coordinate to be defended by A2G defenses.
|
||||||
function AI_A2G_DISPATCHER:AddDefenseCoordinate( DefenseCoordinateName, DefenseCoordinate )
|
function AI_A2G_DISPATCHER:AddDefenseCoordinate( DefenseCoordinateName, DefenseCoordinate )
|
||||||
@ -1305,19 +1305,19 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:SetDefenseReactivityLow()
|
function AI_A2G_DISPATCHER:SetDefenseReactivityLow()
|
||||||
self.DefenseReactivity = 0.05
|
self.DefenseReactivity = 0.05
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:SetDefenseReactivityMedium()
|
function AI_A2G_DISPATCHER:SetDefenseReactivityMedium()
|
||||||
self.DefenseReactivity = 0.15
|
self.DefenseReactivity = 0.15
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:SetDefenseReactivityHigh()
|
function AI_A2G_DISPATCHER:SetDefenseReactivityHigh()
|
||||||
self.DefenseReactivity = 0.5
|
self.DefenseReactivity = 0.5
|
||||||
end
|
end
|
||||||
@ -1351,14 +1351,14 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- 1. the **distance of the closest airbase to target**, being smaller than the **Defend Radius**.
|
-- 1. the **distance of the closest airbase to target**, being smaller than the **Defend Radius**.
|
||||||
-- 2. the **distance to any defense reference point**.
|
-- 2. the **distance to any defense reference point**.
|
||||||
--
|
--
|
||||||
-- The **default** defense radius is defined as **400000** or **40km**. Override the default defense radius when the era of the warfare is early, or,
|
-- The **default** defense radius is defined as **40000** or **40km**. Override the default defense radius when the era of the warfare is early, or,
|
||||||
-- when you don't want to let the AI_A2G_DISPATCHER react immediately when a certain border or area is not being crossed.
|
-- when you don't want to let the AI_A2G_DISPATCHER react immediately when a certain border or area is not being crossed.
|
||||||
--
|
--
|
||||||
-- Use the method @{#AI_A2G_DISPATCHER.SetDefendRadius}() to set a specific defend radius for all squadrons,
|
-- Use the method @{#AI_A2G_DISPATCHER.SetDefendRadius}() to set a specific defend radius for all squadrons,
|
||||||
-- **the Defense Radius is defined for ALL squadrons which are operational.**
|
-- **the Defense Radius is defined for ALL squadrons which are operational.**
|
||||||
--
|
--
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #number DefenseRadius (Optional, Default = 200000) The defense radius to engage detected targets from the nearest capable and available squadron airbase.
|
-- @param #number DefenseRadius (Optional, Default = 20000) The defense radius to engage detected targets from the nearest capable and available squadron airbase.
|
||||||
-- @return #AI_A2G_DISPATCHER
|
-- @return #AI_A2G_DISPATCHER
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
@ -1373,7 +1373,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
--
|
--
|
||||||
function AI_A2G_DISPATCHER:SetDefenseRadius( DefenseRadius )
|
function AI_A2G_DISPATCHER:SetDefenseRadius( DefenseRadius )
|
||||||
|
|
||||||
self.DefenseRadius = DefenseRadius or 100000
|
self.DefenseRadius = DefenseRadius or 40000
|
||||||
|
|
||||||
self.Detection:SetAcceptRange( self.DefenseRadius )
|
self.Detection:SetAcceptRange( self.DefenseRadius )
|
||||||
|
|
||||||
@ -1868,7 +1868,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param #number TakeoffInterval Only Takeoff new units each specified interval in seconds in 10 seconds steps.
|
-- @param #number TakeoffInterval Only Takeoff new units each specified interval in seconds in 10 seconds steps.
|
||||||
-- @usage
|
-- @usage
|
||||||
@ -2144,7 +2144,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Sead.EngageAltType = EngageAltType
|
Sead.EngageAltType = EngageAltType
|
||||||
Sead.Defend = true
|
Sead.Defend = true
|
||||||
|
|
||||||
self:I( { SEAD = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { SEAD = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -2234,7 +2234,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
|
|
||||||
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "SEAD" )
|
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "SEAD" )
|
||||||
|
|
||||||
self:I( { SEAD = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { SEAD = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -2295,7 +2295,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Cas.EngageAltType = EngageAltType
|
Cas.EngageAltType = EngageAltType
|
||||||
Cas.Defend = true
|
Cas.Defend = true
|
||||||
|
|
||||||
self:I( { CAS = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { CAS = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -2385,7 +2385,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
|
|
||||||
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "CAS" )
|
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "CAS" )
|
||||||
|
|
||||||
self:I( { CAS = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { CAS = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -2446,7 +2446,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Bai.EngageAltType = EngageAltType
|
Bai.EngageAltType = EngageAltType
|
||||||
Bai.Defend = true
|
Bai.Defend = true
|
||||||
|
|
||||||
self:I( { BAI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { BAI = { SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -2536,7 +2536,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
|
|
||||||
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "BAI" )
|
self:SetSquadronPatrolInterval( SquadronName, self.DefenderDefault.PatrolLimit, self.DefenderDefault.PatrolMinSeconds, self.DefenderDefault.PatrolMaxSeconds, 1, "BAI" )
|
||||||
|
|
||||||
self:I( { BAI = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
self:T( { BAI = { Zone:GetName(), PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -3369,7 +3369,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:AddDefenderToSquadron( Squadron, Defender, Size )
|
function AI_A2G_DISPATCHER:AddDefenderToSquadron( Squadron, Defender, Size )
|
||||||
self.Defenders = self.Defenders or {}
|
self.Defenders = self.Defenders or {}
|
||||||
local DefenderName = Defender:GetName()
|
local DefenderName = Defender:GetName()
|
||||||
@ -3380,7 +3380,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
self:F( { DefenderName = DefenderName, SquadronResourceCount = Squadron.ResourceCount } )
|
self:F( { DefenderName = DefenderName, SquadronResourceCount = Squadron.ResourceCount } )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_DISPATCHER:RemoveDefenderFromSquadron( Squadron, Defender )
|
function AI_A2G_DISPATCHER:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
self.Defenders = self.Defenders or {}
|
self.Defenders = self.Defenders or {}
|
||||||
local DefenderName = Defender:GetName()
|
local DefenderName = Defender:GetName()
|
||||||
@ -3796,7 +3796,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_Fsm:onafterLostControl( DefenderGroup, From, Event, To )
|
function AI_A2G_Fsm:onafterLostControl( DefenderGroup, From, Event, To )
|
||||||
self:F({"LostControl", DefenderGroup:GetName()})
|
self:F({"LostControl", DefenderGroup:GetName()})
|
||||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||||
@ -3813,7 +3813,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
function AI_A2G_Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
||||||
self:F({"Home", DefenderGroup:GetName()})
|
self:F({"Home", DefenderGroup:GetName()})
|
||||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||||
@ -3894,7 +3894,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
local Squadron = Dispatcher:GetSquadronFromDefender( DefenderGroup )
|
||||||
|
|
||||||
if Squadron then
|
if Squadron then
|
||||||
local FirstUnit = AttackSetUnit:GetFirst()
|
local FirstUnit = AttackSetUnit:GetRandomSurely()
|
||||||
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
local Coordinate = FirstUnit:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
if self.SetSendPlayerMessages then
|
if self.SetSendPlayerMessages then
|
||||||
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", on route to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
Dispatcher:MessageToPlayers( Squadron, DefenderName .. ", on route to ground target at " .. Coordinate:ToStringA2G( DefenderGroup ), DefenderGroup )
|
||||||
@ -3933,7 +3933,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_Fsm:onafterLostControl( DefenderGroup, From, Event, To )
|
function AI_A2G_Fsm:onafterLostControl( DefenderGroup, From, Event, To )
|
||||||
self:F({"Defender LostControl", DefenderGroup:GetName()})
|
self:F({"Defender LostControl", DefenderGroup:GetName()})
|
||||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||||
@ -3950,7 +3950,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
function AI_A2G_Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
function AI_A2G_Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
||||||
self:F({"Defender Home", DefenderGroup:GetName()})
|
self:F({"Defender Home", DefenderGroup:GetName()})
|
||||||
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
self:GetParent(self).onafterHome( self, DefenderGroup, From, Event, To )
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
-- @module AI.AI_Air
|
-- @module AI.AI_Air
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
--- @type AI_AIR
|
-- @type AI_AIR
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
|
|
||||||
--- The AI_AIR class implements the core functions to operate an AI @{Wrapper.Group}.
|
--- The AI_AIR class implements the core functions to operate an AI @{Wrapper.Group}.
|
||||||
@ -264,7 +264,7 @@ function AI_AIR:New( AIGroup )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP self
|
-- @param Wrapper.Group#GROUP self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function GROUP:OnEventTakeoff( EventData, Fsm )
|
function GROUP:OnEventTakeoff( EventData, Fsm )
|
||||||
Fsm:Takeoff()
|
Fsm:Takeoff()
|
||||||
@ -446,13 +446,13 @@ function AI_AIR:onafterReturn( Controllable, From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
function AI_AIR:onbeforeStatus()
|
function AI_AIR:onbeforeStatus()
|
||||||
|
|
||||||
return self.CheckStatus
|
return self.CheckStatus
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
function AI_AIR:onafterStatus()
|
function AI_AIR:onafterStatus()
|
||||||
|
|
||||||
if self.Controllable and self.Controllable:IsAlive() then
|
if self.Controllable and self.Controllable:IsAlive() then
|
||||||
@ -465,7 +465,7 @@ function AI_AIR:onafterStatus()
|
|||||||
local DistanceFromHomeBase = self.HomeAirbase:GetCoordinate():Get2DDistance( self.Controllable:GetCoordinate() )
|
local DistanceFromHomeBase = self.HomeAirbase:GetCoordinate():Get2DDistance( self.Controllable:GetCoordinate() )
|
||||||
|
|
||||||
if DistanceFromHomeBase > self.DisengageRadius then
|
if DistanceFromHomeBase > self.DisengageRadius then
|
||||||
self:I( self.Controllable:GetName() .. " is too far from home base, RTB!" )
|
self:T( self.Controllable:GetName() .. " is too far from home base, RTB!" )
|
||||||
self:Hold( 300 )
|
self:Hold( 300 )
|
||||||
RTB = false
|
RTB = false
|
||||||
end
|
end
|
||||||
@ -489,10 +489,10 @@ function AI_AIR:onafterStatus()
|
|||||||
if Fuel < self.FuelThresholdPercentage then
|
if Fuel < self.FuelThresholdPercentage then
|
||||||
|
|
||||||
if self.TankerName then
|
if self.TankerName then
|
||||||
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
self:T( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
|
||||||
self:Refuel()
|
self:Refuel()
|
||||||
else
|
else
|
||||||
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... RTB!" )
|
self:T( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... RTB!" )
|
||||||
local OldAIControllable = self.Controllable
|
local OldAIControllable = self.Controllable
|
||||||
|
|
||||||
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
||||||
@ -518,7 +518,7 @@ function AI_AIR:onafterStatus()
|
|||||||
-- Note that a group can consist of more units, so if one unit is damaged of a group, the mission may continue.
|
-- Note that a group can consist of more units, so if one unit is damaged of a group, the mission may continue.
|
||||||
-- The damaged unit will RTB due to DCS logic, and the others will continue to engage.
|
-- The damaged unit will RTB due to DCS logic, and the others will continue to engage.
|
||||||
if ( Damage / InitialLife ) < self.PatrolDamageThreshold then
|
if ( Damage / InitialLife ) < self.PatrolDamageThreshold then
|
||||||
self:I( self.Controllable:GetName() .. " is damaged: " .. Damage .. " ... RTB!" )
|
self:T( self.Controllable:GetName() .. " is damaged: " .. Damage .. " ... RTB!" )
|
||||||
self:Damaged()
|
self:Damaged()
|
||||||
RTB = true
|
RTB = true
|
||||||
self:SetStatusOff()
|
self:SetStatusOff()
|
||||||
@ -536,7 +536,7 @@ function AI_AIR:onafterStatus()
|
|||||||
if Damage ~= InitialLife then
|
if Damage ~= InitialLife then
|
||||||
self:Damaged()
|
self:Damaged()
|
||||||
else
|
else
|
||||||
self:I( self.Controllable:GetName() .. " control lost! " )
|
self:T( self.Controllable:GetName() .. " control lost! " )
|
||||||
|
|
||||||
self:LostControl()
|
self:LostControl()
|
||||||
end
|
end
|
||||||
@ -560,7 +560,7 @@ function AI_AIR:onafterStatus()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR.RTBRoute( AIGroup, Fsm )
|
function AI_AIR.RTBRoute( AIGroup, Fsm )
|
||||||
|
|
||||||
AIGroup:F( { "AI_AIR.RTBRoute:", AIGroup:GetName() } )
|
AIGroup:F( { "AI_AIR.RTBRoute:", AIGroup:GetName() } )
|
||||||
@ -571,7 +571,7 @@ function AI_AIR.RTBRoute( AIGroup, Fsm )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR.RTBHold( AIGroup, Fsm )
|
function AI_AIR.RTBHold( AIGroup, Fsm )
|
||||||
|
|
||||||
AIGroup:F( { "AI_AIR.RTBHold:", AIGroup:GetName() } )
|
AIGroup:F( { "AI_AIR.RTBHold:", AIGroup:GetName() } )
|
||||||
@ -598,7 +598,7 @@ function AI_AIR:SetRTBSpeedFactors(MinFactor,MaxFactor)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
||||||
self:F( { AIGroup, From, Event, To } )
|
self:F( { AIGroup, From, Event, To } )
|
||||||
@ -617,7 +617,10 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
local FromCoord = AIGroup:GetCoordinate()
|
local FromCoord = AIGroup:GetCoordinate()
|
||||||
|
if not FromCoord then return end
|
||||||
|
|
||||||
local ToTargetCoord = self.HomeAirbase:GetCoordinate() -- coordinate is on land height(!)
|
local ToTargetCoord = self.HomeAirbase:GetCoordinate() -- coordinate is on land height(!)
|
||||||
|
|
||||||
local ToTargetVec3 = ToTargetCoord:GetVec3()
|
local ToTargetVec3 = ToTargetCoord:GetVec3()
|
||||||
ToTargetVec3.y = ToTargetCoord:GetLandHeight()+3000 -- let's set this 1000m/3000 feet above ground
|
ToTargetVec3.y = ToTargetCoord:GetLandHeight()+3000 -- let's set this 1000m/3000 feet above ground
|
||||||
local ToTargetCoord2 = COORDINATE:NewFromVec3( ToTargetVec3 )
|
local ToTargetCoord2 = COORDINATE:NewFromVec3( ToTargetVec3 )
|
||||||
@ -638,13 +641,13 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
local ToAirbaseCoord = ToTargetCoord2
|
local ToAirbaseCoord = ToTargetCoord2
|
||||||
|
|
||||||
if Distance < 5000 then
|
if Distance < 5000 then
|
||||||
self:I( "RTB and near the airbase!" )
|
self:T( "RTB and near the airbase!" )
|
||||||
self:Home()
|
self:Home()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not AIGroup:InAir() == true then
|
if not AIGroup:InAir() == true then
|
||||||
self:I( "Not anymore in the air, considered Home." )
|
self:T( "Not anymore in the air, considered Home." )
|
||||||
self:Home()
|
self:Home()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -686,12 +689,12 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR:onafterHome( AIGroup, From, Event, To )
|
function AI_AIR:onafterHome( AIGroup, From, Event, To )
|
||||||
self:F( { AIGroup, From, Event, To } )
|
self:F( { AIGroup, From, Event, To } )
|
||||||
|
|
||||||
self:I( "Group " .. self.Controllable:GetName() .. " ... Home! ( " .. self:GetState() .. " )" )
|
self:T( "Group " .. self.Controllable:GetName() .. " ... Home! ( " .. self:GetState() .. " )" )
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
end
|
end
|
||||||
@ -700,15 +703,17 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR:onafterHold( AIGroup, From, Event, To, HoldTime )
|
function AI_AIR:onafterHold( AIGroup, From, Event, To, HoldTime )
|
||||||
self:F( { AIGroup, From, Event, To } )
|
self:F( { AIGroup, From, Event, To } )
|
||||||
|
|
||||||
self:I( "Group " .. self.Controllable:GetName() .. " ... Holding! ( " .. self:GetState() .. " )" )
|
self:T( "Group " .. self.Controllable:GetName() .. " ... Holding! ( " .. self:GetState() .. " )" )
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
local OrbitTask = AIGroup:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
local Coordinate = AIGroup:GetCoordinate()
|
||||||
|
if Coordinate == nil then return end
|
||||||
|
local OrbitTask = AIGroup:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed, Coordinate )
|
||||||
local TimedOrbitTask = AIGroup:TaskControlled( OrbitTask, AIGroup:TaskCondition( nil, nil, nil, nil, HoldTime , nil ) )
|
local TimedOrbitTask = AIGroup:TaskControlled( OrbitTask, AIGroup:TaskCondition( nil, nil, nil, nil, HoldTime , nil ) )
|
||||||
|
|
||||||
local RTBTask = AIGroup:TaskFunction( "AI_AIR.RTBHold", self )
|
local RTBTask = AIGroup:TaskFunction( "AI_AIR.RTBHold", self )
|
||||||
@ -722,17 +727,17 @@ function AI_AIR:onafterHold( AIGroup, From, Event, To, HoldTime )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR.Resume( AIGroup, Fsm )
|
function AI_AIR.Resume( AIGroup, Fsm )
|
||||||
|
|
||||||
AIGroup:I( { "AI_AIR.Resume:", AIGroup:GetName() } )
|
AIGroup:T( { "AI_AIR.Resume:", AIGroup:GetName() } )
|
||||||
if AIGroup:IsAlive() then
|
if AIGroup:IsAlive() then
|
||||||
Fsm:__RTB( Fsm.TaskDelay )
|
Fsm:__RTB( Fsm.TaskDelay )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
||||||
self:F( { AIGroup, From, Event, To } )
|
self:F( { AIGroup, From, Event, To } )
|
||||||
@ -744,7 +749,7 @@ function AI_AIR:onafterRefuel( AIGroup, From, Event, To )
|
|||||||
|
|
||||||
if Tanker and Tanker:IsAlive() and Tanker:IsAirPlane() then
|
if Tanker and Tanker:IsAlive() and Tanker:IsAirPlane() then
|
||||||
|
|
||||||
self:I( "Group " .. self.Controllable:GetName() .. " ... Refuelling! State=" .. self:GetState() .. ", Refuelling tanker " .. self.TankerName )
|
self:T( "Group " .. self.Controllable:GetName() .. " ... Refuelling! State=" .. self:GetState() .. ", Refuelling tanker " .. self.TankerName )
|
||||||
|
|
||||||
local RefuelRoute = {}
|
local RefuelRoute = {}
|
||||||
|
|
||||||
@ -798,13 +803,13 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
function AI_AIR:onafterDead()
|
function AI_AIR:onafterDead()
|
||||||
self:SetStatusOff()
|
self:SetStatusOff()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR:OnCrash( EventData )
|
function AI_AIR:OnCrash( EventData )
|
||||||
|
|
||||||
@ -815,7 +820,7 @@ function AI_AIR:OnCrash( EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR:OnEjection( EventData )
|
function AI_AIR:OnEjection( EventData )
|
||||||
|
|
||||||
@ -824,7 +829,7 @@ function AI_AIR:OnEjection( EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR:OnPilotDead( EventData )
|
function AI_AIR:OnPilotDead( EventData )
|
||||||
|
|
||||||
|
|||||||
@ -900,14 +900,14 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- @type AI_AIR_DISPATCHER.DefenseCoordinates
|
-- @type AI_AIR_DISPATCHER.DefenseCoordinates
|
||||||
-- @map <#string,Core.Point#COORDINATE> A list of all defense coordinates mapped per defense coordinate name.
|
-- @map <#string,Core.Point#COORDINATE> A list of all defense coordinates mapped per defense coordinate name.
|
||||||
|
|
||||||
--- @field #AI_AIR_DISPATCHER.DefenseCoordinates DefenseCoordinates
|
-- @field #AI_AIR_DISPATCHER.DefenseCoordinates DefenseCoordinates
|
||||||
AI_AIR_DISPATCHER.DefenseCoordinates = {}
|
AI_AIR_DISPATCHER.DefenseCoordinates = {}
|
||||||
|
|
||||||
--- Enumerator for spawns at airbases
|
--- Enumerator for spawns at airbases
|
||||||
-- @type AI_AIR_DISPATCHER.Takeoff
|
-- @type AI_AIR_DISPATCHER.Takeoff
|
||||||
-- @extends Wrapper.Group#GROUP.Takeoff
|
-- @extends Wrapper.Group#GROUP.Takeoff
|
||||||
|
|
||||||
--- @field #AI_AIR_DISPATCHER.Takeoff Takeoff
|
-- @field #AI_AIR_DISPATCHER.Takeoff Takeoff
|
||||||
AI_AIR_DISPATCHER.Takeoff = GROUP.Takeoff
|
AI_AIR_DISPATCHER.Takeoff = GROUP.Takeoff
|
||||||
|
|
||||||
--- Defnes Landing location.
|
--- Defnes Landing location.
|
||||||
@ -938,7 +938,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
-- @type AI_AIR_DISPATCHER.DefenseQueue
|
-- @type AI_AIR_DISPATCHER.DefenseQueue
|
||||||
-- @list<#AI_AIR_DISPATCHER.DefenseQueueItem> DefenseQueueItem A list of all defenses being queued ...
|
-- @list<#AI_AIR_DISPATCHER.DefenseQueueItem> DefenseQueueItem A list of all defenses being queued ...
|
||||||
|
|
||||||
--- @field #AI_AIR_DISPATCHER.DefenseQueue DefenseQueue
|
-- @field #AI_AIR_DISPATCHER.DefenseQueue DefenseQueue
|
||||||
AI_AIR_DISPATCHER.DefenseQueue = {}
|
AI_AIR_DISPATCHER.DefenseQueue = {}
|
||||||
|
|
||||||
--- Defense approach types
|
--- Defense approach types
|
||||||
@ -1130,7 +1130,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
function AI_AIR_DISPATCHER:onafterStart( From, Event, To )
|
function AI_AIR_DISPATCHER:onafterStart( From, Event, To )
|
||||||
|
|
||||||
self:GetParent( self ).onafterStart( self, From, Event, To )
|
self:GetParent( self ).onafterStart( self, From, Event, To )
|
||||||
@ -1141,7 +1141,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
for Resource = 1, DefenderSquadron.ResourceCount or 0 do
|
for Resource = 1, DefenderSquadron.ResourceCount or 0 do
|
||||||
self:ResourcePark( DefenderSquadron )
|
self:ResourcePark( DefenderSquadron )
|
||||||
end
|
end
|
||||||
self:I( "Parked resources for squadron " .. DefenderSquadron.Name )
|
self:T( "Parked resources for squadron " .. DefenderSquadron.Name )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -1194,7 +1194,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
function AI_AIR_DISPATCHER:ResourcePark( DefenderSquadron )
|
function AI_AIR_DISPATCHER:ResourcePark( DefenderSquadron )
|
||||||
local TemplateID = math.random( 1, #DefenderSquadron.Spawn )
|
local TemplateID = math.random( 1, #DefenderSquadron.Spawn )
|
||||||
local Spawn = DefenderSquadron.Spawn[ TemplateID ] -- Core.Spawn#SPAWN
|
local Spawn = DefenderSquadron.Spawn[ TemplateID ] -- Core.Spawn#SPAWN
|
||||||
@ -1211,31 +1211,31 @@ do -- AI_AIR_DISPATCHER
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR_DISPATCHER:OnEventBaseCaptured( EventData )
|
function AI_AIR_DISPATCHER:OnEventBaseCaptured( EventData )
|
||||||
|
|
||||||
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
|
||||||
|
|
||||||
self:I( "Captured " .. AirbaseName )
|
self:T( "Captured " .. AirbaseName )
|
||||||
|
|
||||||
-- Now search for all squadrons located at the airbase, and sanitize them.
|
-- Now search for all squadrons located at the airbase, and sanitize them.
|
||||||
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
|
||||||
if Squadron.AirbaseName == AirbaseName then
|
if Squadron.AirbaseName == AirbaseName then
|
||||||
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
|
||||||
Squadron.Captured = true
|
Squadron.Captured = true
|
||||||
self:I( "Squadron " .. SquadronName .. " captured." )
|
self:T( "Squadron " .. SquadronName .. " captured." )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR_DISPATCHER:OnEventCrashOrDead( EventData )
|
function AI_AIR_DISPATCHER:OnEventCrashOrDead( EventData )
|
||||||
self.Detection:ForgetDetectedUnit( EventData.IniUnitName )
|
self.Detection:ForgetDetectedUnit( EventData.IniUnitName )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR_DISPATCHER:OnEventLand( EventData )
|
function AI_AIR_DISPATCHER:OnEventLand( EventData )
|
||||||
self:F( "Landed" )
|
self:F( "Landed" )
|
||||||
@ -1252,7 +1252,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron, Defender )
|
self:ResourcePark( Squadron )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
if DefenderUnit:GetLife() ~= DefenderUnit:GetLife0() then
|
||||||
@ -1263,7 +1263,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR_DISPATCHER:OnEventEngineShutdown( EventData )
|
function AI_AIR_DISPATCHER:OnEventEngineShutdown( EventData )
|
||||||
local DefenderUnit = EventData.IniUnit
|
local DefenderUnit = EventData.IniUnit
|
||||||
@ -1279,31 +1279,31 @@ do -- AI_AIR_DISPATCHER
|
|||||||
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
self:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
end
|
end
|
||||||
DefenderUnit:Destroy()
|
DefenderUnit:Destroy()
|
||||||
self:ResourcePark( Squadron, Defender )
|
self:ResourcePark( Squadron )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
do -- Manage the defensive behaviour
|
do -- Manage the defensive behaviour
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param #string DefenseCoordinateName The name of the coordinate to be defended by AIR defenses.
|
-- @param #string DefenseCoordinateName The name of the coordinate to be defended by AIR defenses.
|
||||||
-- @param Core.Point#COORDINATE DefenseCoordinate The coordinate to be defended by AIR defenses.
|
-- @param Core.Point#COORDINATE DefenseCoordinate The coordinate to be defended by AIR defenses.
|
||||||
function AI_AIR_DISPATCHER:AddDefenseCoordinate( DefenseCoordinateName, DefenseCoordinate )
|
function AI_AIR_DISPATCHER:AddDefenseCoordinate( DefenseCoordinateName, DefenseCoordinate )
|
||||||
self.DefenseCoordinates[DefenseCoordinateName] = DefenseCoordinate
|
self.DefenseCoordinates[DefenseCoordinateName] = DefenseCoordinate
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
function AI_AIR_DISPATCHER:SetDefenseReactivityLow()
|
function AI_AIR_DISPATCHER:SetDefenseReactivityLow()
|
||||||
self.DefenseReactivity = 0.05
|
self.DefenseReactivity = 0.05
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
function AI_AIR_DISPATCHER:SetDefenseReactivityMedium()
|
function AI_AIR_DISPATCHER:SetDefenseReactivityMedium()
|
||||||
self.DefenseReactivity = 0.15
|
self.DefenseReactivity = 0.15
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
function AI_AIR_DISPATCHER:SetDefenseReactivityHigh()
|
function AI_AIR_DISPATCHER:SetDefenseReactivityHigh()
|
||||||
self.DefenseReactivity = 0.5
|
self.DefenseReactivity = 0.5
|
||||||
end
|
end
|
||||||
@ -1867,7 +1867,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param #number TakeoffInterval Only Takeoff new units each specified interval in seconds in 10 seconds steps.
|
-- @param #number TakeoffInterval Only Takeoff new units each specified interval in seconds in 10 seconds steps.
|
||||||
-- @usage
|
-- @usage
|
||||||
@ -2769,7 +2769,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
|
|
||||||
-- TODO: Need to model the resources in a squadron.
|
-- TODO: Need to model the resources in a squadron.
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param AI.AI_Air_Squadron#AI_AIR_SQUADRON Squadron
|
-- @param AI.AI_Air_Squadron#AI_AIR_SQUADRON Squadron
|
||||||
function AI_AIR_DISPATCHER:AddDefenderToSquadron( Squadron, Defender, Size )
|
function AI_AIR_DISPATCHER:AddDefenderToSquadron( Squadron, Defender, Size )
|
||||||
self.Defenders = self.Defenders or {}
|
self.Defenders = self.Defenders or {}
|
||||||
@ -2782,7 +2782,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
self:F( { DefenderName = DefenderName, SquadronResourceCount = Squadron.ResourceCount } )
|
self:F( { DefenderName = DefenderName, SquadronResourceCount = Squadron.ResourceCount } )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param AI.AI_Air_Squadron#AI_AIR_SQUADRON Squadron
|
-- @param AI.AI_Air_Squadron#AI_AIR_SQUADRON Squadron
|
||||||
function AI_AIR_DISPATCHER:RemoveDefenderFromSquadron( Squadron, Defender )
|
function AI_AIR_DISPATCHER:RemoveDefenderFromSquadron( Squadron, Defender )
|
||||||
self.Defenders = self.Defenders or {}
|
self.Defenders = self.Defenders or {}
|
||||||
@ -2795,7 +2795,7 @@ do -- AI_AIR_DISPATCHER
|
|||||||
self:F( { DefenderName = DefenderName, SquadronResourceCount = SquadronResourceCount } )
|
self:F( { DefenderName = DefenderName, SquadronResourceCount = SquadronResourceCount } )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR_DISPATCHER self
|
-- @param #AI_AIR_DISPATCHER self
|
||||||
-- @param Wrapper.Group#GROUP Defender
|
-- @param Wrapper.Group#GROUP Defender
|
||||||
-- @return AI.AI_Air_Squadron#AI_AIR_SQUADRON The Squadron.
|
-- @return AI.AI_Air_Squadron#AI_AIR_SQUADRON The Squadron.
|
||||||
function AI_AIR_DISPATCHER:GetSquadronFromDefender( Defender )
|
function AI_AIR_DISPATCHER:GetSquadronFromDefender( Defender )
|
||||||
|
|||||||
@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @type AI_AIR_ENGAGE
|
-- @type AI_AIR_ENGAGE
|
||||||
-- @extends AI.AI_Air#AI_AIR
|
-- @extends AI.AI_AIR#AI_AIR
|
||||||
|
|
||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
@ -351,7 +351,7 @@ function AI_AIR_ENGAGE:onafterAbort( AIGroup, From, Event, To )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_AIR_ENGAGE self
|
-- @param #AI_AIR_ENGAGE self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup The Group Object managed by the FSM.
|
-- @param Wrapper.Group#GROUP AIGroup The Group Object 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.
|
||||||
@ -361,7 +361,7 @@ function AI_AIR_ENGAGE:onafterAccomplish( AIGroup, From, Event, To )
|
|||||||
--self:SetDetectionOff()
|
--self:SetDetectionOff()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR_ENGAGE self
|
-- @param #AI_AIR_ENGAGE self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup The Group Object managed by the FSM.
|
-- @param Wrapper.Group#GROUP AIGroup The Group Object 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.
|
||||||
@ -374,7 +374,7 @@ function AI_AIR_ENGAGE:onafterDestroy( AIGroup, From, Event, To, EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_AIR_ENGAGE self
|
-- @param #AI_AIR_ENGAGE self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_AIR_ENGAGE:OnEventDead( EventData )
|
function AI_AIR_ENGAGE:OnEventDead( EventData )
|
||||||
self:F( { "EventDead", EventData } )
|
self:F( { "EventDead", EventData } )
|
||||||
@ -387,9 +387,9 @@ function AI_AIR_ENGAGE:OnEventDead( EventData )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AIControllable
|
-- @param Wrapper.Group#GROUP AIControllable
|
||||||
function AI_AIR_ENGAGE.___EngageRoute( AIGroup, Fsm, AttackSetUnit )
|
function AI_AIR_ENGAGE.___EngageRoute( AIGroup, Fsm, AttackSetUnit )
|
||||||
Fsm:I(string.format("AI_AIR_ENGAGE.___EngageRoute: %s", tostring(AIGroup:GetName())))
|
Fsm:T(string.format("AI_AIR_ENGAGE.___EngageRoute: %s", tostring(AIGroup:GetName())))
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
Fsm:__EngageRoute( Fsm.TaskDelay or 0.1, AttackSetUnit )
|
Fsm:__EngageRoute( Fsm.TaskDelay or 0.1, AttackSetUnit )
|
||||||
@ -397,14 +397,14 @@ function AI_AIR_ENGAGE.___EngageRoute( AIGroup, Fsm, AttackSetUnit )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_AIR_ENGAGE self
|
-- @param #AI_AIR_ENGAGE self
|
||||||
-- @param Wrapper.Group#GROUP DefenderGroup The GroupGroup managed by the FSM.
|
-- @param Wrapper.Group#GROUP DefenderGroup The GroupGroup 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.
|
||||||
-- @param Core.Set#SET_UNIT AttackSetUnit Unit set to be attacked.
|
-- @param Core.Set#SET_UNIT AttackSetUnit Unit set to be attacked.
|
||||||
function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, AttackSetUnit )
|
function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, AttackSetUnit )
|
||||||
self:I( { DefenderGroup, From, Event, To, AttackSetUnit } )
|
self:T( { DefenderGroup, From, Event, To, AttackSetUnit } )
|
||||||
|
|
||||||
local DefenderGroupName = DefenderGroup:GetName()
|
local DefenderGroupName = DefenderGroup:GetName()
|
||||||
|
|
||||||
@ -426,7 +426,13 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
|||||||
local DefenderCoord = DefenderGroup:GetPointVec3()
|
local DefenderCoord = DefenderGroup:GetPointVec3()
|
||||||
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
local TargetCoord = AttackSetUnit:GetFirst():GetPointVec3()
|
local TargetCoord = AttackSetUnit:GetRandomSurely():GetPointVec3()
|
||||||
|
|
||||||
|
if TargetCoord == nil then
|
||||||
|
self:Return()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
TargetCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
TargetCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
||||||
@ -435,12 +441,12 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
|||||||
-- TODO: A factor of * 3 is way too close. This causes the AI not to engange until merged sometimes!
|
-- TODO: A factor of * 3 is way too close. This causes the AI not to engange until merged sometimes!
|
||||||
if TargetDistance <= EngageDistance * 9 then
|
if TargetDistance <= EngageDistance * 9 then
|
||||||
|
|
||||||
--self:I(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000))
|
--self:T(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000))
|
||||||
self:__Engage( 0.1, AttackSetUnit )
|
self:__Engage( 0.1, AttackSetUnit )
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
--self:I(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000))
|
--self:T(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000))
|
||||||
|
|
||||||
local EngageRoute = {}
|
local EngageRoute = {}
|
||||||
local AttackTasks = {}
|
local AttackTasks = {}
|
||||||
@ -472,16 +478,16 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- TODO: This will make an A2A Dispatcher CAP flight to return rather than going back to patrolling!
|
-- TODO: This will make an A2A Dispatcher CAP flight to return rather than going back to patrolling!
|
||||||
self:I( DefenderGroupName .. ": No targets found -> Going RTB")
|
self:T( DefenderGroupName .. ": No targets found -> Going RTB")
|
||||||
self:Return()
|
self:Return()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AIControllable
|
-- @param Wrapper.Group#GROUP AIControllable
|
||||||
function AI_AIR_ENGAGE.___Engage( AIGroup, Fsm, AttackSetUnit )
|
function AI_AIR_ENGAGE.___Engage( AIGroup, Fsm, AttackSetUnit )
|
||||||
|
|
||||||
Fsm:I(string.format("AI_AIR_ENGAGE.___Engage: %s", tostring(AIGroup:GetName())))
|
Fsm:T(string.format("AI_AIR_ENGAGE.___Engage: %s", tostring(AIGroup:GetName())))
|
||||||
|
|
||||||
if AIGroup and AIGroup:IsAlive() then
|
if AIGroup and AIGroup:IsAlive() then
|
||||||
local delay=Fsm.TaskDelay or 0.1
|
local delay=Fsm.TaskDelay or 0.1
|
||||||
@ -490,7 +496,7 @@ function AI_AIR_ENGAGE.___Engage( AIGroup, Fsm, AttackSetUnit )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_AIR_ENGAGE self
|
-- @param #AI_AIR_ENGAGE self
|
||||||
-- @param Wrapper.Group#GROUP DefenderGroup The GroupGroup managed by the FSM.
|
-- @param Wrapper.Group#GROUP DefenderGroup The GroupGroup 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.
|
||||||
@ -516,7 +522,7 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
|||||||
local DefenderCoord = DefenderGroup:GetPointVec3()
|
local DefenderCoord = DefenderGroup:GetPointVec3()
|
||||||
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
DefenderCoord:SetY( EngageAltitude ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
local TargetCoord = AttackSetUnit:GetFirst():GetPointVec3()
|
local TargetCoord = AttackSetUnit:GetRandomSurely():GetPointVec3()
|
||||||
if not TargetCoord then
|
if not TargetCoord then
|
||||||
self:Return()
|
self:Return()
|
||||||
return
|
return
|
||||||
@ -547,12 +553,12 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
|||||||
local AttackUnitTasks = self:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude ) -- Polymorphic
|
local AttackUnitTasks = self:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude ) -- Polymorphic
|
||||||
|
|
||||||
if #AttackUnitTasks == 0 then
|
if #AttackUnitTasks == 0 then
|
||||||
self:I( DefenderGroupName .. ": No valid targets found -> Going RTB")
|
self:T( DefenderGroupName .. ": No valid targets found -> Going RTB")
|
||||||
self:Return()
|
self:Return()
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
local text=string.format("%s: Engaging targets at distance %.2f NM", DefenderGroupName, UTILS.MetersToNM(TargetDistance))
|
local text=string.format("%s: Engaging targets at distance %.2f NM", DefenderGroupName, UTILS.MetersToNM(TargetDistance))
|
||||||
self:I(text)
|
self:T(text)
|
||||||
DefenderGroup:OptionROEOpenFire()
|
DefenderGroup:OptionROEOpenFire()
|
||||||
DefenderGroup:OptionROTEvadeFire()
|
DefenderGroup:OptionROTEvadeFire()
|
||||||
DefenderGroup:OptionKeepWeaponsOnThreat()
|
DefenderGroup:OptionKeepWeaponsOnThreat()
|
||||||
@ -569,13 +575,13 @@ function AI_AIR_ENGAGE:onafterEngage( DefenderGroup, From, Event, To, AttackSetU
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- TODO: This will make an A2A Dispatcher CAP flight to return rather than going back to patrolling!
|
-- TODO: This will make an A2A Dispatcher CAP flight to return rather than going back to patrolling!
|
||||||
self:I( DefenderGroupName .. ": No targets found -> returning.")
|
self:T( DefenderGroupName .. ": No targets found -> returning.")
|
||||||
self:Return()
|
self:Return()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP AIEngage
|
-- @param Wrapper.Group#GROUP AIEngage
|
||||||
function AI_AIR_ENGAGE.Resume( AIEngage, Fsm )
|
function AI_AIR_ENGAGE.Resume( AIEngage, Fsm )
|
||||||
|
|
||||||
AIEngage:F( { "Resume:", AIEngage:GetName() } )
|
AIEngage:F( { "Resume:", AIEngage:GetName() } )
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @type AI_AIR_SQUADRON
|
-- @type AI_AIR_SQUADRON
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ AI_AIR_SQUADRON = {
|
|||||||
-- @return #AI_AIR_SQUADRON
|
-- @return #AI_AIR_SQUADRON
|
||||||
function AI_AIR_SQUADRON:New( SquadronName, AirbaseName, TemplatePrefixes, ResourceCount )
|
function AI_AIR_SQUADRON:New( SquadronName, AirbaseName, TemplatePrefixes, ResourceCount )
|
||||||
|
|
||||||
self:I( { Air_Squadron = { SquadronName, AirbaseName, TemplatePrefixes, ResourceCount } } )
|
self:T( { Air_Squadron = { SquadronName, AirbaseName, TemplatePrefixes, ResourceCount } } )
|
||||||
|
|
||||||
local AI_Air_Squadron = BASE:New() -- #AI_AIR_SQUADRON
|
local AI_Air_Squadron = BASE:New() -- #AI_AIR_SQUADRON
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
-- @module AI.AI_Cargo
|
-- @module AI.AI_Cargo
|
||||||
-- @image Cargo.JPG
|
-- @image Cargo.JPG
|
||||||
|
|
||||||
--- @type AI_CARGO
|
-- @type AI_CARGO
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
|
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ function AI_CARGO:onafterUnloaded( Carrier, From, Event, To, Cargo, CarrierUnit,
|
|||||||
for _, CarrierUnit in pairs( Carrier:GetUnits() ) do
|
for _, CarrierUnit in pairs( Carrier:GetUnits() ) do
|
||||||
local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT
|
local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT
|
||||||
local IsEmpty = CarrierUnit:IsCargoEmpty()
|
local IsEmpty = CarrierUnit:IsCargoEmpty()
|
||||||
self:I({ IsEmpty = IsEmpty })
|
self:T({ IsEmpty = IsEmpty })
|
||||||
if not IsEmpty then
|
if not IsEmpty then
|
||||||
AllUnloaded = false
|
AllUnloaded = false
|
||||||
break
|
break
|
||||||
|
|||||||
@ -116,7 +116,7 @@
|
|||||||
-- @image AI_Cargo_Dispatcher.JPG
|
-- @image AI_Cargo_Dispatcher.JPG
|
||||||
|
|
||||||
|
|
||||||
--- @type AI_CARGO_DISPATCHER
|
-- @type AI_CARGO_DISPATCHER
|
||||||
-- @field Core.Set#SET_GROUP CarrierSet The set of @{Wrapper.Group#GROUP} objects of carriers that will transport the cargo.
|
-- @field Core.Set#SET_GROUP CarrierSet The set of @{Wrapper.Group#GROUP} objects of carriers that will transport the cargo.
|
||||||
-- @field Core.Set#SET_CARGO CargoSet The set of @{Cargo.Cargo#CARGO} objects, which can be CARGO_GROUP, CARGO_CRATE, CARGO_SLINGLOAD objects.
|
-- @field Core.Set#SET_CARGO CargoSet The set of @{Cargo.Cargo#CARGO} objects, which can be CARGO_GROUP, CARGO_CRATE, CARGO_SLINGLOAD objects.
|
||||||
-- @field Core.Zone#SET_ZONE PickupZoneSet The set of pickup zones, which are used to where the cargo can be picked up by the carriers. If nil, then cargo can be picked up everywhere.
|
-- @field Core.Zone#SET_ZONE PickupZoneSet The set of pickup zones, which are used to where the cargo can be picked up by the carriers. If nil, then cargo can be picked up everywhere.
|
||||||
@ -1161,7 +1161,7 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
|
|||||||
else
|
else
|
||||||
local text=string.format("WARNING: Cargo %s is too heavy to be loaded into transport. Cargo weight %.1f > %.1f load capacity of carrier %s.",
|
local text=string.format("WARNING: Cargo %s is too heavy to be loaded into transport. Cargo weight %.1f > %.1f load capacity of carrier %s.",
|
||||||
tostring(Cargo:GetName()), Cargo:GetWeight(), LargestLoadCapacity, tostring(Carrier:GetName()))
|
tostring(Cargo:GetName()), Cargo:GetWeight(), LargestLoadCapacity, tostring(Carrier:GetName()))
|
||||||
self:I(text)
|
self:T(text)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -556,7 +556,7 @@ function AI_ESCORT:SetFlightMenuFormation( Formation )
|
|||||||
|
|
||||||
if MenuFormation then
|
if MenuFormation then
|
||||||
local Arguments = MenuFormation.Arguments
|
local Arguments = MenuFormation.Arguments
|
||||||
--self:I({Arguments=unpack(Arguments)})
|
--self:T({Arguments=unpack(Arguments)})
|
||||||
local FlightMenuFormation = MENU_GROUP:New( self.PlayerGroup, "Formation", self.MainMenu )
|
local FlightMenuFormation = MENU_GROUP:New( self.PlayerGroup, "Formation", self.MainMenu )
|
||||||
local MenuFlightFormationID = MENU_GROUP_COMMAND:New( self.PlayerGroup, Formation, FlightMenuFormation,
|
local MenuFlightFormationID = MENU_GROUP_COMMAND:New( self.PlayerGroup, Formation, FlightMenuFormation,
|
||||||
function ( self, Formation, ... )
|
function ( self, Formation, ... )
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
|
|
||||||
--- @type AI_ESCORT_DISPATCHER
|
-- @type AI_ESCORT_DISPATCHER
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ AI_ESCORT_DISPATCHER = {
|
|||||||
ClassName = "AI_ESCORT_DISPATCHER",
|
ClassName = "AI_ESCORT_DISPATCHER",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @field #list
|
-- @field #list
|
||||||
AI_ESCORT_DISPATCHER.AI_Escorts = {}
|
AI_ESCORT_DISPATCHER.AI_Escorts = {}
|
||||||
|
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ function AI_ESCORT_DISPATCHER:onafterStart( From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_ESCORT_DISPATCHER self
|
-- @param #AI_ESCORT_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
||||||
|
|
||||||
@ -110,11 +110,11 @@ function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
|||||||
local PlayerGroup = EventData.IniGroup
|
local PlayerGroup = EventData.IniGroup
|
||||||
local PlayerUnit = EventData.IniUnit
|
local PlayerUnit = EventData.IniUnit
|
||||||
|
|
||||||
self:I({EscortAirbase= self.EscortAirbase } )
|
self:T({EscortAirbase= self.EscortAirbase } )
|
||||||
self:I({PlayerGroupName = PlayerGroupName } )
|
self:T({PlayerGroupName = PlayerGroupName } )
|
||||||
self:I({PlayerGroup = PlayerGroup})
|
self:T({PlayerGroup = PlayerGroup})
|
||||||
self:I({FirstGroup = self.CarrierSet:GetFirst()})
|
self:T({FirstGroup = self.CarrierSet:GetFirst()})
|
||||||
self:I({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
self:T({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
||||||
|
|
||||||
if self.CarrierSet:FindGroup( PlayerGroupName ) then
|
if self.CarrierSet:FindGroup( PlayerGroupName ) then
|
||||||
if self.AI_Escorts[PlayerGroupName] then
|
if self.AI_Escorts[PlayerGroupName] then
|
||||||
@ -125,7 +125,7 @@ function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_ESCORT_DISPATCHER self
|
-- @param #AI_ESCORT_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_ESCORT_DISPATCHER:OnEventBirth( EventData )
|
function AI_ESCORT_DISPATCHER:OnEventBirth( EventData )
|
||||||
|
|
||||||
@ -133,17 +133,17 @@ function AI_ESCORT_DISPATCHER:OnEventBirth( EventData )
|
|||||||
local PlayerGroup = EventData.IniGroup
|
local PlayerGroup = EventData.IniGroup
|
||||||
local PlayerUnit = EventData.IniUnit
|
local PlayerUnit = EventData.IniUnit
|
||||||
|
|
||||||
self:I({EscortAirbase= self.EscortAirbase } )
|
self:T({EscortAirbase= self.EscortAirbase } )
|
||||||
self:I({PlayerGroupName = PlayerGroupName } )
|
self:T({PlayerGroupName = PlayerGroupName } )
|
||||||
self:I({PlayerGroup = PlayerGroup})
|
self:T({PlayerGroup = PlayerGroup})
|
||||||
self:I({FirstGroup = self.CarrierSet:GetFirst()})
|
self:T({FirstGroup = self.CarrierSet:GetFirst()})
|
||||||
self:I({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
self:T({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
||||||
|
|
||||||
if self.CarrierSet:FindGroup( PlayerGroupName ) then
|
if self.CarrierSet:FindGroup( PlayerGroupName ) then
|
||||||
if not self.AI_Escorts[PlayerGroupName] then
|
if not self.AI_Escorts[PlayerGroupName] then
|
||||||
local LeaderUnit = PlayerUnit
|
local LeaderUnit = PlayerUnit
|
||||||
local EscortGroup = self.EscortSpawn:SpawnAtAirbase( self.EscortAirbase, SPAWN.Takeoff.Hot )
|
local EscortGroup = self.EscortSpawn:SpawnAtAirbase( self.EscortAirbase, SPAWN.Takeoff.Hot )
|
||||||
self:I({EscortGroup = EscortGroup})
|
self:T({EscortGroup = EscortGroup})
|
||||||
|
|
||||||
self:ScheduleOnce( 1,
|
self:ScheduleOnce( 1,
|
||||||
function( EscortGroup )
|
function( EscortGroup )
|
||||||
|
|||||||
@ -652,15 +652,15 @@ function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
--- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable+
|
||||||
function AI_PATROL_ZONE:onbeforeDetect( Controllable, From, Event, To )
|
function AI_PATROL_ZONE:onbeforeDetect( Controllable, From, Event, To )
|
||||||
|
|
||||||
return self.DetectOn and self.DetectActivated
|
return self.DetectOn and self.DetectActivated
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
--- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
|
||||||
function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
|
function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
|
||||||
|
|
||||||
local Detected = false
|
local Detected = false
|
||||||
@ -705,7 +705,7 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param Wrapper.Controllable#CONTROLLABLE AIControllable
|
-- @param Wrapper.Controllable#CONTROLLABLE AIControllable
|
||||||
-- This static method is called from the route path within the last task at the last waypoint of the Controllable.
|
-- This static method is called from the route path within the last task at the last waypoint of the Controllable.
|
||||||
-- Note that this method is required, as triggers the next route when patrolling for the Controllable.
|
-- Note that this method is required, as triggers the next route when patrolling for the Controllable.
|
||||||
function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable )
|
function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable )
|
||||||
@ -822,13 +822,13 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
function AI_PATROL_ZONE:onbeforeStatus()
|
function AI_PATROL_ZONE:onbeforeStatus()
|
||||||
|
|
||||||
return self.CheckStatus
|
return self.CheckStatus
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
function AI_PATROL_ZONE:onafterStatus()
|
function AI_PATROL_ZONE:onafterStatus()
|
||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
@ -838,7 +838,7 @@ function AI_PATROL_ZONE:onafterStatus()
|
|||||||
|
|
||||||
local Fuel = self.Controllable:GetFuelMin()
|
local Fuel = self.Controllable:GetFuelMin()
|
||||||
if Fuel < self.PatrolFuelThresholdPercentage then
|
if Fuel < self.PatrolFuelThresholdPercentage then
|
||||||
self:I( self.Controllable:GetName() .. " is out of fuel:" .. Fuel .. ", RTB!" )
|
self:T( self.Controllable:GetName() .. " is out of fuel:" .. Fuel .. ", RTB!" )
|
||||||
local OldAIControllable = self.Controllable
|
local OldAIControllable = self.Controllable
|
||||||
|
|
||||||
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
|
||||||
@ -852,7 +852,7 @@ function AI_PATROL_ZONE:onafterStatus()
|
|||||||
-- TODO: Check GROUP damage function.
|
-- TODO: Check GROUP damage function.
|
||||||
local Damage = self.Controllable:GetLife()
|
local Damage = self.Controllable:GetLife()
|
||||||
if Damage <= self.PatrolDamageThreshold then
|
if Damage <= self.PatrolDamageThreshold then
|
||||||
self:I( self.Controllable:GetName() .. " is damaged:" .. Damage .. ", RTB!" )
|
self:T( self.Controllable:GetName() .. " is damaged:" .. Damage .. ", RTB!" )
|
||||||
RTB = true
|
RTB = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -864,7 +864,7 @@ function AI_PATROL_ZONE:onafterStatus()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
function AI_PATROL_ZONE:onafterRTB()
|
function AI_PATROL_ZONE:onafterRTB()
|
||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
@ -903,13 +903,13 @@ function AI_PATROL_ZONE:onafterRTB()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
function AI_PATROL_ZONE:onafterDead()
|
function AI_PATROL_ZONE:onafterDead()
|
||||||
self:SetDetectionOff()
|
self:SetDetectionOff()
|
||||||
self:SetStatusOff()
|
self:SetStatusOff()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_PATROL_ZONE:OnCrash( EventData )
|
function AI_PATROL_ZONE:OnCrash( EventData )
|
||||||
|
|
||||||
@ -920,7 +920,7 @@ function AI_PATROL_ZONE:OnCrash( EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_PATROL_ZONE:OnEjection( EventData )
|
function AI_PATROL_ZONE:OnEjection( EventData )
|
||||||
|
|
||||||
@ -929,7 +929,7 @@ function AI_PATROL_ZONE:OnEjection( EventData )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #AI_PATROL_ZONE self
|
-- @param #AI_PATROL_ZONE self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function AI_PATROL_ZONE:OnPilotDead( EventData )
|
function AI_PATROL_ZONE:OnPilotDead( EventData )
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user