mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
2fbcd9d2b9
@ -1287,9 +1287,9 @@ do
|
||||
-- DEBUG
|
||||
set = self:_PreFilterHeight(height)
|
||||
end
|
||||
local friendlyset -- Core.Set#SET_GROUP
|
||||
if self.checkforfriendlies == true then
|
||||
friendlyset = SET_GROUP:New():FilterCoalitions(self.Coalition):FilterCategories({"plane","helicopter"}):FilterFunction(function(grp) if grp and grp:InAir() then return true else return false end end):FilterOnce()
|
||||
--self.friendlyset -- Core.Set#SET_GROUP
|
||||
if self.checkforfriendlies == true and self.friendlyset == nil then
|
||||
self.friendlyset = SET_GROUP:New():FilterCoalitions(self.Coalition):FilterCategories({"plane","helicopter"}):FilterFunction(function(grp) if grp and grp:InAir() then return true else return false end end):FilterStart()
|
||||
end
|
||||
for _,_coord in pairs (set) do
|
||||
local coord = _coord -- get current coord to check
|
||||
@ -1305,20 +1305,21 @@ do
|
||||
zonecheck = self:_CheckCoordinateInZones(coord)
|
||||
end
|
||||
if self.verbose and self.debug then
|
||||
local dectstring = coord:ToStringLLDMS()
|
||||
local samstring = samcoordinate:ToStringLLDMS()
|
||||
--local dectstring = coord:ToStringLLDMS()
|
||||
local samstring = samcoordinate:ToStringMGRS({MGRS_Accuracy=0})
|
||||
samstring = string.gsub(samstring,"%s","")
|
||||
local inrange = "false"
|
||||
if targetdistance <= rad then
|
||||
inrange = "true"
|
||||
end
|
||||
local text = string.format("Checking SAM at %s | Targetdist %d | Rad %d | Inrange %s", samstring, targetdistance, rad, inrange)
|
||||
local text = string.format("Checking SAM at %s | Tgtdist %.1fkm | Rad %.1fkm | Inrange %s", samstring, targetdistance/1000, rad/1000, inrange)
|
||||
local m = MESSAGE:New(text,10,"Check"):ToAllIf(self.debug)
|
||||
self:T(self.lid..text)
|
||||
end
|
||||
-- friendlies around?
|
||||
local nofriendlies = true
|
||||
if self.checkforfriendlies == true then
|
||||
local closestfriend, distance = friendlyset:GetClosestGroup(samcoordinate)
|
||||
local closestfriend, distance = self.friendlyset:GetClosestGroup(samcoordinate)
|
||||
if closestfriend and distance and distance < rad then
|
||||
nofriendlies = false
|
||||
end
|
||||
@ -1677,9 +1678,9 @@ do
|
||||
function MANTIS:_CheckLoop(samset,detset,dlink,limit)
|
||||
self:T(self.lid .. "CheckLoop " .. #detset .. " Coordinates")
|
||||
local switchedon = 0
|
||||
local statusreport = REPORT:New("\nMANTIS Status")
|
||||
local instatusred = 0
|
||||
local instatusgreen = 0
|
||||
local activeshorads = 0
|
||||
local SEADactive = 0
|
||||
for _,_data in pairs (samset) do
|
||||
local samcoordinate = _data[2]
|
||||
@ -1756,22 +1757,13 @@ do
|
||||
instatusred=instatusred+1
|
||||
end
|
||||
end
|
||||
local activeshorads = 0
|
||||
if self.Shorad then
|
||||
for _,_name in pairs(self.Shorad.ActiveGroups or {}) do
|
||||
activeshorads=activeshorads+1
|
||||
end
|
||||
end
|
||||
statusreport:Add("+-----------------------------+")
|
||||
statusreport:Add(string.format("+ SAM in RED State: %2d",instatusred))
|
||||
statusreport:Add(string.format("+ SAM in GREEN State: %2d",instatusgreen))
|
||||
if self.Shorad then
|
||||
statusreport:Add(string.format("+ SHORAD active: %2d",activeshorads))
|
||||
end
|
||||
statusreport:Add("+-----------------------------+")
|
||||
MESSAGE:New(statusreport:Text(),10,nil,true):ToAll():ToLog()
|
||||
end
|
||||
return self
|
||||
return instatusred, instatusgreen, activeshorads
|
||||
end
|
||||
|
||||
--- [Internal] Check detection function
|
||||
@ -1789,6 +1781,9 @@ do
|
||||
if rand > 65 then -- 1/3 of cases
|
||||
self:_RefreshSAMTable()
|
||||
end
|
||||
local instatusred = 0
|
||||
local instatusgreen = 0
|
||||
local activeshorads = 0
|
||||
-- switch SAMs on/off if (n)one of the detected groups is inside their reach
|
||||
if self.automode then
|
||||
local samset = self.SAM_Table_Long -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
||||
@ -1796,10 +1791,21 @@ do
|
||||
local samset = self.SAM_Table_Medium -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
||||
self:_CheckLoop(samset,detset,dlink,self.maxmidrange)
|
||||
local samset = self.SAM_Table_Short -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
||||
self:_CheckLoop(samset,detset,dlink,self.maxshortrange)
|
||||
instatusred, instatusgreen, activeshorads = self:_CheckLoop(samset,detset,dlink,self.maxshortrange)
|
||||
else
|
||||
local samset = self:_GetSAMTable() -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
||||
self:_CheckLoop(samset,detset,dlink,self.maxclassic)
|
||||
instatusred, instatusgreen, activeshorads = self:_CheckLoop(samset,detset,dlink,self.maxclassic)
|
||||
end
|
||||
if self.debug or self.verbose then
|
||||
local statusreport = REPORT:New("\nMANTIS Status "..self.name)
|
||||
statusreport:Add("+-----------------------------+")
|
||||
statusreport:Add(string.format("+ SAM in RED State: %2d",instatusred))
|
||||
statusreport:Add(string.format("+ SAM in GREEN State: %2d",instatusgreen))
|
||||
if self.Shorad then
|
||||
statusreport:Add(string.format("+ SHORAD active: %2d",activeshorads))
|
||||
end
|
||||
statusreport:Add("+-----------------------------+")
|
||||
MESSAGE:New(statusreport:Text(),10):ToAll():ToLog()
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user