mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Updates
This commit is contained in:
@@ -1449,7 +1449,6 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- @return #AI_A2A_DISPATCHER
|
-- @return #AI_A2A_DISPATCHER
|
||||||
function AI_A2A_DISPATCHER:SetSquadron( SquadronName, AirbaseName, SpawnTemplates, Resources )
|
function AI_A2A_DISPATCHER:SetSquadron( SquadronName, AirbaseName, SpawnTemplates, Resources )
|
||||||
|
|
||||||
self:E( { SquadronName = SquadronName, AirbaseName = AirbaseName, SpawnTemplates = SpawnTemplates, Resources = Resources } )
|
|
||||||
|
|
||||||
self.DefenderSquadrons[SquadronName] = self.DefenderSquadrons[SquadronName] or {}
|
self.DefenderSquadrons[SquadronName] = self.DefenderSquadrons[SquadronName] or {}
|
||||||
|
|
||||||
@@ -1473,6 +1472,8 @@ do -- AI_A2A_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
DefenderSquadron.Resources = Resources
|
DefenderSquadron.Resources = Resources
|
||||||
|
|
||||||
|
self:E( { Squadron = {SquadronName, AirbaseName, SpawnTemplates, Resources } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1537,6 +1538,8 @@ do -- AI_A2A_DISPATCHER
|
|||||||
Cap.AltType = AltType
|
Cap.AltType = AltType
|
||||||
|
|
||||||
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:E( { CAP = { SquadronName, Zone, FloorAltitude, CeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, AltType } } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1684,6 +1687,8 @@ do -- AI_A2A_DISPATCHER
|
|||||||
Intercept.Name = SquadronName
|
Intercept.Name = SquadronName
|
||||||
Intercept.EngageMinSpeed = EngageMinSpeed
|
Intercept.EngageMinSpeed = EngageMinSpeed
|
||||||
Intercept.EngageMaxSpeed = EngageMaxSpeed
|
Intercept.EngageMaxSpeed = EngageMaxSpeed
|
||||||
|
|
||||||
|
self:E( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed } } )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Defines the default amount of extra planes that will take-off as part of the defense system.
|
--- Defines the default amount of extra planes that will take-off as part of the defense system.
|
||||||
@@ -2637,6 +2642,8 @@ do -- AI_A2A_DISPATCHER
|
|||||||
-- @param #AI_A2A_DISPATCHER self
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
function AI_A2A_DISPATCHER:onafterGCI( From, Event, To, DetectedItem, DefendersMissing, Friendlies )
|
function AI_A2A_DISPATCHER:onafterGCI( From, Event, To, DetectedItem, DefendersMissing, Friendlies )
|
||||||
|
|
||||||
|
self:F( { From, Event, To, DetectedItem.Index, DefendersMissing, Friendlies } )
|
||||||
|
|
||||||
local AttackerSet = DetectedItem.Set
|
local AttackerSet = DetectedItem.Set
|
||||||
local AttackerCount = AttackerSet:Count()
|
local AttackerCount = AttackerSet:Count()
|
||||||
local DefendersCount = 0
|
local DefendersCount = 0
|
||||||
@@ -2659,17 +2666,19 @@ do -- AI_A2A_DISPATCHER
|
|||||||
local BreakLoop = false
|
local BreakLoop = false
|
||||||
|
|
||||||
while( DefendersCount > 0 and not BreakLoop ) do
|
while( DefendersCount > 0 and not BreakLoop ) do
|
||||||
|
self:F( { DefenderSquadrons = self.DefenderSquadrons } )
|
||||||
for SquadronName, DefenderSquadron in pairs( self.DefenderSquadrons or {} ) do
|
for SquadronName, DefenderSquadron in pairs( self.DefenderSquadrons or {} ) do
|
||||||
|
self:F( { GCI = DefenderSquadron.Gci } )
|
||||||
for InterceptID, Intercept in pairs( DefenderSquadron.Gci or {} ) do
|
for InterceptID, Intercept in pairs( DefenderSquadron.Gci or {} ) do
|
||||||
|
|
||||||
--self:E( { DefenderSquadron } )
|
self:F( { DefenderSquadron } )
|
||||||
local SpawnCoord = DefenderSquadron.Airbase:GetCoordinate() -- Core.Point#COORDINATE
|
local SpawnCoord = DefenderSquadron.Airbase:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
--local TargetCoord = AttackerSet:GetFirst():GetCoordinate()
|
--local TargetCoord = AttackerSet:GetFirst():GetCoordinate()
|
||||||
local TargetCoord = DetectedItem.InterceptCoord
|
local InterceptCoord = DetectedItem.InterceptCoord
|
||||||
if TargetCoord then
|
self:F({InterceptCoord = InterceptCoord})
|
||||||
local Distance = SpawnCoord:Get2DDistance( TargetCoord )
|
if InterceptCoord then
|
||||||
self:F( { Distance = Distance, TargetCoord = TargetCoord } )
|
local Distance = SpawnCoord:Get2DDistance( InterceptCoord )
|
||||||
|
self:F( { Distance = Distance, InterceptCoord = InterceptCoord } )
|
||||||
|
|
||||||
if ClosestDistance == 0 or Distance < ClosestDistance then
|
if ClosestDistance == 0 or Distance < ClosestDistance then
|
||||||
|
|
||||||
@@ -3455,6 +3464,7 @@ do
|
|||||||
-- Setup squadrons
|
-- Setup squadrons
|
||||||
|
|
||||||
self:F( { Airbases = AirbaseNames } )
|
self:F( { Airbases = AirbaseNames } )
|
||||||
|
self.Templates:Flush()
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -2366,24 +2366,21 @@ do -- DETECTION_AREAS
|
|||||||
-- @param #DETECTION_BASE.DetectedItem DetectedItem
|
-- @param #DETECTION_BASE.DetectedItem DetectedItem
|
||||||
function DETECTION_AREAS:CalculateIntercept( DetectedItem )
|
function DETECTION_AREAS:CalculateIntercept( DetectedItem )
|
||||||
|
|
||||||
|
local DetectedSpeed = DetectedItem.Coordinate.Speed
|
||||||
|
local DetectedHeading = DetectedItem.Coordinate.Heading
|
||||||
|
local DetectedCoord = DetectedItem.Coordinate
|
||||||
|
|
||||||
if self.Intercept then
|
if self.Intercept then
|
||||||
local DetectedSet = DetectedItem.Set
|
local DetectedSet = DetectedItem.Set
|
||||||
if DetectedUnit then
|
-- todo: speed
|
||||||
-- todo: speed
|
|
||||||
local DetectedSpeed = DetectedItem.Coordinate.Speed
|
local TranslateDistance = DetectedSpeed * self.InterceptDelay
|
||||||
local DetectedHeading = DetectedItem.Coordinate.Heading
|
|
||||||
local DetectedCoord = DetectedItem.Coordinate
|
local InterceptCoord = DetectedCoord:Translate( TranslateDistance, DetectedHeading )
|
||||||
|
|
||||||
local TranslateDistance = DetectedSpeed * self.InterceptDelay
|
DetectedItem.InterceptCoord = InterceptCoord
|
||||||
|
|
||||||
local InterceptCoord = DetectedCoord:Translate( TranslateDistance, DetectedHeading )
|
|
||||||
|
|
||||||
DetectedItem.InterceptCoord = InterceptCoord
|
|
||||||
else
|
|
||||||
DetectedItem.InterceptCoord = nil
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
DetectedItem.InterceptCoord = nil
|
DetectedItem.InterceptCoord = DetectedCoord
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user