mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Update Mantis.lua
Added a smarter switch-on distance for SHORAD, added user function to set AWACS detection range, change default SAM firing range to 95%
This commit is contained in:
parent
0848718313
commit
c72c3fd091
@ -20,7 +20,7 @@
|
|||||||
-- @module Functional.Mantis
|
-- @module Functional.Mantis
|
||||||
-- @image Functional.Mantis.jpg
|
-- @image Functional.Mantis.jpg
|
||||||
|
|
||||||
-- Date: Jan 2021
|
-- Date: Feb 2021
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **MANTIS** class, extends #Core.Base#BASE
|
--- **MANTIS** class, extends #Core.Base#BASE
|
||||||
@ -54,6 +54,7 @@
|
|||||||
-- @field Functional.Shorad#SHORAD Shorad SHORAD Object, if available
|
-- @field Functional.Shorad#SHORAD Shorad SHORAD Object, if available
|
||||||
-- @field #boolean ShoradLink If true, #MANTIS has #SHORAD enabled
|
-- @field #boolean ShoradLink If true, #MANTIS has #SHORAD enabled
|
||||||
-- @field #number ShoradTime Timer in seconds, how long #SHORAD will be active after a detection inside of the defense range
|
-- @field #number ShoradTime Timer in seconds, how long #SHORAD will be active after a detection inside of the defense range
|
||||||
|
-- @field #number ShoradActDistance Distance of an attacker in meters from a Mantis SAM site, on which Shorad will be switched on. Useful to not give away Shorad sites too early. Default 15km. Should be smaller than checkradius.
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
@ -127,7 +128,7 @@
|
|||||||
-- * grouping = 5000 (meters) - Detection (EWR) will group enemy flights to areas of 5km for tracking - `MANTIS:SetEWRGrouping(radius)`
|
-- * grouping = 5000 (meters) - Detection (EWR) will group enemy flights to areas of 5km for tracking - `MANTIS:SetEWRGrouping(radius)`
|
||||||
-- * acceptrange = 80000 (meters) - Detection (EWR) will on consider flights inside a 80km radius - `MANTIS:SetEWRRange(radius)`
|
-- * acceptrange = 80000 (meters) - Detection (EWR) will on consider flights inside a 80km radius - `MANTIS:SetEWRRange(radius)`
|
||||||
-- * detectinterval = 30 (seconds) - MANTIS will decide every 30 seconds which SAM to activate - `MANTIS:SetDetectInterval(interval)`
|
-- * detectinterval = 30 (seconds) - MANTIS will decide every 30 seconds which SAM to activate - `MANTIS:SetDetectInterval(interval)`
|
||||||
-- * engagerange = 75 (percent) - SAMs will only fire if flights are inside of a 75% radius of their max firerange - `MANTIS:SetSAMRange(range)`
|
-- * engagerange = 85 (percent) - SAMs will only fire if flights are inside of a 85% radius of their max firerange - `MANTIS:SetSAMRange(range)`
|
||||||
-- * dynamic = false - Group filtering is set to once, i.e. newly added groups will not be part of the setup by default - `MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic)`
|
-- * dynamic = false - Group filtering is set to once, i.e. newly added groups will not be part of the setup by default - `MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic)`
|
||||||
-- * autorelocate = false - HQ and (mobile) EWR system will not relocate in random intervals between 30mins and 1 hour - `MANTIS:SetAutoRelocate(hq, ewr)`
|
-- * autorelocate = false - HQ and (mobile) EWR system will not relocate in random intervals between 30mins and 1 hour - `MANTIS:SetAutoRelocate(hq, ewr)`
|
||||||
-- * debug = false - Debugging reports on screen are set to off - `MANTIS:Debug(onoff)`
|
-- * debug = false - Debugging reports on screen are set to off - `MANTIS:Debug(onoff)`
|
||||||
@ -188,6 +189,7 @@ MANTIS = {
|
|||||||
Shorad = nil,
|
Shorad = nil,
|
||||||
ShoradLink = false,
|
ShoradLink = false,
|
||||||
ShoradTime = 600,
|
ShoradTime = 600,
|
||||||
|
ShoradActDistance = 15000,
|
||||||
}
|
}
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -253,19 +255,20 @@ do
|
|||||||
self.verbose = false
|
self.verbose = false
|
||||||
self.Adv_EWR_Group = nil
|
self.Adv_EWR_Group = nil
|
||||||
self.AWACS_Prefix = awacs or nil
|
self.AWACS_Prefix = awacs or nil
|
||||||
self.awacsrange = 250000 --TODO: 250km, User Function to change
|
self.awacsrange = 250000 --DONE: 250km, User Function to change
|
||||||
self.Shorad = nil
|
self.Shorad = nil
|
||||||
self.ShoradLink = false
|
self.ShoradLink = false
|
||||||
self.ShoradTime = 600
|
self.ShoradTime = 600
|
||||||
|
self.ShoradActDistance = 15000
|
||||||
|
|
||||||
if type(awacs) == "string" then
|
if type(awacs) == "string" then
|
||||||
self.advAwacs = true
|
self.advAwacs = true
|
||||||
else
|
else
|
||||||
self.advAwacs = false
|
self.advAwacs = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @field #string version
|
-- Inherit everything from BASE class.
|
||||||
self.version="0.3.6"
|
local self = BASE:Inherit(self, BASE:New()) -- #MANTIS
|
||||||
env.info(string.format("***** Starting MANTIS Version %s *****", self.version))
|
|
||||||
|
|
||||||
-- Set the string id for output to DCS.log file.
|
-- Set the string id for output to DCS.log file.
|
||||||
self.lid=string.format("MANTIS %s | ", self.name)
|
self.lid=string.format("MANTIS %s | ", self.name)
|
||||||
@ -294,8 +297,10 @@ do
|
|||||||
if self.HQ_Template_CC then
|
if self.HQ_Template_CC then
|
||||||
self.HQ_CC = GROUP:FindByName(self.HQ_Template_CC)
|
self.HQ_CC = GROUP:FindByName(self.HQ_Template_CC)
|
||||||
end
|
end
|
||||||
-- Inherit everything from BASE class.
|
|
||||||
local self = BASE:Inherit(self, BASE:New()) -- #MANTIS
|
-- @field #string version
|
||||||
|
self.version="0.3.7"
|
||||||
|
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -398,6 +403,14 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Function to set AWACS detection range. Defaults to 250.000m (250km) - use **before** starting your Mantis!
|
||||||
|
-- @param #MANTIS self
|
||||||
|
-- @param #number range Detection range of the AWACS group
|
||||||
|
function MANTIS:SetAwacsRange(range)
|
||||||
|
local range = range or 250000
|
||||||
|
self.awacsrange = range
|
||||||
|
end
|
||||||
|
|
||||||
--- Function to set the HQ object for further use
|
--- Function to set the HQ object for further use
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param Wrapper.GROUP#GROUP group The #GROUP object to be set as HQ
|
-- @param Wrapper.GROUP#GROUP group The #GROUP object to be set as HQ
|
||||||
@ -587,6 +600,7 @@ do
|
|||||||
-- @param #table dectset Table of coordinates of detected items
|
-- @param #table dectset Table of coordinates of detected items
|
||||||
-- @param samcoordinate Core.Point#COORDINATE Coordinate object.
|
-- @param samcoordinate Core.Point#COORDINATE Coordinate object.
|
||||||
-- @return #boolean True if in any zone, else false
|
-- @return #boolean True if in any zone, else false
|
||||||
|
-- @return #number Distance Target distance in meters or zero when no object is in zone
|
||||||
function MANTIS:CheckObjectInZone(dectset, samcoordinate)
|
function MANTIS:CheckObjectInZone(dectset, samcoordinate)
|
||||||
self:F(self.lid.."CheckObjectInZone Called")
|
self:F(self.lid.."CheckObjectInZone Called")
|
||||||
-- check if non of the coordinate is in the given defense zone
|
-- check if non of the coordinate is in the given defense zone
|
||||||
@ -603,10 +617,10 @@ do
|
|||||||
if self.verbose then env.info(self.lid..text) end
|
if self.verbose then env.info(self.lid..text) end
|
||||||
-- end output to cross-check
|
-- end output to cross-check
|
||||||
if targetdistance <= radius then
|
if targetdistance <= radius then
|
||||||
return true
|
return true, targetdistance
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (Internal) Function to start the detection via EWR groups
|
--- (Internal) Function to start the detection via EWR groups
|
||||||
@ -676,7 +690,7 @@ do
|
|||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @return #MANTIS self
|
-- @return #MANTIS self
|
||||||
function MANTIS:SetSAMStartState()
|
function MANTIS:SetSAMStartState()
|
||||||
-- TODO: if using dynamic filtering, update SAM_Table and the (active) SEAD groups, pull req #1405/#1406
|
-- DONE: if using dynamic filtering, update SAM_Table and the (active) SEAD groups, pull req #1405/#1406
|
||||||
self:F(self.lid.."Setting SAM Start States")
|
self:F(self.lid.."Setting SAM Start States")
|
||||||
-- get SAM Group
|
-- get SAM Group
|
||||||
local SAM_SET = self.SAM_Group
|
local SAM_SET = self.SAM_Group
|
||||||
@ -787,13 +801,14 @@ do
|
|||||||
local samcoordinate = _data[2]
|
local samcoordinate = _data[2]
|
||||||
local name = _data[1]
|
local name = _data[1]
|
||||||
local samgroup = GROUP:FindByName(name)
|
local samgroup = GROUP:FindByName(name)
|
||||||
if self:CheckObjectInZone(detset, samcoordinate) then --check any target in zone
|
local IsInZone, Distance = self:CheckObjectInZone(detset, samcoordinate)
|
||||||
|
if IsInZone then --check any target in zone
|
||||||
if samgroup:IsAlive() then
|
if samgroup:IsAlive() then
|
||||||
-- switch off SAM
|
-- switch off SAM
|
||||||
samgroup:OptionAlarmStateRed()
|
samgroup:OptionAlarmStateRed()
|
||||||
-- link in to SHORAD if available
|
-- link in to SHORAD if available
|
||||||
-- TODO Test integration fully
|
-- DONE: Test integration fully
|
||||||
if self.ShoradLink then
|
if self.ShoradLink and Distance < self.ShoradActDistance then -- don't give SHORAD position away too early
|
||||||
local Shorad = self.Shorad
|
local Shorad = self.Shorad
|
||||||
local radius = self.checkradius
|
local radius = self.checkradius
|
||||||
local ontime = self.ShoradTime
|
local ontime = self.ShoradTime
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user