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
|
-- DEBUG
|
||||||
set = self:_PreFilterHeight(height)
|
set = self:_PreFilterHeight(height)
|
||||||
end
|
end
|
||||||
local friendlyset -- Core.Set#SET_GROUP
|
--self.friendlyset -- Core.Set#SET_GROUP
|
||||||
if self.checkforfriendlies == true then
|
if self.checkforfriendlies == true and self.friendlyset == nil 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 = 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
|
end
|
||||||
for _,_coord in pairs (set) do
|
for _,_coord in pairs (set) do
|
||||||
local coord = _coord -- get current coord to check
|
local coord = _coord -- get current coord to check
|
||||||
@ -1305,20 +1305,21 @@ do
|
|||||||
zonecheck = self:_CheckCoordinateInZones(coord)
|
zonecheck = self:_CheckCoordinateInZones(coord)
|
||||||
end
|
end
|
||||||
if self.verbose and self.debug then
|
if self.verbose and self.debug then
|
||||||
local dectstring = coord:ToStringLLDMS()
|
--local dectstring = coord:ToStringLLDMS()
|
||||||
local samstring = samcoordinate:ToStringLLDMS()
|
local samstring = samcoordinate:ToStringMGRS({MGRS_Accuracy=0})
|
||||||
|
samstring = string.gsub(samstring,"%s","")
|
||||||
local inrange = "false"
|
local inrange = "false"
|
||||||
if targetdistance <= rad then
|
if targetdistance <= rad then
|
||||||
inrange = "true"
|
inrange = "true"
|
||||||
end
|
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)
|
local m = MESSAGE:New(text,10,"Check"):ToAllIf(self.debug)
|
||||||
self:T(self.lid..text)
|
self:T(self.lid..text)
|
||||||
end
|
end
|
||||||
-- friendlies around?
|
-- friendlies around?
|
||||||
local nofriendlies = true
|
local nofriendlies = true
|
||||||
if self.checkforfriendlies == true then
|
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
|
if closestfriend and distance and distance < rad then
|
||||||
nofriendlies = false
|
nofriendlies = false
|
||||||
end
|
end
|
||||||
@ -1618,7 +1619,7 @@ do
|
|||||||
--self:I({grpname,grprange, grpheight})
|
--self:I({grpname,grprange, grpheight})
|
||||||
elseif type == MANTIS.SamType.SHORT then
|
elseif type == MANTIS.SamType.SHORT then
|
||||||
table.insert( SAM_Tbl_sh, {grpname, grpcoord, grprange, grpheight, blind})
|
table.insert( SAM_Tbl_sh, {grpname, grpcoord, grprange, grpheight, blind})
|
||||||
-- self:I({grpname,grprange, grpheight})
|
--self:I({grpname,grprange, grpheight})
|
||||||
self.ShoradGroupSet:Add(grpname,group)
|
self.ShoradGroupSet:Add(grpname,group)
|
||||||
if self.autoshorad then
|
if self.autoshorad then
|
||||||
self.Shorad.Groupset = self.ShoradGroupSet
|
self.Shorad.Groupset = self.ShoradGroupSet
|
||||||
@ -1677,9 +1678,9 @@ do
|
|||||||
function MANTIS:_CheckLoop(samset,detset,dlink,limit)
|
function MANTIS:_CheckLoop(samset,detset,dlink,limit)
|
||||||
self:T(self.lid .. "CheckLoop " .. #detset .. " Coordinates")
|
self:T(self.lid .. "CheckLoop " .. #detset .. " Coordinates")
|
||||||
local switchedon = 0
|
local switchedon = 0
|
||||||
local statusreport = REPORT:New("\nMANTIS Status")
|
|
||||||
local instatusred = 0
|
local instatusred = 0
|
||||||
local instatusgreen = 0
|
local instatusgreen = 0
|
||||||
|
local activeshorads = 0
|
||||||
local SEADactive = 0
|
local SEADactive = 0
|
||||||
for _,_data in pairs (samset) do
|
for _,_data in pairs (samset) do
|
||||||
local samcoordinate = _data[2]
|
local samcoordinate = _data[2]
|
||||||
@ -1756,22 +1757,13 @@ do
|
|||||||
instatusred=instatusred+1
|
instatusred=instatusred+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local activeshorads = 0
|
|
||||||
if self.Shorad then
|
if self.Shorad then
|
||||||
for _,_name in pairs(self.Shorad.ActiveGroups or {}) do
|
for _,_name in pairs(self.Shorad.ActiveGroups or {}) do
|
||||||
activeshorads=activeshorads+1
|
activeshorads=activeshorads+1
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
return self
|
return instatusred, instatusgreen, activeshorads
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [Internal] Check detection function
|
--- [Internal] Check detection function
|
||||||
@ -1789,6 +1781,9 @@ do
|
|||||||
if rand > 65 then -- 1/3 of cases
|
if rand > 65 then -- 1/3 of cases
|
||||||
self:_RefreshSAMTable()
|
self:_RefreshSAMTable()
|
||||||
end
|
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
|
-- switch SAMs on/off if (n)one of the detected groups is inside their reach
|
||||||
if self.automode then
|
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
|
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
|
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)
|
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
|
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
|
else
|
||||||
local samset = self:_GetSAMTable() -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
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
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user