mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fixed issue in 2.1.1, targets not engaged when flying from parking spot.
This commit is contained in:
parent
ea8af14df5
commit
3ec783b0e4
@ -414,11 +414,9 @@ function AI_A2A_CAP:onafterEngage( AIGroup, From, Event, To, AttackSetUnit )
|
|||||||
self:F( { Angle = ToInterceptAngle, ToTargetSpeed = ToTargetSpeed } )
|
self:F( { Angle = ToInterceptAngle, ToTargetSpeed = ToTargetSpeed } )
|
||||||
self:T2( { self.MinSpeed, self.MaxSpeed, ToTargetSpeed } )
|
self:T2( { self.MinSpeed, self.MaxSpeed, ToTargetSpeed } )
|
||||||
|
|
||||||
|
EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint
|
||||||
EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint
|
EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint
|
||||||
|
|
||||||
AIGroup:OptionROEOpenFire()
|
|
||||||
AIGroup:OptionROTPassiveDefense()
|
|
||||||
|
|
||||||
local AttackTasks = {}
|
local AttackTasks = {}
|
||||||
|
|
||||||
for AttackUnitID, AttackUnit in pairs( self.AttackSetUnit:GetSet() ) do
|
for AttackUnitID, AttackUnit in pairs( self.AttackSetUnit:GetSet() ) do
|
||||||
@ -437,10 +435,13 @@ function AI_A2A_CAP:onafterEngage( AIGroup, From, Event, To, AttackSetUnit )
|
|||||||
self:E("No targets found -> Going back to Patrolling")
|
self:E("No targets found -> Going back to Patrolling")
|
||||||
self:__Abort( 0.5 )
|
self:__Abort( 0.5 )
|
||||||
else
|
else
|
||||||
|
AIGroup:OptionROEOpenFire()
|
||||||
|
AIGroup:OptionROTPassiveDefense()
|
||||||
|
|
||||||
AttackTasks[#AttackTasks+1] = AIGroup:TaskFunction( 1, #AttackTasks, "AI_A2A_CAP.AttackRoute" )
|
AttackTasks[#AttackTasks+1] = AIGroup:TaskFunction( 1, #AttackTasks, "AI_A2A_CAP.AttackRoute" )
|
||||||
AttackTasks[#AttackTasks+1] = AIGroup:TaskOrbitCircle( 4000, self.PatrolMinSpeed )
|
AttackTasks[#AttackTasks+1] = AIGroup:TaskOrbitCircle( 4000, self.PatrolMinSpeed )
|
||||||
|
|
||||||
EngageRoute[1].task = AIGroup:TaskCombo( AttackTasks )
|
EngageRoute[#EngageRoute].task = AIGroup:TaskCombo( AttackTasks )
|
||||||
|
|
||||||
--- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ...
|
--- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ...
|
||||||
AIGroup:SetState( AIGroup, "AI_A2A_CAP", self )
|
AIGroup:SetState( AIGroup, "AI_A2A_CAP", self )
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
--BASE:TraceClass("AI_A2A_DISPATCHER")
|
||||||
|
BASE:TraceClass("AI_A2A_GCICAP")
|
||||||
|
|
||||||
--- **AI** - The AI_A2A_DISPATCHER creates an automatic A2A defense system based on an EWR network targets and coordinating CAP and GCI.
|
--- **AI** - The AI_A2A_DISPATCHER creates an automatic A2A defense system based on an EWR network targets and coordinating CAP and GCI.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
@ -155,7 +158,7 @@
|
|||||||
--
|
--
|
||||||
-- @module AI_A2A_Dispatcher
|
-- @module AI_A2A_Dispatcher
|
||||||
|
|
||||||
--BASE:TraceClass("AI_A2A_DISPATCHER")
|
|
||||||
|
|
||||||
do -- AI_A2A_DISPATCHER
|
do -- AI_A2A_DISPATCHER
|
||||||
|
|
||||||
@ -2255,7 +2258,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
Fsm:SetDispatcher( self )
|
Fsm:SetDispatcher( self )
|
||||||
Fsm:SetHomeAirbase( DefenderSquadron.Airbase )
|
Fsm:SetHomeAirbase( DefenderSquadron.Airbase )
|
||||||
Fsm:Start()
|
Fsm:Start()
|
||||||
Fsm:__Engage( 1, Target.Set ) -- Engage on the TargetSetUnit
|
Fsm:__Engage( 5, Target.Set ) -- Engage on the TargetSetUnit
|
||||||
|
|
||||||
|
|
||||||
self:SetDefenderTask( DefenderGCI, "GCI", Fsm, Target )
|
self:SetDefenderTask( DefenderGCI, "GCI", Fsm, Target )
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
BASE:TraceClass( "AI_A2A_GCI" )
|
||||||
|
|
||||||
--- **AI** -- **Execute Ground Controlled Interception (GCI).**
|
--- **AI** -- **Execute Ground Controlled Interception (GCI).**
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
@ -313,8 +315,8 @@ end
|
|||||||
--- @param Wrapper.Group#GROUP AIControllable
|
--- @param Wrapper.Group#GROUP AIControllable
|
||||||
function AI_A2A_GCI.InterceptRoute( AIControllable )
|
function AI_A2A_GCI.InterceptRoute( AIControllable )
|
||||||
|
|
||||||
AIControllable:T( "NewEngageRoute" )
|
|
||||||
local EngageZone = AIControllable:GetState( AIControllable, "EngageZone" ) -- AI.AI_Cap#AI_A2A_GCI
|
local EngageZone = AIControllable:GetState( AIControllable, "EngageZone" ) -- AI.AI_Cap#AI_A2A_GCI
|
||||||
|
EngageZone:E( "NewEngageRoute" )
|
||||||
EngageZone:__Engage( 0.5 )
|
EngageZone:__Engage( 0.5 )
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -360,6 +362,9 @@ function AI_A2A_GCI:onafterEngage( AIGroup, From, Event, To, AttackSetUnit )
|
|||||||
if AIGroup:IsAlive() then
|
if AIGroup:IsAlive() then
|
||||||
|
|
||||||
local EngageRoute = {}
|
local EngageRoute = {}
|
||||||
|
|
||||||
|
local CurrentCoord = AIGroup:GetCoordinate()
|
||||||
|
|
||||||
|
|
||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
@ -372,7 +377,7 @@ function AI_A2A_GCI:onafterEngage( AIGroup, From, Event, To, AttackSetUnit )
|
|||||||
local ToInterceptAngle = CurrentCoord:GetAngleDegrees( CurrentCoord:GetDirectionVec3( ToTargetCoord ) )
|
local ToInterceptAngle = CurrentCoord:GetAngleDegrees( CurrentCoord:GetDirectionVec3( ToTargetCoord ) )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToPatrolRoutePoint = CurrentCoord:Translate( 5000, ToInterceptAngle ):RoutePointAir(
|
local ToPatrolRoutePoint = CurrentCoord:Translate( 10000, ToInterceptAngle ):RoutePointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType,
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
@ -381,19 +386,17 @@ function AI_A2A_GCI:onafterEngage( AIGroup, From, Event, To, AttackSetUnit )
|
|||||||
)
|
)
|
||||||
|
|
||||||
self:F( { Angle = ToInterceptAngle, ToTargetSpeed = ToTargetSpeed } )
|
self:F( { Angle = ToInterceptAngle, ToTargetSpeed = ToTargetSpeed } )
|
||||||
self:T2( { self.EngageMinSpeed, self.EngageMaxSpeed, ToTargetSpeed } )
|
self:F( { self.EngageMinSpeed, self.EngageMaxSpeed, ToTargetSpeed } )
|
||||||
|
|
||||||
|
EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint
|
||||||
EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint
|
EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint
|
||||||
|
|
||||||
AIGroup:OptionROEOpenFire()
|
|
||||||
AIGroup:OptionROTPassiveDefense()
|
|
||||||
|
|
||||||
local AttackTasks = {}
|
local AttackTasks = {}
|
||||||
|
|
||||||
for AttackUnitID, AttackUnit in pairs( self.AttackSetUnit:GetSet() ) do
|
for AttackUnitID, AttackUnit in pairs( self.AttackSetUnit:GetSet() ) do
|
||||||
local AttackUnit = AttackUnit -- Wrapper.Unit#UNIT
|
local AttackUnit = AttackUnit -- Wrapper.Unit#UNIT
|
||||||
self:T( { "Intercepting Unit:", AttackUnit:GetName(), AttackUnit:IsAlive(), AttackUnit:IsAir() } )
|
|
||||||
if AttackUnit:IsAlive() and AttackUnit:IsAir() then
|
if AttackUnit:IsAlive() and AttackUnit:IsAir() then
|
||||||
|
self:T( { "Intercepting Unit:", AttackUnit:GetName(), AttackUnit:IsAlive(), AttackUnit:IsAir() } )
|
||||||
AttackTasks[#AttackTasks+1] = AIGroup:TaskAttackUnit( AttackUnit )
|
AttackTasks[#AttackTasks+1] = AIGroup:TaskAttackUnit( AttackUnit )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -407,9 +410,12 @@ function AI_A2A_GCI:onafterEngage( AIGroup, From, Event, To, AttackSetUnit )
|
|||||||
self:Return()
|
self:Return()
|
||||||
self:__RTB( 0.5 )
|
self:__RTB( 0.5 )
|
||||||
else
|
else
|
||||||
|
AIGroup:OptionROEOpenFire()
|
||||||
|
AIGroup:OptionROTPassiveDefense()
|
||||||
|
|
||||||
AttackTasks[#AttackTasks+1] = AIGroup:TaskFunction( 1, #AttackTasks, "AI_A2A_GCI.InterceptRoute" )
|
AttackTasks[#AttackTasks+1] = AIGroup:TaskFunction( 1, #AttackTasks, "AI_A2A_GCI.InterceptRoute" )
|
||||||
AttackTasks[#AttackTasks+1] = AIGroup:TaskOrbitCircle( 4000, self.EngageMinSpeed )
|
AttackTasks[#AttackTasks+1] = AIGroup:TaskOrbitCircle( 4000, self.EngageMinSpeed )
|
||||||
EngageRoute[1].task = AIGroup:TaskCombo( AttackTasks )
|
EngageRoute[#EngageRoute].task = AIGroup:TaskCombo( AttackTasks )
|
||||||
|
|
||||||
--- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ...
|
--- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ...
|
||||||
AIGroup:SetState( AIGroup, "EngageZone", self )
|
AIGroup:SetState( AIGroup, "EngageZone", self )
|
||||||
|
|||||||
@ -361,6 +361,7 @@ function AI_A2A_PATROL:onafterRoute( AIGroup, From, Event, To )
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
PatrolRoute[#PatrolRoute+1] = ToPatrolRoutePoint
|
||||||
PatrolRoute[#PatrolRoute+1] = ToPatrolRoutePoint
|
PatrolRoute[#PatrolRoute+1] = ToPatrolRoutePoint
|
||||||
|
|
||||||
--- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable...
|
--- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable...
|
||||||
@ -369,7 +370,7 @@ function AI_A2A_PATROL:onafterRoute( AIGroup, From, Event, To )
|
|||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
Tasks[#Tasks+1] = AIGroup:TaskFunction( 1, 1, "AI_A2A_PATROL.PatrolRoute" )
|
Tasks[#Tasks+1] = AIGroup:TaskFunction( 1, 1, "AI_A2A_PATROL.PatrolRoute" )
|
||||||
|
|
||||||
PatrolRoute[1].task = AIGroup:TaskCombo( Tasks )
|
PatrolRoute[#PatrolRoute].task = AIGroup:TaskCombo( Tasks )
|
||||||
|
|
||||||
--- Do a trick, link the NewPatrolRoute function of the PATROLGROUP object to the AIControllable in a temporary variable ...
|
--- Do a trick, link the NewPatrolRoute function of the PATROLGROUP object to the AIControllable in a temporary variable ...
|
||||||
AIGroup:SetState( AIGroup, "AI_A2A_PATROL", self )
|
AIGroup:SetState( AIGroup, "AI_A2A_PATROL", self )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user