mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-23 02:08:17 +00:00
Update Airboss.lua
This commit is contained in:
@@ -6060,66 +6060,32 @@ function AIRBOSS:_ScanCarrierZone()
|
|||||||
-- Create a new flight group
|
-- Create a new flight group
|
||||||
if knownflight then
|
if knownflight then
|
||||||
|
|
||||||
-- Debug output.
|
|
||||||
self:T2(self.lid..string.format("Known flight group %s of type %s in CCA.", groupname, actype))
|
|
||||||
|
|
||||||
-- Check if flight is AI and if we want to handle it at all.
|
-- Check if flight is AI and if we want to handle it at all.
|
||||||
if knownflight.ai and self.handleai then
|
if knownflight.ai and knownflight.flag==-100 and self.handleai then
|
||||||
|
|
||||||
-- Defines if AI group should be handled by the airboss.
|
local putintomarshal=false
|
||||||
local iscarriersquad=true
|
|
||||||
|
|
||||||
-- Check if AI group is part of the group set if a set was defined.
|
-- Get flight group.
|
||||||
if self.squadsetAI then
|
local flight=_DATABASE:GetFlightGroup(groupname)
|
||||||
local group=self.squadsetAI:FindGroup(groupname)
|
|
||||||
if group then
|
if flight and flight:IsInbound() and flight.destbase:GetName()==self.carrier:GetName() then
|
||||||
iscarriersquad=true
|
if flight.ishelo then
|
||||||
else
|
else
|
||||||
iscarriersquad=false
|
putintomarshal=true
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check if group was explicitly excluded.
|
|
||||||
if self.excludesetAI then
|
|
||||||
local group=self.excludesetAI:FindGroup(groupname)
|
|
||||||
if group then
|
|
||||||
iscarriersquad=false
|
|
||||||
end
|
end
|
||||||
|
flight.airboss=self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Get distance to carrier.
|
|
||||||
local dist=knownflight.group:GetCoordinate():Get2DDistance(self:GetCoordinate())
|
|
||||||
|
|
||||||
-- Close in distance. Is >0 if AC comes closer wrt to first detected distance d0.
|
-- Send AI flight to marshal stack.
|
||||||
local closein=knownflight.dist0-dist
|
if putintomarshal then
|
||||||
|
|
||||||
-- Debug info.
|
|
||||||
self:T3(self.lid..string.format("Known AI flight group %s closed in by %.1f NM", knownflight.groupname, UTILS.MetersToNM(closein)))
|
|
||||||
|
|
||||||
-- Is this group the tanker?
|
|
||||||
local istanker=self.tanker and self.tanker.tanker:GetName()==groupname
|
|
||||||
|
|
||||||
-- Is this group the AWACS?
|
|
||||||
local isawacs=self.awacs and self.awacs.tanker:GetName()==groupname
|
|
||||||
|
|
||||||
-- Send tanker to marshal stack?
|
|
||||||
local tanker2marshal = istanker and self.tanker:IsReturning() and self.tanker.airbase:GetName()==self.airbase:GetName() and knownflight.flag==-100 and self.tanker.recovery==true
|
|
||||||
|
|
||||||
-- Send AWACS to marhsal stack?
|
|
||||||
local awacs2marshal = isawacs and self.awacs:IsReturning() and self.awacs.airbase:GetName()==self.airbase:GetName() and knownflight.flag==-100 and self.awacs.recovery==true
|
|
||||||
|
|
||||||
-- Put flight into Marshal.
|
|
||||||
local putintomarshal=closein>UTILS.NMToMeters(5) and knownflight.flag==-100 and iscarriersquad and (not istanker) and (not isawacs)
|
|
||||||
|
|
||||||
-- Send AI flight to marshal stack if group closes in more than 5 and has initial flag value.
|
|
||||||
if putintomarshal or tanker2marshal or awacs2marshal then
|
|
||||||
|
|
||||||
-- Get the next free stack for current recovery case.
|
-- Get the next free stack for current recovery case.
|
||||||
local stack=self:_GetFreeStack(knownflight.ai)
|
local stack=self:_GetFreeStack(knownflight.ai)
|
||||||
|
|
||||||
-- Repawn.
|
-- Repawn.
|
||||||
local respawn=self.respawnAI --or tanker2marshal
|
local respawn=self.respawnAI
|
||||||
|
|
||||||
if stack then
|
if stack then
|
||||||
|
|
||||||
@@ -6138,8 +6104,9 @@ function AIRBOSS:_ScanCarrierZone()
|
|||||||
-- Break the loop to not have all flights at once! Spams the message screen.
|
-- Break the loop to not have all flights at once! Spams the message screen.
|
||||||
break
|
break
|
||||||
|
|
||||||
end -- Closed in or tanker/AWACS
|
end -- Closed in or tanker/AWACS
|
||||||
end -- AI
|
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user