From 618a8744a22419bd6f71de8216b108b8b24ba50b Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 16 Mar 2025 13:06:53 +0100 Subject: [PATCH 1/4] #MANTIS - improve point defense behaviour if not SAM to defend is around --- Moose Development/Moose/Functional/Mantis.lua | 4 ++-- Moose Development/Moose/Functional/Shorad.lua | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/Functional/Mantis.lua b/Moose Development/Moose/Functional/Mantis.lua index b5e809816..6f2142436 100644 --- a/Moose Development/Moose/Functional/Mantis.lua +++ b/Moose Development/Moose/Functional/Mantis.lua @@ -600,7 +600,7 @@ do self.maxlongrange = 1 self.maxmidrange = 2 self.maxshortrange = 2 - self.maxpointdefrange =6 + self.maxpointdefrange = 6 self.maxclassic = 6 self.autoshorad = true self.ShoradGroupSet = SET_GROUP:New() -- Core.Set#SET_GROUP @@ -2188,7 +2188,7 @@ do local Shorad = self.Shorad local radius = self.checkradius local ontime = self.ShoradTime - Shorad:WakeUpShorad(Name, radius, ontime) + Shorad:WakeUpShorad(Name, radius, ontime, nil, true) self:__ShoradActivated(1,Name, radius, ontime) end return self diff --git a/Moose Development/Moose/Functional/Shorad.lua b/Moose Development/Moose/Functional/Shorad.lua index 68ffe9c56..01b90262e 100644 --- a/Moose Development/Moose/Functional/Shorad.lua +++ b/Moose Development/Moose/Functional/Shorad.lua @@ -472,6 +472,7 @@ do -- @param #number Radius Radius of the #ZONE -- @param #number ActiveTimer Number of seconds to stay active -- @param #number TargetCat (optional) Category, i.e. Object.Category.UNIT or Object.Category.STATIC + -- @param #boolean ShotAt If true, function is called after a shot -- @return #SHORAD self -- @usage Use this function to integrate with other systems, example -- @@ -481,7 +482,7 @@ do -- mymantis = MANTIS:New("BlueMantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs") -- mymantis:AddShorad(myshorad,720) -- mymantis:Start() - function SHORAD:onafterWakeUpShorad(From, Event, To, TargetGroup, Radius, ActiveTimer, TargetCat) + function SHORAD:onafterWakeUpShorad(From, Event, To, TargetGroup, Radius, ActiveTimer, TargetCat, ShotAt) self:T(self.lid .. " WakeUpShorad") self:T({TargetGroup, Radius, ActiveTimer, TargetCat}) local targetcat = TargetCat or Object.Category.UNIT @@ -526,7 +527,7 @@ do local groupname = _group:GetName() - if groupname == TargetGroup then + if groupname == TargetGroup and ShotAt==true then -- Shot at a SHORAD group if self.UseEmOnOff then _group:EnableEmission(false) @@ -628,7 +629,7 @@ do _targetgroupname = tgtgrp:GetName() -- group name _targetskill = tgtgrp:GetUnit(1):GetSkill() self:T("*** Found Target = ".. _targetgroupname) - self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT) + self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT,true) end end end @@ -757,7 +758,7 @@ do -- if being shot at, find closest SHORADs to activate if shotatsams or shotatus then self:T({shotatsams=shotatsams,shotatus=shotatus}) - self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer, targetcat) + self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer, targetcat, true) end end end From 5ca3e3b2b8fc959650459e953af9d62f22ddb96a Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 16 Mar 2025 13:58:58 +0100 Subject: [PATCH 2/4] #SHORAD tweak --- Moose Development/Moose/Core/Event.lua | 2 +- Moose Development/Moose/Functional/Shorad.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index fe620c26a..f22185616 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -1375,7 +1375,7 @@ function EVENT:onEvent( Event ) Event.IniDCSUnitName = Event.IniDCSUnit.getName and Event.IniDCSUnit:getName() or "Scenery no name "..math.random(1,20000) Event.IniUnitName = Event.IniDCSUnitName Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator ) - Event.IniCategory = Event.IniDCSUnit:getDesc().category + Event.IniCategory = Event.IniDCSUnit.getDesc and Event.IniDCSUnit:getDesc().category Event.IniTypeName = Event.initiator:isExist() and Event.IniDCSUnit:getTypeName() or "SCENERY" elseif Event.IniObjectCategory == Object.Category.BASE then diff --git a/Moose Development/Moose/Functional/Shorad.lua b/Moose Development/Moose/Functional/Shorad.lua index 01b90262e..b209f3acd 100644 --- a/Moose Development/Moose/Functional/Shorad.lua +++ b/Moose Development/Moose/Functional/Shorad.lua @@ -543,7 +543,7 @@ do self:__ShootAndScoot(1,_group) end - elseif _group:IsAnyInZone(targetzone) then + elseif _group:IsAnyInZone(targetzone) or groupname == TargetGroup then -- shot at a group we protect local text = string.format("Waking up SHORAD %s", _group:GetName()) self:T(text) From be8405b72b83edcaf60eeb99dc97ef5ccf22495f Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 16 Mar 2025 16:57:11 +0100 Subject: [PATCH 3/4] #MANTIS - fix for data table --- Moose Development/Moose/Functional/Mantis.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Functional/Mantis.lua b/Moose Development/Moose/Functional/Mantis.lua index 6f2142436..db49d8bc9 100644 --- a/Moose Development/Moose/Functional/Mantis.lua +++ b/Moose Development/Moose/Functional/Mantis.lua @@ -22,7 +22,7 @@ -- @module Functional.Mantis -- @image Functional.Mantis.jpg -- --- Last Update: Feb 2025 +-- Last Update: Mar 2025 ------------------------------------------------------------------------- --- **MANTIS** class, extends Core.Base#BASE @@ -399,7 +399,6 @@ MANTIS.SamData = { ["SA-20A"] = { Range=150, Blindspot=5, Height=27, Type="Long" , Radar="S-300PMU1"}, ["SA-20B"] = { Range=200, Blindspot=4, Height=27, Type="Long" , Radar="S-300PMU2"}, ["HQ-2"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" }, - ["SHORAD"] = { Range=3, Blindspot=0, Height=3, Type="Point", Radar="Igla", Point="true" }, ["TAMIR IDFA"] = { Range=20, Blindspot=0.6, Height=12.3, Type="Short", Radar="IRON_DOME_LN" }, ["STUNNER IDFA"] = { Range=250, Blindspot=1, Height=45, Type="Long", Radar="DAVID_SLING_LN" }, } @@ -688,7 +687,7 @@ do -- TODO Version -- @field #string version - self.version="0.9.26" + self.version="0.9.27" self:I(string.format("***** Starting MANTIS Version %s *****", self.version)) --- FSM Functions --- From a915452e6e98ab23efa8664c03b4d0fe0ccde970 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 21 Mar 2025 09:22:08 +0100 Subject: [PATCH 4/4] #COORDINATE - use magnetic for BRAA --- Moose Development/Moose/Core/Point.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 7f2b3d558..9afc49b7a 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -1221,7 +1221,7 @@ do -- COORDINATE local s = string.format( '%03d°', AngleDegrees ) if MagVar then - local variation = UTILS.GetMagneticDeclination() or 0 + local variation = self:GetMagneticDeclination() or 0 local AngleMagnetic = AngleDegrees - variation if AngleMagnetic < 0 then AngleMagnetic = 360-AngleMagnetic end @@ -2959,6 +2959,8 @@ do -- COORDINATE local AngleRadians = self:GetAngleRadians( DirectionVec3 ) local bearing = UTILS.Round( UTILS.ToDegree( AngleRadians ),0 ) + local magnetic = self:GetMagneticDeclination() or 0 + bearing = bearing - magnetic local rangeMetres = self:Get2DDistance(currentCoord) local rangeNM = UTILS.Round( UTILS.MetersToNM(rangeMetres), 0)