From eb0b43cea861f4a25eb146af8b33f568b2eb70c0 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 13 Jan 2021 08:32:45 +0100 Subject: [PATCH 1/5] MANTIS 0.3.6 -- clean up docs -- added a function to set a new SAM range whilst running --- Moose Development/Moose/Functional/Mantis.lua | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/Moose Development/Moose/Functional/Mantis.lua b/Moose Development/Moose/Functional/Mantis.lua index c97068865..a4ca58c19 100644 --- a/Moose Development/Moose/Functional/Mantis.lua +++ b/Moose Development/Moose/Functional/Mantis.lua @@ -1,4 +1,4 @@ ---- **Functional** -- Modular, Automatic and Network capable Targeting and Interception System for Air Defenses + --- **Functional** -- Modular, Automatic and Network capable Targeting and Interception System for Air Defenses -- -- === -- @@ -20,23 +20,23 @@ -- @module Functional.Mantis -- @image Functional.Mantis.jpg --- Date: Dec 2020 +-- Date: Jan 2021 ------------------------------------------------------------------------- ---- **MANTIS** class, extends @{Core.Base#BASE} --- @type MANTIS +--- **MANTIS** class, extends @{#Core.Base#BASE} +-- @type MANTIS #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 @{#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 @{#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 HQ_Template_CC The ME name of the HQ object --- @field @{Wrapper.Group#GROUP} HQ_CC The #GROUP object of the HQ +-- @field @{#Wrapper.Group#GROUP} HQ_CC The #GROUP object of the HQ -- @field #table SAM_Table Table of SAM sites -- @field #string lid Prefix for logging --- @field @{Functional.Detection#DETECTION_AREAS} Detection The #DETECTION_AREAS object for EWR +-- @field @{#Functional.Detection#DETECTION_AREAS} Detection The #DETECTION_AREAS object for EWR -- @field @{Functional.Detection#DETECTION_AREAS} AWACS_Detection The #DETECTION_AREAS object for AWACS -- @field #boolean debug Switch on extra messages -- @field #boolean verbose Switch on extra logging @@ -51,7 +51,7 @@ -- @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 --- @extends @{Core.Base#BASE} +-- @extends @{#Core.Base#BASE} --- *The worst thing that can happen to a good cause is, not to be skillfully attacked, but to be ineptly defended.* - Frédéric Bastiat @@ -97,6 +97,7 @@ -- # 2. Start up your MANTIS with a basic setting -- -- `myredmantis = MANTIS:New("myredmantis","Red SAM","Red EWR",nil,"red",false)` +-- `myredmantis:Start()` -- -- [optional] Use -- @@ -106,13 +107,12 @@ -- * `MANTIS:SetDetectInterval(interval)` -- * `MANTIS:SetAutoRelocate(hq, ewr)` -- --- to fine-tune your setup. --- --- `myredmantis:Start()` +-- before starting #MANTIS to fine-tune your setup. -- -- If you want to use a separate AWACS unit (default detection range: 250km) to support your EWR system, use e.g. the following setup: -- -- `mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")` +-- `mybluemantis:Start()` -- -- # 3. Default settings -- @@ -171,7 +171,7 @@ MANTIS = { ----------------------------------------------------------------------- do - --- Function instantiate new class + --- Function to instantiate a new object of class MANTIS --@param #MANTIS self --@param #string name Name of this MANTIS for reporting --@param #string samprefix Prefixes for the SAM groups from the ME, e.g. all groups starting with "Red Sam..." @@ -217,7 +217,7 @@ do end -- @field #string version - self.version="0.3.5" + self.version="0.3.6" env.info(string.format("***** Starting MANTIS Version %s *****", self.version)) -- Set the string id for output to DCS.log file. @@ -307,6 +307,19 @@ do self.engagerange = range end + --- Function to set a new SAM firing engage range, use this method to adjust range while running MANTIS, e.g. for different setups day and night + -- @param #MANTIS self + -- @param #number range Percent of the max fire range + function MANTIS:SetNewSAMRangeWhileRunning(range) + local range = range or 75 + if range < 0 or range > 100 then + range = 75 + end + self.engagerange = range + self:_RefreshSAMTable() + self.mysead.EngagementRange = range + end + --- Function to set switch-on/off the debug state -- @param #MANTIS self -- @param #boolean onoff Set true to switch on From 29727ec9a6550d79b2654e8423ef7c16c968b4bc Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 13 Jan 2021 08:44:10 +0100 Subject: [PATCH 2/5] Update AI_A2A_Dispatcher.lua Closed gap in Docu --- Moose Development/Moose/AI/AI_A2A_Dispatcher.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua index eae6ded44..941ac29e5 100644 --- a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua +++ b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua @@ -658,7 +658,9 @@ do -- AI_A2A_DISPATCHER -- of the race track will randomly selected between 90 (West to East) and 180 (North to South) degrees. -- After a random duration between 10 and 20 minutes, the flight will get a new random orbit location. -- - -- Note that all parameters except the squadron name are optional. If not specified, default values are taken. Speed and altitude are taken from the + -- Note that all parameters except the squadron name are optional. If not specified, default values are taken. Speed and altitude are taken from the CAP command used earlier on, e.g. + -- + -- A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) -- -- Also note that the center of the race track pattern is chosen randomly within the patrol zone and can be close the the boarder of the zone. Hence, it cannot be guaranteed that the -- whole pattern lies within the patrol zone. From 9440d2b2c377e0881039fa0e48fdcb4584322e29 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 13 Jan 2021 08:47:20 +0100 Subject: [PATCH 3/5] Update Controllable.lua missing # in docu --- Moose Development/Moose/Wrapper/Controllable.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 38b7f147b..d46e62dd1 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -129,7 +129,7 @@ -- * @{#CONTROLLABLE.Route}(): Make the Controllable to follow a given route. -- * @{#CONTROLLABLE.RouteGroundTo}(): Make the GROUND Controllable to drive towards a specific coordinate. -- * @{#CONTROLLABLE.RouteAirTo}(): Make the AIR Controllable to fly towards a specific coordinate. --- * @{CONTROLLABLE.RelocateGroundRandomInRadius}(): Relocate the GROUND controllable to a random point in a given radius. +-- * @{#CONTROLLABLE.RelocateGroundRandomInRadius}(): Relocate the GROUND controllable to a random point in a given radius. -- -- # 5) Option methods -- From 73b1394ca7555c82e402acacde48a0c0ab0fd54d Mon Sep 17 00:00:00 2001 From: OttoWerkr <31276014+OttoWerkr@users.noreply.github.com> Date: Fri, 15 Jan 2021 14:27:43 -0500 Subject: [PATCH 4/5] Update Scenery.lua Added FindByName() to SCENERY Class. --- Moose Development/Moose/Wrapper/Scenery.lua | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Moose Development/Moose/Wrapper/Scenery.lua b/Moose Development/Moose/Wrapper/Scenery.lua index 9eccde422..445154037 100644 --- a/Moose Development/Moose/Wrapper/Scenery.lua +++ b/Moose Development/Moose/Wrapper/Scenery.lua @@ -57,3 +57,40 @@ end function SCENERY:GetThreatLevel() return 0, "Scenery" end + +--- Find a SCENERY object by it's name/id. +--@param #SCENERY self +--@param #string name The name/id of the scenery object as taken from the ME. Ex. '595785449' +--@return #SCENERY Scenery Object or nil if not found. +function SCENERY:FindByName(name) + local findAirbase = function () + local airbases = AIRBASE.GetAllAirbases() + for index,airbase in pairs(airbases) do + local surftype = airbase:GetCoordinate():GetSurfaceType() + if surftype ~= land.SurfaceType.SHALLOW_WATER and surftype ~= land.SurfaceType.WATER then + return airbase:GetCoordinate() + end + end + return nil + end + + local sceneryScan = function (scancoord) + if scancoord ~= nil then + local _,_,sceneryfound,_,_,scenerylist = scancoord:ScanObjects(200, false, false, true) + if sceneryfound == true then + scenerylist[1].id_ = name + SCENERY.SceneryObject = SCENERY:Register(scenerylist[1].id_, scenerylist[1]) + return SCENERY.SceneryObject + end + end + return nil + end + + if SCENERY.SceneryObject then + SCENERY.SceneryObject.SceneryObject.id_ = name + SCENERY.SceneryObject.SceneryName = name + return SCENERY:Register(SCENERY.SceneryObject.SceneryObject.id_, SCENERY.SceneryObject.SceneryObject) + else + return sceneryScan(findAirbase()) + end +end From d10adb5de8ab679da0c5342e35b252aeec0d0647 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 16 Jan 2021 14:50:36 +0100 Subject: [PATCH 5/5] Update AI_A2G_Dispatcher.lua Corrected Docu line 434 --- Moose Development/Moose/AI/AI_A2G_Dispatcher.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/AI/AI_A2G_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2G_Dispatcher.lua index 91d990afc..3db79d137 100644 --- a/Moose Development/Moose/AI/AI_A2G_Dispatcher.lua +++ b/Moose Development/Moose/AI/AI_A2G_Dispatcher.lua @@ -431,7 +431,7 @@ do -- AI_A2G_DISPATCHER -- -- ### 2.2. The **Defense Reactivity**. -- - -- There are 5 levels that can be configured to tweak the defense reactivity. As explained above, the threat to a defense coordinate is + -- There are three levels that can be configured to tweak the defense reactivity. As explained above, the threat to a defense coordinate is -- also determined by the distance of the enemy ground target to the defense coordinate. -- If you want to have a **low** defense reactivity, that is, the probability that an A2G defense will engage to the enemy ground target, then -- use the @{#AI_A2G_DISPATCHER.SetDefenseReactivityLow}() method. For medium and high reactivity, use the methods