Integrate option for Shorad in Mantis

Also, correct some documentation errors
This commit is contained in:
Applevangelist 2021-02-16 16:13:10 +01:00 committed by GitHub
parent 695f204493
commit e8bfab515c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,14 +24,14 @@
-------------------------------------------------------------------------
--- **MANTIS** class, extends @{#Core.Base#BASE}
-- @type MANTIS #MANTIS
-- @type MANTIS
-- @field #string Classname
-- @field #string name Name of this Mantis
-- @field #string SAM_Templates_Prefix Prefix to build the #GROUP_SET for SAM sites
-- @field @{#Core.Set#GROUP_SET} SAM_Group The SAM #GROUP_SET
-- @field #string EWR_Templates_Prefix Prefix to build the #GROUP_SET for EWR group
-- @field @{#Core.Set#GROUP_SET} EWR_Group The EWR #GROUP_SET
-- @field @{#Core.Set#GROUP_SET} Adv_EWR_Group The EWR #GROUP_SET used for advanced mode
-- @field #string SAM_Templates_Prefix Prefix to build the #SET_GROUP for SAM sites
-- @field @{#Core.Set#SET_GROUP} SAM_Group The SAM #SET_GROUP
-- @field #string EWR_Templates_Prefix Prefix to build the #SET_GROUP for EWR group
-- @field @{#Core.Set#SET_GROUP} EWR_Group The EWR #SET_GROUP
-- @field @{#Core.Set#SET_GROUP} Adv_EWR_Group The EWR #SET_GROUP used for advanced mode
-- @field #string HQ_Template_CC The ME name of the HQ object
-- @field @{#Wrapper.Group#GROUP} HQ_CC The #GROUP object of the HQ
-- @field #table SAM_Table Table of SAM sites
@ -51,6 +51,9 @@
-- @field #number adv_state Advanced mode state tracker
-- @field #boolean advAwacs Boolean switch to use Awacs as a separate detection stream
-- @field #number awacsrange Detection range of an optional Awacs unit
-- @field @{#Functional.Shorad#SHORAD} Shorad SHORAD Object, if available
-- @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
-- @extends @{#Core.Base#BASE}
@ -163,7 +166,10 @@ MANTIS = {
AWACS_Prefix = "",
advAwacs = false,
verbose = false,
awacsrange = 250000
awacsrange = 250000,
Shorad = nil,
ShoradLink = false,
ShoradTime = 600,
}
-----------------------------------------------------------------------
@ -230,6 +236,9 @@ do
self.Adv_EWR_Group = nil
self.AWACS_Prefix = awacs or nil
self.awacsrange = 250000 --TODO: 250km, User Function to change
self.Shorad = nil
self.ShoradLink = false
self.ShoradTime = 600
if type(awacs) == "string" then
self.advAwacs = true
else
@ -709,6 +718,27 @@ do
return self
end
--- Function to link up #MANTIS with a #SHORAD installation
-- @param #MANTIS self
-- @param Functional.Shorad#SHORAD Shorad The #SHORAD object
-- @param #number Shoradtime Number of seconds #SHORAD stays active post wake-up
function MANTIS:AddShorad(Shorad,Shoradtime)
local Shorad = Shorad or nil
local ShoradTime = Shoradtime or 600
local ShoradLink = true
if Shorad:IsInstanceOf("SHORAD") then
self.ShoradLink = ShoradLink
self.Shorad = Shorad --#SHORAD
self.ShoradTime = Shoradtime -- #number
end
end
--- Function to unlink #MANTIS from a #SHORAD installation
-- @param #MANTIS self
function MANTIS:RemoveShorad()
self.ShoradLink = false
end
-----------------------------------------------------------------------
-- MANTIS main functions
-----------------------------------------------------------------------
@ -743,8 +773,15 @@ do
if samgroup:IsAlive() then
-- switch off SAM
samgroup:OptionAlarmStateRed()
--samgroup:OptionROEWeaponFree()
--samgroup:SetAIOn()
-- link in to SHORAD if available
-- TODO Test integration
if self.ShoradLink then
local Shorad = self.Shorad
local radius = self.checkradius
local ontime = self.ShoradTime
Shorad:WakeUpShorad(name, radius, ontime)
end
-- debug output
local text = string.format("SAM %s switched to alarm state RED!", name)
local m=MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
if self.verbose then env.info(self.lid..text) end