mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
AWACS - limit merge calls
This commit is contained in:
parent
3f918bd309
commit
bd3364a3cf
@ -588,6 +588,7 @@ AWACS.CapVoices = {
|
|||||||
-- @field #string EngagementTag
|
-- @field #string EngagementTag
|
||||||
-- @field #boolean TACCallDone
|
-- @field #boolean TACCallDone
|
||||||
-- @field #boolean MeldCallDone
|
-- @field #boolean MeldCallDone
|
||||||
|
-- @field #boolean MergeCallDone
|
||||||
|
|
||||||
---
|
---
|
||||||
-- @type AWACS.TaskDescription
|
-- @type AWACS.TaskDescription
|
||||||
@ -1870,6 +1871,8 @@ function AWACS:_CheckMerges()
|
|||||||
local pilot = _pilot -- #AWACS.ManagedGroup
|
local pilot = _pilot -- #AWACS.ManagedGroup
|
||||||
if pilot.Group and pilot.Group:IsAlive() then
|
if pilot.Group and pilot.Group:IsAlive() then
|
||||||
local ppos = pilot.Group:GetCoordinate()
|
local ppos = pilot.Group:GetCoordinate()
|
||||||
|
local pcallsign = pilot.CallSign
|
||||||
|
self:I(self.lid.."Checking for "..pcallsign)
|
||||||
if ppos then
|
if ppos then
|
||||||
self.Contacts:ForEach(
|
self.Contacts:ForEach(
|
||||||
function (Contact)
|
function (Contact)
|
||||||
@ -1877,9 +1880,13 @@ function AWACS:_CheckMerges()
|
|||||||
local cpos = contact.Cluster.coordinate or contact.Contact.position or contact.Contact.group:GetCoordinate()
|
local cpos = contact.Cluster.coordinate or contact.Contact.position or contact.Contact.group:GetCoordinate()
|
||||||
local dist = ppos:Get2DDistance(cpos)
|
local dist = ppos:Get2DDistance(cpos)
|
||||||
local distnm = UTILS.Round(UTILS.MetersToNM(dist),0)
|
local distnm = UTILS.Round(UTILS.MetersToNM(dist),0)
|
||||||
if (pilot.IsPlayer or self.debug) and distnm <= 5 then
|
if (pilot.IsPlayer or self.debug) and distnm <= 5 and not contact.MergeCallDone then
|
||||||
self:I(self.lid.."Merged")
|
local label = contact.EngagementTag or ""
|
||||||
self:_MergedCall(_id)
|
if not contact.MergeCallDone or not string.find(label,pcallsign) then
|
||||||
|
self:I(self.lid.."Merged")
|
||||||
|
self:_MergedCall(_id)
|
||||||
|
contact.MergeCallDone = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user