Merge pull request #1485 from Applevangelist/patch-77

Update Intelligence.lua
This commit is contained in:
Frank 2021-04-04 22:03:40 +02:00 committed by GitHub
commit b81e3e9e6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
--- **Ops** - Office of Military Intelligence. --- **Ops** - Office of Military Intelligence.
-- --
-- ## Main Features: -- **Main Features:**
-- --
-- * Detect and track contacts consistently -- * Detect and track contacts consistently
-- * Detect and track clusters of contacts consistently -- * Detect and track clusters of contacts consistently
@ -80,6 +80,7 @@
-- `local m = MESSAGE:New(text,15,"KGB"):ToAll()` -- `local m = MESSAGE:New(text,15,"KGB"):ToAll()`
-- `end` -- `end`
-- --
--
-- @field #INTEL -- @field #INTEL
INTEL = { INTEL = {
ClassName = "INTEL", ClassName = "INTEL",
@ -93,7 +94,7 @@ INTEL = {
ContactsUnknown = {}, ContactsUnknown = {},
Clusters = {}, Clusters = {},
clustercounter = 1, clustercounter = 1,
clusterradius = 10, clusterradius = 15,
} }
--- Detected item info. --- Detected item info.
@ -130,7 +131,7 @@ INTEL = {
--- INTEL class version. --- INTEL class version.
-- @field #string version -- @field #string version
INTEL.version="0.2.0" INTEL.version="0.2.1"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ToDo list -- ToDo list
@ -350,7 +351,7 @@ function INTEL:RemoveRejectZone(RejectZone)
return self return self
end end
--- Set forget contacts time interval. For unknown contacts only. --- Set forget contacts time interval.
-- Previously known contacts that are not detected any more, are "lost" after this time. -- Previously known contacts that are not detected any more, are "lost" after this time.
-- This avoids fast oscillations between a contact being detected and undetected. -- This avoids fast oscillations between a contact being detected and undetected.
-- @param #INTEL self -- @param #INTEL self
@ -465,7 +466,7 @@ end
-- @param #number radius The radius of the clusters -- @param #number radius The radius of the clusters
-- @return #INTEL self -- @return #INTEL self
function INTEL:SetClusterRadius(radius) function INTEL:SetClusterRadius(radius)
local radius = radius or 10 local radius = radius or 15
self.clusterradius = radius self.clusterradius = radius
return self return self
end end
@ -1155,7 +1156,7 @@ function INTEL:IsContactConnectedToCluster(contact, cluster)
--local dist=Contact.position:Get2DDistance(contact.position) --local dist=Contact.position:Get2DDistance(contact.position)
local dist=Contact.position:DistanceFromPointVec2(contact.position) local dist=Contact.position:DistanceFromPointVec2(contact.position)
local radius = self.clusterradius or 10 local radius = self.clusterradius or 15
if dist<radius*1000 then if dist<radius*1000 then
return true return true
end end
@ -1285,7 +1286,13 @@ function INTEL:UpdateClusterMarker(cluster)
local text=string.format("Cluster #%d. Size %d, Units %d, TLsum=%d", cluster.index, cluster.size, unitcount, cluster.threatlevelSum) local text=string.format("Cluster #%d. Size %d, Units %d, TLsum=%d", cluster.index, cluster.size, unitcount, cluster.threatlevelSum)
if not cluster.marker then if not cluster.marker then
cluster.marker=MARKER:New(cluster.coordinate, text):ToAll() if self.coalition == coalition.side.RED then
cluster.marker=MARKER:New(cluster.coordinate, text):ToRed()
elseif self.coalition == coalition.side.BLUE then
cluster.marker=MARKER:New(cluster.coordinate, text):ToBlue()
else
cluster.marker=MARKER:New(cluster.coordinate, text):ToNeutral()
end
else else
local refresh=false local refresh=false