Merge branch 'master-ng' of https://github.com/shaji-Dev/MOOSE into master-ng

This commit is contained in:
shafik
2026-07-23 17:26:24 +02:00
4 changed files with 70 additions and 46 deletions
+55 -37
View File
@@ -2043,35 +2043,31 @@ do
-- @param #MANTIS self -- @param #MANTIS self
-- @param #number height -- @param #number height
-- @param Core.Point#COORDINATE SamCoordinate -- @param Core.Point#COORDINATE SamCoordinate
-- @param #table contactSnapshot Contact facts captured once for the current check.
-- @return #table set -- @return #table set
function MANTIS:_PreFilterHeight(height,SamCoordinate) function MANTIS:_PreFilterHeight(height,SamCoordinate,contactSnapshot)
self:T(self.lid.."_PreFilterHeight") self:T(self.lid.."_PreFilterHeight")
local set = {} local set = {}
local dlink = self.Detection -- Ops.Intel#INTEL_DLINK for _,contact in pairs(contactSnapshot) do
local detectedgroups = dlink:GetContactTable()
for _,_contact in pairs(detectedgroups) do
local contact = _contact -- Ops.Intel#INTEL.Contact
local grp = contact.group -- Wrapper.Group#GROUP local grp = contact.group -- Wrapper.Group#GROUP
if grp:IsAlive() then local coord = contact.coordinate
local coord = grp:GetCoordinate() local dist = 0
local dist = 0 local include = true
local include = true if contact.isGround then include = false end
if grp:IsGround() then include = false end if contact.isShip then include = false end -- MANTIS is anti-air: surface contacts are not engageable targets
if grp:IsShip() then include = false end -- MANTIS is anti-air: surface contacts are not engageable targets if contact.coalition == self.coalition then include = false end
if grp:GetCoalition() == self.coalition then include = false end if coord and SamCoordinate and contact.isHelicopter then
if coord and SamCoordinate and grp:IsHelicopter() then dist = coord:Get2DDistance(SamCoordinate) or 0
dist = coord:Get2DDistance(SamCoordinate) or 0 if dist > self.ShoradActDistance then include = false end -- we do not want long range shooting at helos
if dist > self.ShoradActDistance then include = false end -- we do not want long range shooting at helos end
end if self.debug then
if self.debug then local text = "Looking at Group: "..grp:GetName() or "N/A"
local text = "Looking at Group: "..grp:GetName() or "N/A" text = text .. " Include = "..tostring(include)
text = text .. " Include = "..tostring(include) MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.verbose):ToLog()
MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.verbose):ToLog() end
end local grpalt = contact.height
local grpalt = grp:GetHeight(true) if grpalt < height and grpalt > 10 and include == true then
if grpalt < height and grpalt > 10 and include == true then table.insert(set,coord)
table.insert(set,coord)
end
end end
end end
return set return set
@@ -2084,16 +2080,17 @@ do
-- @param #number radius Radius to check. -- @param #number radius Radius to check.
-- @param #number height Height to check. -- @param #number height Height to check.
-- @param #boolean dlink Data from DLINK. -- @param #boolean dlink Data from DLINK.
-- @param #table contactSnapshot Contact facts captured once for the current check.
-- @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 -- @return #number Distance Target distance in meters or zero when no object is in zone
function MANTIS:_CheckObjectInZone(dectset, samcoordinate, radius, height, dlink) function MANTIS:_CheckObjectInZone(dectset, samcoordinate, radius, height, dlink, contactSnapshot)
self:T(self.lid.."_CheckObjectInZone") self:T(self.lid.."_CheckObjectInZone")
-- check if non of the coordinate is in the given defense zone -- check if non of the coordinate is in the given defense zone
local rad = radius or self.checkradius local rad = radius or self.checkradius
local set = dectset local set = dectset
if dlink then if dlink then
-- DEBUG -- DEBUG
set = self:_PreFilterHeight(height,samcoordinate) set = self:_PreFilterHeight(height,samcoordinate,contactSnapshot)
end end
--self.friendlyset -- Core.Set#SET_GROUP --self.friendlyset -- Core.Set#SET_GROUP
if self.checkforfriendlies == true and self.friendlyset == nil then if self.checkforfriendlies == true and self.friendlyset == nil then
@@ -2732,7 +2729,8 @@ do
group:OptionEngageRange(engagerange) --engagement will be 95% of firing range group:OptionEngageRange(engagerange) --engagement will be 95% of firing range
if (group:IsGround() or group:IsShip()) and group:IsAlive() then if (group:IsGround() or group:IsShip()) and group:IsAlive() then
local grpname = group:GetName() local grpname = group:GetName()
local grpcoord = group:GetCoordinate() local grpcoord = group:GetCoord()
if grpcoord then grpcoord.Heading = group:GetHeading() or 0 end
if group:IsShip() and self.NavalPerUnit if group:IsShip() and self.NavalPerUnit
and self:_BuildNavalUnitEntries(group, grpname, SAM_Tbl, SAM_Tbl_lg, SAM_Tbl_md, SAM_Tbl_sh, SAM_Tbl_pt, SEAD_Grps) then and self:_BuildNavalUnitEntries(group, grpname, SAM_Tbl, SAM_Tbl_lg, SAM_Tbl_md, SAM_Tbl_sh, SAM_Tbl_pt, SEAD_Grps) then
self:T(grpname.." handled as per-unit naval group") self:T(grpname.." handled as per-unit naval group")
@@ -2944,10 +2942,11 @@ function MANTIS:SeadAllowSuppression(targetGroup, targetName, attackerGroup, wea
-- @param #table detset Table of COORDINATES -- @param #table detset Table of COORDINATES
-- @param #boolean dlink Using DLINK -- @param #boolean dlink Using DLINK
-- @param #number limit of SAM sites to go active on a contact -- @param #number limit of SAM sites to go active on a contact
-- @param #table contactSnapshot Contact facts captured once for the current check.
-- @return #number instatusred -- @return #number instatusred
-- @return #number instatusgreen -- @return #number instatusgreen
-- @return #number activeshorads -- @return #number activeshorads
function MANTIS:_CheckLoop(samset,detset,dlink,limit) function MANTIS:_CheckLoop(samset,detset,dlink,limit,contactSnapshot)
self:T(self.lid .. "CheckLoop " .. #detset .. " Coordinates") self:T(self.lid .. "CheckLoop " .. #detset .. " Coordinates")
local switchedon = 0 local switchedon = 0
local instatusred = 0 local instatusred = 0
@@ -2976,7 +2975,7 @@ function MANTIS:SeadAllowSuppression(targetGroup, targetName, attackerGroup, wea
local samalive = false local samalive = false
if navalparent then samalive = (samunit ~= nil) and samunit:IsAlive() or false if navalparent then samalive = (samunit ~= nil) and samunit:IsAlive() or false
elseif samgroup then samalive = samgroup:IsAlive() or false end elseif samgroup then samalive = samgroup:IsAlive() or false end
local IsInZone, Distance = self:_CheckObjectInZone(detset, samcoordinate, radius, height, dlink) local IsInZone, Distance = self:_CheckObjectInZone(detset, samcoordinate, radius, height, dlink, contactSnapshot)
-- Naval surface wake-up: quiet ships activate when enemy surface combatants -- Naval surface wake-up: quiet ships activate when enemy surface combatants
-- close within the trigger radius. Jamming has precedence and holds them down. -- close within the trigger radius. Jamming has precedence and holds them down.
if (not IsInZone) and self.NavalSurfaceWakeup and self._navalSAMs and self._navalSAMs[name] if (not IsInZone) and self.NavalSurfaceWakeup and self._navalSAMs and self._navalSAMs[name]
@@ -3095,22 +3094,41 @@ function MANTIS:SeadAllowSuppression(targetGroup, targetName, attackerGroup, wea
self:_RefreshSAMTable() self:_RefreshSAMTable()
end end
self.checkcounter = self.checkcounter + 1 self.checkcounter = self.checkcounter + 1
local contactSnapshot = nil
if dlink then
contactSnapshot = {}
for _,contact in pairs(detection:GetContactTable()) do
local grp = contact.group -- Wrapper.Group#GROUP
if grp:IsAlive() then
local coord = grp:GetCoord()
contactSnapshot[#contactSnapshot + 1] = {
group = grp,
coordinate = coord,
height = grp:GetHeight(true),
coalition = grp:GetCoalition(),
isGround = grp:IsGround(),
isShip = grp:IsShip(),
isHelicopter = grp:IsHelicopter(),
}
end
end
end
local instatusred = 0 local instatusred = 0
local instatusgreen = 0 local instatusgreen = 0
local activeshorads = 0 local activeshorads = 0
-- switch SAMs on/off if (n)one of the detected groups is inside their reach -- switch SAMs on/off if (n)one of the detected groups is inside their reach
if self.automode then if self.automode then
local samset = self.SAM_Table_Long -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height local samset = self.SAM_Table_Long -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
local instatusredl, instatusgreenl, activeshoradsl = self:_CheckLoop(samset,detset,dlink,self.maxlongrange) local instatusredl, instatusgreenl, activeshoradsl = self:_CheckLoop(samset,detset,dlink,self.maxlongrange,contactSnapshot)
local samset = self.SAM_Table_Medium -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height local samset = self.SAM_Table_Medium -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
local instatusredm, instatusgreenm, activeshoradsm = self:_CheckLoop(samset,detset,dlink,self.maxmidrange) local instatusredm, instatusgreenm, activeshoradsm = self:_CheckLoop(samset,detset,dlink,self.maxmidrange,contactSnapshot)
local samset = self.SAM_Table_Short -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height local samset = self.SAM_Table_Short -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
local instatusreds, instatusgreens, activeshoradss = self:_CheckLoop(samset,detset,dlink,self.maxshortrange) local instatusreds, instatusgreens, activeshoradss = self:_CheckLoop(samset,detset,dlink,self.maxshortrange,contactSnapshot)
local samset = self.SAM_Table_PointDef -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height local samset = self.SAM_Table_PointDef -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
local instatusred, instatusgreen, activeshorads = self:_CheckLoop(samset,detset,dlink,self.maxpointdefrange) local instatusred, instatusgreen, activeshorads = self:_CheckLoop(samset,detset,dlink,self.maxpointdefrange,contactSnapshot)
else else
local samset = self:_GetSAMTable() -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height local samset = self:_GetSAMTable() -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
local instatusred, instatusgreen, activeshorads = self:_CheckLoop(samset,detset,dlink,self.maxclassic) local instatusred, instatusgreen, activeshorads = self:_CheckLoop(samset,detset,dlink,self.maxclassic,contactSnapshot)
end end
local function GetReport() local function GetReport()
@@ -4090,8 +4108,8 @@ function MANTIS:SeadAllowSuppression(targetGroup, targetName, attackerGroup, wea
end end
--- [Internal] Override: _CheckLoop with jammer suppression. --- [Internal] Override: _CheckLoop with jammer suppression.
function MANTIS:_CheckLoop(samset, detset, dlink, limit) function MANTIS:_CheckLoop(samset, detset, dlink, limit, contactSnapshot)
local r, g, s = self:_CheckLoopOriginal(samset, detset, dlink, limit) local r, g, s = self:_CheckLoopOriginal(samset, detset, dlink, limit, contactSnapshot)
if self._jammerEnabled and self._jammedSAMs then if self._jammerEnabled and self._jammedSAMs then
for _, _data in pairs(samset) do for _, _data in pairs(samset) do
local name = _data[1] local name = _data[1]
+3 -1
View File
@@ -45,7 +45,7 @@
-- **Supported Aircraft:** -- **Supported Aircraft:**
-- --
-- * [F/A-18C Hornet Lot 20](https://forums.eagle.ru/forumdisplay.php?f=557) (Player & AI) -- * [F/A-18C Hornet Lot 20](https://forums.eagle.ru/forumdisplay.php?f=557) (Player & AI)
-- * [F-14A/B/A Early Tomcat](https://forums.eagle.ru/forumdisplay.php?f=395) (Player & AI) -- * [F-14A/B/BU/A Early Tomcat](https://forums.eagle.ru/forumdisplay.php?f=395) (Player & AI)
-- * [A-4E Skyhawk Community Mod](https://forums.eagle.ru/showthread.php?t=224989) (Player & AI) -- * [A-4E Skyhawk Community Mod](https://forums.eagle.ru/showthread.php?t=224989) (Player & AI)
-- * [AV-8B N/A Harrier](https://forums.eagle.ru/forumdisplay.php?f=555) (Player & AI) -- * [AV-8B N/A Harrier](https://forums.eagle.ru/forumdisplay.php?f=555) (Player & AI)
-- * [T-45C Goshawk](https://forum.dcs.world/topic/203816-vnao-t-45-goshawk/) (VNAO mod) (Player & AI) -- * [T-45C Goshawk](https://forum.dcs.world/topic/203816-vnao-t-45-goshawk/) (VNAO mod) (Player & AI)
@@ -1276,6 +1276,7 @@ AIRBOSS = {
-- @field #string A4EC A-4E Community mod. -- @field #string A4EC A-4E Community mod.
-- @field #string HORNET F/A-18C Lot 20 Hornet by Eagle Dynamics. -- @field #string HORNET F/A-18C Lot 20 Hornet by Eagle Dynamics.
-- @field #string F14A F-14A by Heatblur. -- @field #string F14A F-14A by Heatblur.
-- @field #string F14BU F-14BU by Heatblur.
-- @field #string F14A_Early F-14A-135-GR-Early by Heatblur. -- @field #string F14A_Early F-14A-135-GR-Early by Heatblur.
-- @field #string F14B F-14B by Heatblur. -- @field #string F14B F-14B by Heatblur.
-- @field #string F14A_AI F-14A Tomcat (AI). -- @field #string F14A_AI F-14A Tomcat (AI).
@@ -1297,6 +1298,7 @@ AIRBOSS.AircraftCarrier={
F14A="F-14A-135-GR", F14A="F-14A-135-GR",
F14A_Early="F-14A-135-GR-Early", F14A_Early="F-14A-135-GR-Early",
F14B="F-14B", F14B="F-14B",
F14BU="F-14BU",
F14A_AI="F-14A", F14A_AI="F-14A",
FA18C="F/A-18C", FA18C="F/A-18C",
T45C="T-45", T45C="T-45",
+7 -1
View File
@@ -6466,7 +6466,13 @@ function AUFTRAG:GetDCSMissionTask(MissionGroup)
-- ESCORT Mission -- -- ESCORT Mission --
-------------------- --------------------
local DCStask=CONTROLLABLE.TaskEscort(nil, self.engageTarget:GetObject(), self.escortVec3, nil, self.engageMaxDistance, self.engageTargetTypes) local FollowGroup=self.engageTarget:GetObject()
local DCStask=nil
if next(self.engageTargetTypes)==nil then
DCStask=FollowGroup:TaskFollow(FollowGroup, self.escortVec3)
else
DCStask=CONTROLLABLE.TaskEscort(nil, FollowGroup, self.escortVec3, nil, self.engageMaxDistance, self.engageTargetTypes)
end
table.insert(DCStasks, DCStask) table.insert(DCStasks, DCStask)
+2 -4
View File
@@ -2749,14 +2749,12 @@ function CTLD:_EventHandler(EventData)
loaded = self.Loaded_Cargo[unitname] -- #CTLD.LoadedCargo loaded = self.Loaded_Cargo[unitname] -- #CTLD.LoadedCargo
loaded.Cratesloaded = loaded.Cratesloaded - 1 loaded.Cratesloaded = loaded.Cratesloaded - 1
if loaded.Cratesloaded < 0 then loaded.Cratesloaded = 0 end if loaded.Cratesloaded < 0 then loaded.Cratesloaded = 0 end
-- TODO zap cargo from list
local Loaded = {} local Loaded = {}
for _,_item in pairs (loaded.Cargo or {}) do for _,_item in pairs (loaded.Cargo or {}) do
self:T(self.lid.."UNLOAD checking: ".._item:GetName()) self:T(self.lid.."UNLOAD checking: ".._item:GetName())
self:T(self.lid.."UNLOAD state: ".. tostring(_item:WasDropped())) self:T(self.lid.."UNLOAD state: ".. tostring(_item:WasDropped()))
if _item and _item:GetType() == CTLD_CARGO.Enum.GCLOADABLE and event.IniDynamicCargoName and event.IniDynamicCargoName ~= _item:GetName() and not _item:WasDropped() then local unloadedItem = _item and _item:GetType() == CTLD_CARGO.Enum.GCLOADABLE and event.IniDynamicCargoName and event.IniDynamicCargoName == _item:GetName()
table.insert(Loaded,_item) if not unloadedItem then
else
table.insert(Loaded,_item) table.insert(Loaded,_item)
end end
end end