mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Fixed overhead problems
This commit is contained in:
parent
8b26f7d975
commit
1fee3eb7a8
@ -1304,6 +1304,12 @@ do -- AI_A2A_DISPATCHER
|
|||||||
function AI_A2A_DISPATCHER:GetDefenderTaskTarget( Defender )
|
function AI_A2A_DISPATCHER:GetDefenderTaskTarget( Defender )
|
||||||
return self:GetDefenderTask( Defender ).Target
|
return self:GetDefenderTask( Defender ).Target
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---
|
||||||
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
|
function AI_A2A_DISPATCHER:GetDefenderTaskSquadronName( Defender )
|
||||||
|
return self:GetDefenderTask( Defender ).SquadronName
|
||||||
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
-- @param #AI_A2A_DISPATCHER self
|
-- @param #AI_A2A_DISPATCHER self
|
||||||
@ -2513,23 +2519,28 @@ do -- AI_A2A_DISPATCHER
|
|||||||
function AI_A2A_DISPATCHER:CountDefendersEngaged( AttackerDetection )
|
function AI_A2A_DISPATCHER:CountDefendersEngaged( AttackerDetection )
|
||||||
|
|
||||||
-- First, count the active AIGroups Units, targetting the DetectedSet
|
-- First, count the active AIGroups Units, targetting the DetectedSet
|
||||||
local AIUnitCount = 0
|
local DefenderCount = 0
|
||||||
|
|
||||||
self:E( "Counting Defenders Engaged for Attacker:" )
|
self:E( "Counting Defenders Engaged for Attacker:" )
|
||||||
local DetectedSet = AttackerDetection.Set
|
local DetectedSet = AttackerDetection.Set
|
||||||
DetectedSet:Flush()
|
DetectedSet:Flush()
|
||||||
|
|
||||||
local DefenderTasks = self:GetDefenderTasks()
|
local DefenderTasks = self:GetDefenderTasks()
|
||||||
for AIGroup, DefenderTask in pairs( DefenderTasks ) do
|
for Defender, DefenderTask in pairs( DefenderTasks ) do
|
||||||
local AIGroup = AIGroup -- Wrapper.Group#GROUP
|
local Defender = Defender -- Wrapper.Group#GROUP
|
||||||
local DefenderTask = self:GetDefenderTaskTarget( AIGroup )
|
local DefenderTaskTarget = DefenderTask.Target
|
||||||
if DefenderTask and DefenderTask.Index == AttackerDetection.Index then
|
local DefenderSquadronName = DefenderTask.SquadronName
|
||||||
AIUnitCount = AIUnitCount + AIGroup:GetSize()
|
if DefenderTaskTarget and DefenderTaskTarget.Index == AttackerDetection.Index then
|
||||||
self:E( "Defender Group Name: " .. AIGroup:GetName() .. ", Size: " .. AIGroup:GetSize() )
|
local Squadron = self:GetSquadron( DefenderSquadronName )
|
||||||
|
local SquadronOverhead = Squadron.Overhead or self.DefenderDefault.Overhead
|
||||||
|
DefenderCount = DefenderCount + Defender:GetSize() / SquadronOverhead
|
||||||
|
self:E( "Defender Group Name: " .. Defender:GetName() .. ", Size: " .. Defender:GetSize() )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return AIUnitCount
|
self:F( { DefenderCount = DefenderCount } )
|
||||||
|
|
||||||
|
return DefenderCount
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -2766,7 +2777,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
|
|
||||||
if DefenderGCI then
|
if DefenderGCI then
|
||||||
|
|
||||||
DefenderCount = DefenderCount - DefenderGrouping
|
DefenderCount = DefenderCount - DefenderGrouping / DefenderOverhead
|
||||||
|
|
||||||
local Fsm = AI_A2A_GCI:New( DefenderGCI, Gci.EngageMinSpeed, Gci.EngageMaxSpeed )
|
local Fsm = AI_A2A_GCI:New( DefenderGCI, Gci.EngageMinSpeed, Gci.EngageMaxSpeed )
|
||||||
Fsm:SetDispatcher( self )
|
Fsm:SetDispatcher( self )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user