mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Update Mantis.lua
Adjustments for 2.7
This commit is contained in:
parent
7da1905ad3
commit
a89a3b38ce
@ -51,7 +51,7 @@
|
|||||||
-- @field #number adv_state Advanced mode state tracker
|
-- @field #number adv_state Advanced mode state tracker
|
||||||
-- @field #boolean advAwacs Boolean switch to use Awacs as a separate detection stream
|
-- @field #boolean advAwacs Boolean switch to use Awacs as a separate detection stream
|
||||||
-- @field #number awacsrange Detection range of an optional Awacs unit
|
-- @field #number awacsrange Detection range of an optional Awacs unit
|
||||||
-- @field #boolean UseAIOnOff Decide if we are using AI on/off (true) or AlarmState red/green (default)
|
-- @field #boolean UseEmOnOff Decide if we are using Emissions on/off (true) or AlarmState red/green (default)
|
||||||
-- @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
|
||||||
@ -191,7 +191,7 @@ MANTIS = {
|
|||||||
ShoradLink = false,
|
ShoradLink = false,
|
||||||
ShoradTime = 600,
|
ShoradTime = 600,
|
||||||
ShoradActDistance = 15000,
|
ShoradActDistance = 15000,
|
||||||
UseAIOnOff = false,
|
UseEmOnOff = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -208,7 +208,7 @@ do
|
|||||||
--@param #string coaltion Coalition side of your setup, e.g. "blue", "red" or "neutral"
|
--@param #string coaltion Coalition side of your setup, e.g. "blue", "red" or "neutral"
|
||||||
--@param #boolean dynamic Use constant (true) filtering or just filter once (false, default) (optional)
|
--@param #boolean dynamic Use constant (true) filtering or just filter once (false, default) (optional)
|
||||||
--@param #string awacs Group name of your Awacs (optional)
|
--@param #string awacs Group name of your Awacs (optional)
|
||||||
--@param #boolean AIOnOff Make MANTIS switch AI on and off instead of changing the alarm state between RED and GREEN (optional)
|
--@param #boolean EmOnOff Make MANTIS switch Emissions on and off instead of changing the alarm state between RED and GREEN (optional, deault true)
|
||||||
--@return #MANTIS self
|
--@return #MANTIS self
|
||||||
--@usage Start up your MANTIS with a basic setting
|
--@usage Start up your MANTIS with a basic setting
|
||||||
--
|
--
|
||||||
@ -230,7 +230,7 @@ do
|
|||||||
-- `mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")`
|
-- `mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")`
|
||||||
-- `mybluemantis:Start()`
|
-- `mybluemantis:Start()`
|
||||||
--
|
--
|
||||||
function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, AIOnOff)
|
function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, EmOnOff)
|
||||||
|
|
||||||
-- DONE: Create some user functions for these
|
-- DONE: Create some user functions for these
|
||||||
-- DONE: Make HQ useful
|
-- DONE: Make HQ useful
|
||||||
@ -264,7 +264,11 @@ do
|
|||||||
self.ShoradTime = 600
|
self.ShoradTime = 600
|
||||||
self.ShoradActDistance = 15000
|
self.ShoradActDistance = 15000
|
||||||
-- TODO: add emissions on/off when available .... in 2 weeks
|
-- TODO: add emissions on/off when available .... in 2 weeks
|
||||||
self.UseAIOnOff = AIOnOff or false
|
if EmOnOff then
|
||||||
|
if EmOnOff == false then
|
||||||
|
self.UseEmOnOff = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if type(awacs) == "string" then
|
if type(awacs) == "string" then
|
||||||
self.advAwacs = true
|
self.advAwacs = true
|
||||||
@ -304,7 +308,7 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
self.version="0.4.0"
|
self.version="0.4.1"
|
||||||
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@ -463,11 +467,11 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set using AI on/off instead of changing alarm state
|
--- Set using Emissions on/off instead of changing alarm state
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param #boolean switch Decide if we are changing alarm state or AI state
|
-- @param #boolean switch Decide if we are changing alarm state or Emission state
|
||||||
function MANTIS:SetUsingAIOnOff(switch)
|
function MANTIS:SetUsingEmOnOff(switch)
|
||||||
self.UseAIOnOff = switch or false
|
self.UseEmOnOff = switch or false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [Internal] Function to check if HQ is alive
|
--- [Internal] Function to check if HQ is alive
|
||||||
@ -714,8 +718,9 @@ do
|
|||||||
for _i,_group in pairs (SAM_Grps) do
|
for _i,_group in pairs (SAM_Grps) do
|
||||||
local group = _group
|
local group = _group
|
||||||
-- TODO: add emissions on/off
|
-- TODO: add emissions on/off
|
||||||
if self.UseAIOnOff then
|
if self.UseEmOnOff then
|
||||||
group:SetAIOff()
|
group:EnableEmission(false)
|
||||||
|
--group:SetAIOff()
|
||||||
else
|
else
|
||||||
group:OptionAlarmStateGreen() -- AI off
|
group:OptionAlarmStateGreen() -- AI off
|
||||||
end
|
end
|
||||||
@ -822,9 +827,10 @@ do
|
|||||||
if IsInZone then --check any target in zone
|
if IsInZone then --check any target in zone
|
||||||
if samgroup:IsAlive() then
|
if samgroup:IsAlive() then
|
||||||
-- switch on SAM
|
-- switch on SAM
|
||||||
if self.UseAIOnOff then
|
if self.UseEmOnOff then
|
||||||
-- TODO: add emissions on/off
|
-- TODO: add emissions on/off
|
||||||
samgroup:SetAIOn()
|
--samgroup:SetAIOn()
|
||||||
|
samgroup:EnableEmission(true)
|
||||||
end
|
end
|
||||||
samgroup:OptionAlarmStateRed()
|
samgroup:OptionAlarmStateRed()
|
||||||
-- link in to SHORAD if available
|
-- link in to SHORAD if available
|
||||||
@ -843,9 +849,10 @@ do
|
|||||||
else
|
else
|
||||||
if samgroup:IsAlive() then
|
if samgroup:IsAlive() then
|
||||||
-- switch off SAM
|
-- switch off SAM
|
||||||
if self.UseAIOnOff then
|
if self.UseEmOnOff then
|
||||||
-- TODO: add emissions on/off
|
-- TODO: add emissions on/off
|
||||||
samgroup:SetAIOff()
|
samgroup:EnableEmission(false)
|
||||||
|
--samgroup:SetAIOff()
|
||||||
else
|
else
|
||||||
samgroup:OptionAlarmStateGreen()
|
samgroup:OptionAlarmStateGreen()
|
||||||
end
|
end
|
||||||
@ -883,9 +890,10 @@ do
|
|||||||
local name = _data[1]
|
local name = _data[1]
|
||||||
local samgroup = GROUP:FindByName(name)
|
local samgroup = GROUP:FindByName(name)
|
||||||
if samgroup:IsAlive() then
|
if samgroup:IsAlive() then
|
||||||
if self.UseAIOnOff then
|
if self.UseEmOnOff then
|
||||||
-- TODO: add emissions on/off
|
-- TODO: add emissions on/off
|
||||||
samgroup:SetAIOn()
|
--samgroup:SetAIOn()
|
||||||
|
samgroup:EnableEmission(true)
|
||||||
end
|
end
|
||||||
samgroup:OptionAlarmStateRed()
|
samgroup:OptionAlarmStateRed()
|
||||||
end -- end alive
|
end -- end alive
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user