mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-16 16:06:44 +00:00
#MANTIS - Added more flags for systems able to shoot down incoming missiles
#SEAD/#SHORAD/#MANTIS - Fixed logic and governance problems with SHORAD engagement
This commit is contained in:
@@ -283,7 +283,7 @@
|
|||||||
MANTIS = {
|
MANTIS = {
|
||||||
ClassName = "MANTIS",
|
ClassName = "MANTIS",
|
||||||
name = "mymantis",
|
name = "mymantis",
|
||||||
version = "0.9.43",
|
version = "0.9.44",
|
||||||
SAM_Templates_Prefix = "",
|
SAM_Templates_Prefix = "",
|
||||||
SAM_Group = nil,
|
SAM_Group = nil,
|
||||||
EWR_Templates_Prefix = "",
|
EWR_Templates_Prefix = "",
|
||||||
@@ -400,10 +400,10 @@ MANTIS.SamData = {
|
|||||||
["Silkworm"] = { Range=90, Blindspot=1, Height=0.2, Type="Long", Radar="Silkworm" },
|
["Silkworm"] = { Range=90, Blindspot=1, Height=0.2, Type="Long", Radar="Silkworm" },
|
||||||
["C-RAM"] = { Range=2, Blindspot=0, Height=2, Type="Point", Radar="HEMTT_C-RAM_Phalanx", Point="true" },
|
["C-RAM"] = { Range=2, Blindspot=0, Height=2, Type="Point", Radar="HEMTT_C-RAM_Phalanx", Point="true" },
|
||||||
-- units from HDS Mod, multi launcher options is tricky
|
-- units from HDS Mod, multi launcher options is tricky
|
||||||
["SA-10B"] = { Range=75, Blindspot=0, Height=18, Type="Medium" , Radar="SA-10B"},
|
["SA-10B"] = { Range=75, Blindspot=0, Height=18, Type="Medium" , Radar="SA-10B", ARMCapacity=4},
|
||||||
["SA-17"] = { Range=50, Blindspot=3, Height=50, Type="Medium", Radar="SA-17", ARMCapacity=3 },
|
["SA-17"] = { Range=50, Blindspot=3, Height=50, Type="Medium", Radar="SA-17", ARMCapacity=4 },
|
||||||
["SA-20A"] = { Range=150, Blindspot=5, Height=27, Type="Long" , Radar="S-300PMU1"},
|
["SA-20A"] = { Range=150, Blindspot=5, Height=27, Type="Long" , Radar="S-300PMU1", ARMCapacity=16},
|
||||||
["SA-20B"] = { Range=200, Blindspot=4, Height=27, Type="Long" , Radar="S-300PMU2"},
|
["SA-20B"] = { Range=200, Blindspot=4, Height=27, Type="Long" , Radar="S-300PMU2", ARMCapacity=18},
|
||||||
["SA-21"] = { Range=380, Blindspot=5, Height=30, Type="Long" , Radar="92N6E"},
|
["SA-21"] = { Range=380, Blindspot=5, Height=30, Type="Long" , Radar="92N6E"},
|
||||||
["S-300VM"] = { Range=200, Blindspot=5, Height=30, Type="Long" , Radar="9S32M", ARMCapacity=4},
|
["S-300VM"] = { Range=200, Blindspot=5, Height=30, Type="Long" , Radar="9S32M", ARMCapacity=4},
|
||||||
["S-300V4"] = { Range=380, Blindspot=5, Height=30, Type="Long" , Radar="9S32M", ARMCapacity=4},
|
["S-300V4"] = { Range=380, Blindspot=5, Height=30, Type="Long" , Radar="9S32M", ARMCapacity=4},
|
||||||
@@ -414,9 +414,9 @@ MANTIS.SamData = {
|
|||||||
["Nike"] = { Range=155, Blindspot=6, Height=30, Type="Long", Radar="HIPAR" },
|
["Nike"] = { Range=155, Blindspot=6, Height=30, Type="Long", Radar="HIPAR" },
|
||||||
["Dog Ear"] = { Range=11, Blindspot=0, Height=9, Type="Point", Radar="Dog Ear", Point="true" },
|
["Dog Ear"] = { Range=11, Blindspot=0, Height=9, Type="Point", Radar="Dog Ear", Point="true" },
|
||||||
-- CH Added to DCS core 2.9.19.x
|
-- CH Added to DCS core 2.9.19.x
|
||||||
["Pantsir S1"] = { Range=20, Blindspot=1.2, Height=15, Type="Point", Radar="PantsirS1" , Point="true" },
|
["Pantsir S1"] = { Range=20, Blindspot=1.2, Height=15, Type="Point", Radar="PantsirS1" , Point="true", ARMCapacity=3 },
|
||||||
["Tor M2"] = { Range=12, Blindspot=1, Height=10, Type="Point", Radar="TorM2", Point="true", ARMCapacity=4 },
|
["Tor M2"] = { Range=12, Blindspot=1, Height=10, Type="Point", Radar="TorM2", Point="true", ARMCapacity=4 },
|
||||||
["IRIS-T SLM"] = { Range=40, Blindspot=0.5, Height=20, Type="Medium", Radar="CH_IRIST_SLM" },
|
["IRIS-T SLM"] = { Range=40, Blindspot=0.5, Height=20, Type="Medium", Radar="CH_IRIST_SLM", ARMCapacity=12 }, -- 4 per starter, usually 3 starters in a battery
|
||||||
}
|
}
|
||||||
|
|
||||||
--- SAM data HDS
|
--- SAM data HDS
|
||||||
@@ -432,13 +432,13 @@ MANTIS.SamDataHDS = {
|
|||||||
-- group name MUST contain HDS to ID launcher type correctly!
|
-- group name MUST contain HDS to ID launcher type correctly!
|
||||||
["SA-2 HDS"] = { Range=56, Blindspot=7, Height=30, Type="Medium", Radar="V759" },
|
["SA-2 HDS"] = { Range=56, Blindspot=7, Height=30, Type="Medium", Radar="V759" },
|
||||||
["SA-3 HDS"] = { Range=20, Blindspot=6, Height=30, Type="Short", Radar="V-601P" },
|
["SA-3 HDS"] = { Range=20, Blindspot=6, Height=30, Type="Short", Radar="V-601P" },
|
||||||
["SA-10B HDS"] = { Range=90, Blindspot=5, Height=25, Type="Long" , Radar="5P85CE ln"}, -- V55RUD
|
["SA-10B HDS"] = { Range=90, Blindspot=5, Height=25, Type="Long" , Radar="5P85CE ln", ARMCapacity=8}, -- V55RUD
|
||||||
["SA-10C HDS"] = { Range=75, Blindspot=5, Height=25, Type="Long" , Radar="5P85SE ln", ARMCapacity=3}, -- V55RUD
|
["SA-10C HDS"] = { Range=75, Blindspot=5, Height=25, Type="Long" , Radar="5P85SE ln", ARMCapacity=3}, -- V55RUD
|
||||||
["SA-17 HDS"] = { Range=50, Blindspot=3, Height=50, Type="Medium", Radar="SA-17 " },
|
["SA-17 HDS"] = { Range=50, Blindspot=3, Height=50, Type="Medium", Radar="SA-17", ARMCapacity=4 },
|
||||||
["SA-12 HDS 2"] = { Range=100, Blindspot=13, Height=30, Type="Long" , Radar="S-300V 9A82 l"},
|
["SA-12 HDS 2"] = { Range=100, Blindspot=13, Height=30, Type="Long" , Radar="S-300V 9A82 l", ARMCapacity=12},
|
||||||
["SA-12 HDS 1"] = { Range=75, Blindspot=6, Height=25, Type="Long" , Radar="S-300V 9A83 l"},
|
["SA-12 HDS 1"] = { Range=75, Blindspot=6, Height=25, Type="Long" , Radar="S-300V 9A83 l", ARMCapacity=12},
|
||||||
["SA-23 HDS 2"] = { Range=200, Blindspot=5, Height=37, Type="Long", Radar="S-300VM 9A82ME" },
|
["SA-23 HDS 2"] = { Range=200, Blindspot=5, Height=37, Type="Long", Radar="S-300VM 9A82ME", ARMCapacity=14 },
|
||||||
["SA-23 HDS 1"] = { Range=100, Blindspot=1, Height=50, Type="Long", Radar="S-300VM 9A83ME" },
|
["SA-23 HDS 1"] = { Range=100, Blindspot=1, Height=50, Type="Long", Radar="S-300VM 9A83ME", ARMCapacity=14 },
|
||||||
["HQ-2 HDS"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
|
["HQ-2 HDS"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
|
||||||
["SAMPT Block 1 HDS"] = { Range=120, Blindspot=1, Height=20, Type="long", Radar="SAMPT_MLT_Blk1" }, -- Block 1 Launcher
|
["SAMPT Block 1 HDS"] = { Range=120, Blindspot=1, Height=20, Type="long", Radar="SAMPT_MLT_Blk1" }, -- Block 1 Launcher
|
||||||
["SAMPT Block 1INT HDS"] = { Range=150, Blindspot=1, Height=25, Type="long", Radar="SAMPT_MLT_Blk1NT" }, -- Block 1-INT Launcher
|
["SAMPT Block 1INT HDS"] = { Range=150, Blindspot=1, Height=25, Type="long", Radar="SAMPT_MLT_Blk1NT" }, -- Block 1-INT Launcher
|
||||||
@@ -483,20 +483,20 @@ MANTIS.SamDataCH = {
|
|||||||
-- group name MUST contain CHM to ID launcher type correctly!
|
-- group name MUST contain CHM to ID launcher type correctly!
|
||||||
["2S38 CHM"] = { Range=6, Blindspot=0.1, Height=4.5, Type="Short", Radar="2S38" },
|
["2S38 CHM"] = { Range=6, Blindspot=0.1, Height=4.5, Type="Short", Radar="2S38" },
|
||||||
["PantsirS1 CHM"] = { Range=20, Blindspot=1.2, Height=15, Type="Point", Radar="PantsirS1", Point="true", ARMCapacity=3 },
|
["PantsirS1 CHM"] = { Range=20, Blindspot=1.2, Height=15, Type="Point", Radar="PantsirS1", Point="true", ARMCapacity=3 },
|
||||||
["PantsirS2 CHM"] = { Range=30, Blindspot=1.2, Height=18, Type="Medium", Radar="PantsirS2" },
|
["PantsirS2 CHM"] = { Range=30, Blindspot=1.2, Height=18, Type="Medium", Radar="PantsirS2", ARMCapacity=4 },
|
||||||
["PGL-625 CHM"] = { Range=10, Blindspot=1, Height=5, Type="Short", Radar="PGL_625" },
|
["PGL-625 CHM"] = { Range=10, Blindspot=1, Height=5, Type="Short", Radar="PGL_625" },
|
||||||
["HQ-17A CHM"] = { Range=15, Blindspot=1.5, Height=10, Type="Short", Radar="HQ17A" },
|
["HQ-17A CHM"] = { Range=15, Blindspot=1.5, Height=10, Type="Short", Radar="HQ17A" },
|
||||||
["M903PAC2 CHM"] = { Range=120, Blindspot=3, Height=24.5, Type="Long", Radar="MIM104_M903_PAC2" },
|
["M903PAC2 CHM"] = { Range=120, Blindspot=3, Height=24.5, Type="Long", Radar="MIM104_M903_PAC2" },
|
||||||
["M903PAC3 CHM"] = { Range=160, Blindspot=1, Height=40, Type="Long", Radar="MIM104_M903_PAC3" },
|
["M903PAC3 CHM"] = { Range=160, Blindspot=1, Height=40, Type="Long", Radar="MIM104_M903_PAC3" },
|
||||||
["TorM2 CHM"] = { Range=12, Blindspot=1, Height=10, Type="Point", Radar="TorM2", Point="true" },
|
["TorM2 CHM"] = { Range=12, Blindspot=1, Height=10, Type="Point", Radar="TorM2", Point="true", ARMCapacity=3 },
|
||||||
["TorM2K CHM"] = { Range=12, Blindspot=1, Height=10, Type="Point", Radar="TorM2K", Point="true" },
|
["TorM2K CHM"] = { Range=12, Blindspot=1, Height=10, Type="Point", Radar="TorM2K", Point="true", ARMCapacity=4 },
|
||||||
["TorM2M CHM"] = { Range=16, Blindspot=1, Height=10, Type="Point", Radar="TorM2M", Point="true" },
|
["TorM2M CHM"] = { Range=16, Blindspot=1, Height=10, Type="Point", Radar="TorM2M", Point="true", ARMCapacity=4 },
|
||||||
["NASAMS3-AMRAAMER CHM"] = { Range=50, Blindspot=2, Height=35.7, Type="Medium", Radar="CH_NASAMS3_LN_AMRAAM_ER" },
|
["NASAMS3-AMRAAMER CHM"] = { Range=50, Blindspot=2, Height=35.7, Type="Medium", Radar="CH_NASAMS3_LN_AMRAAM_ER" },
|
||||||
["NASAMS3-AIM9X2 CHM"] = { Range=20, Blindspot=0.2, Height=18, Type="Short", Radar="CH_NASAMS3_LN_AIM9X2" },
|
["NASAMS3-AIM9X2 CHM"] = { Range=20, Blindspot=0.2, Height=18, Type="Short", Radar="CH_NASAMS3_LN_AIM9X2" },
|
||||||
["C-RAM CHM"] = { Range=2, Blindspot=0, Height=2, Type="Point", Radar="CH_Centurion_C_RAM", Point="true" },
|
["C-RAM CHM"] = { Range=2, Blindspot=0, Height=2, Type="Point", Radar="CH_Centurion_C_RAM", Point="true" },
|
||||||
["PGZ-09 CHM"] = { Range=4, Blindspot=0.5, Height=3, Type="Point", Radar="CH_PGZ09", Point="true" },
|
["PGZ-09 CHM"] = { Range=4, Blindspot=0.5, Height=3, Type="Point", Radar="CH_PGZ09", Point="true" },
|
||||||
["S350-9M100 CHM"] = { Range=15, Blindspot=1, Height=8, Type="Short", Radar="CH_S350_50P6_9M100" },
|
["S350-9M100 CHM"] = { Range=15, Blindspot=1, Height=8, Type="Short", Radar="CH_S350_50P6_9M100", ARMCapacity=20 },
|
||||||
["S350-9M96D CHM"] = { Range=150, Blindspot=2.5, Height=30, Type="Long", Radar="CH_S350_50P6_9M96D" },
|
["S350-9M96D CHM"] = { Range=150, Blindspot=2.5, Height=30, Type="Long", Radar="CH_S350_50P6_9M96D", ARMCapacity=20 },
|
||||||
["LAV-AD CHM"] = { Range=8, Blindspot=0.16, Height=4.8, Type="Short", Radar="CH_LAVAD" },
|
["LAV-AD CHM"] = { Range=8, Blindspot=0.16, Height=4.8, Type="Short", Radar="CH_LAVAD" },
|
||||||
["HQ-22 CHM"] = { Range=170, Blindspot=5, Height=27, Type="Long", Radar="CH_HQ22_LN" },
|
["HQ-22 CHM"] = { Range=170, Blindspot=5, Height=27, Type="Long", Radar="CH_HQ22_LN" },
|
||||||
["PGZ-95 CHM"] = { Range=2.5, Blindspot=0.5, Height=2, Type="Point", Radar="CH_PGZ95",Point="true" },
|
["PGZ-95 CHM"] = { Range=2.5, Blindspot=0.5, Height=2, Type="Point", Radar="CH_PGZ95",Point="true" },
|
||||||
@@ -508,8 +508,8 @@ MANTIS.SamDataCH = {
|
|||||||
["Skynex CHM"] = { Range=3.5, Blindspot=0.1, Height=3.5, Type="Point", Radar="CH_SkynexHX", Point="true" },
|
["Skynex CHM"] = { Range=3.5, Blindspot=0.1, Height=3.5, Type="Point", Radar="CH_SkynexHX", Point="true" },
|
||||||
["Skyshield CHM"] = { Range=3.5, Blindspot=0.1, Height=3.5, Type="Point", Radar="CH_Skyshield_Gun", Point="true" },
|
["Skyshield CHM"] = { Range=3.5, Blindspot=0.1, Height=3.5, Type="Point", Radar="CH_Skyshield_Gun", Point="true" },
|
||||||
["WieselOzelot CHM"] = { Range=8, Blindspot=0.16, Height=4.8, Type="Short", Radar="CH_Wiesel2Ozelot" },
|
["WieselOzelot CHM"] = { Range=8, Blindspot=0.16, Height=4.8, Type="Short", Radar="CH_Wiesel2Ozelot" },
|
||||||
["BukM3-9M317M CHM"] = { Range=70, Blindspot=0.25, Height=35, Type="Medium", Radar="CH_BukM3_9A317M" },
|
["BukM3-9M317M CHM"] = { Range=70, Blindspot=0.25, Height=35, Type="Medium", Radar="CH_BukM3_9A317M", ARMCapacity=20 },
|
||||||
["BukM3-9M317MA CHM"] = { Range=70, Blindspot=0.25, Height=35, Type="Medium", Radar="CH_BukM3_9A317MA" },
|
["BukM3-9M317MA CHM"] = { Range=70, Blindspot=0.25, Height=35, Type="Medium", Radar="CH_BukM3_9A317MA", ARMCapacity=20 },
|
||||||
["SkySabre CHM"] = { Range=30, Blindspot=0.5, Height=10, Type="Medium", Radar="CH_SkySabreLN" },
|
["SkySabre CHM"] = { Range=30, Blindspot=0.5, Height=10, Type="Medium", Radar="CH_SkySabreLN" },
|
||||||
["Stormer CHM"] = { Range=7.5, Blindspot=0.3, Height=7, Type="Short", Radar="CH_StormerHVM" },
|
["Stormer CHM"] = { Range=7.5, Blindspot=0.3, Height=7, Type="Short", Radar="CH_StormerHVM" },
|
||||||
["THAAD CHM"] = { Range=200, Blindspot=40, Height=150, Type="Long", Radar="CH_THAAD_M1120" },
|
["THAAD CHM"] = { Range=200, Blindspot=40, Height=150, Type="Long", Radar="CH_THAAD_M1120" },
|
||||||
@@ -1809,6 +1809,7 @@ do
|
|||||||
local group = GROUP:FindByName(grpname) -- Wrapper.Group#GROUP
|
local group = GROUP:FindByName(grpname) -- Wrapper.Group#GROUP
|
||||||
local units = group:GetUnits()
|
local units = group:GetUnits()
|
||||||
local SAMData = self.SamData
|
local SAMData = self.SamData
|
||||||
|
local ARMCapacity
|
||||||
if mod then
|
if mod then
|
||||||
SAMData = self.SamDataHDS
|
SAMData = self.SamDataHDS
|
||||||
elseif sma then
|
elseif sma then
|
||||||
@@ -1816,22 +1817,23 @@ do
|
|||||||
elseif chm then
|
elseif chm then
|
||||||
SAMData = self.SamDataCH
|
SAMData = self.SamDataCH
|
||||||
end
|
end
|
||||||
--self:I("Looking to auto-match for "..grpname)
|
self:T("Looking to auto-match for "..grpname)
|
||||||
for _,_unit in pairs(units) do
|
for _,_unit in pairs(units) do
|
||||||
local unit = _unit -- Wrapper.Unit#UNIT
|
local unit = _unit -- Wrapper.Unit#UNIT
|
||||||
local type = string.lower(unit:GetTypeName())
|
local typename = string.lower(unit:GetTypeName())
|
||||||
--self:I(string.format("Matching typename: %s",type))
|
self:T(string.format("Matching typename: %s",typename))
|
||||||
for idx,entry in pairs(SAMData) do
|
for idx,entry in pairs(SAMData) do
|
||||||
local _entry = entry -- #MANTIS.SamData
|
local _entry = entry -- #MANTIS.SamData
|
||||||
local _radar = string.lower(_entry.Radar)
|
local _radar = string.lower(_entry.Radar)
|
||||||
--self:I(string.format("Trying typename: %s",_radar))
|
self:T(string.format("Trying typename: %s",_radar))
|
||||||
if string.find(type,_radar,1,true) then
|
if string.find(typename,_radar,1,true) then
|
||||||
type = _entry.Type
|
type = _entry.Type
|
||||||
radiusscale = self.radiusscale[type]
|
radiusscale = self.radiusscale[type]
|
||||||
range = _entry.Range * 1000 * radiusscale -- max firing range used as switch-on
|
range = _entry.Range * 1000 * radiusscale -- max firing range used as switch-on
|
||||||
height = _entry.Height * 1000 -- max firing height
|
height = _entry.Height * 1000 -- max firing height
|
||||||
blind = _entry.Blindspot * 100 -- blind spot range
|
blind = _entry.Blindspot * 100 -- blind spot range
|
||||||
--self:I(string.format("Match: %s - %s",_radar,type))
|
ARMCapacity = _entry.ARMCapacity
|
||||||
|
self:T(string.format("Match: %s - %s",_radar,type))
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@@ -1852,7 +1854,7 @@ do
|
|||||||
if not found then
|
if not found then
|
||||||
self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname))
|
self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname))
|
||||||
end
|
end
|
||||||
return range, height, type, blind
|
return range, height, type, blind, ARMCapacity
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [Internal] Function to get SAM firing data
|
--- [Internal] Function to get SAM firing data
|
||||||
@@ -1911,7 +1913,7 @@ do
|
|||||||
end
|
end
|
||||||
--- Tertiary filter if not found
|
--- Tertiary filter if not found
|
||||||
if (not found) or HDSmod or SMAMod or CHMod then
|
if (not found) or HDSmod or SMAMod or CHMod then
|
||||||
range, height, type = self:_GetSAMDataFromUnits(grpname,HDSmod,SMAMod,CHMod)
|
range, height, type, blind, ARMCapacity = self:_GetSAMDataFromUnits(grpname,HDSmod,SMAMod,CHMod)
|
||||||
elseif not found then
|
elseif not found then
|
||||||
self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname))
|
self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname))
|
||||||
end
|
end
|
||||||
@@ -1954,6 +1956,7 @@ do
|
|||||||
local grpname = group:GetName()
|
local grpname = group:GetName()
|
||||||
local grpcoord = group:GetCoordinate()
|
local grpcoord = group:GetCoordinate()
|
||||||
local grprange,grpheight,type,blind,ARMCapacity = self:_GetSAMRange(grpname)
|
local grprange,grpheight,type,blind,ARMCapacity = self:_GetSAMRange(grpname)
|
||||||
|
if ARMCapacity and ARMCapacity>0 then _group:SetProperty("ARMCapacity",ARMCapacity) end
|
||||||
table.insert( SAM_Tbl, {grpname, grpcoord, grprange, grpheight, blind, type, ARMCapacity})
|
table.insert( SAM_Tbl, {grpname, grpcoord, grprange, grpheight, blind, type, ARMCapacity})
|
||||||
--table.insert( SEAD_Grps, grpname )
|
--table.insert( SEAD_Grps, grpname )
|
||||||
if type == MANTIS.SamType.LONG then
|
if type == MANTIS.SamType.LONG then
|
||||||
@@ -2021,9 +2024,12 @@ do
|
|||||||
local grprange, grpheight,type,blind, ARMCapacity = self:_GetSAMRange(grpname)
|
local grprange, grpheight,type,blind, ARMCapacity = self:_GetSAMRange(grpname)
|
||||||
-- TODO the below might stop working at some point after some hours, needs testing
|
-- TODO the below might stop working at some point after some hours, needs testing
|
||||||
--local radaralive = group:IsSAM()
|
--local radaralive = group:IsSAM()
|
||||||
|
if ARMCapacity and ARMCapacity>0 then _group:SetProperty("ARMCapacity",ARMCapacity) end
|
||||||
local radaralive = true
|
local radaralive = true
|
||||||
table.insert( SAM_Tbl, {grpname, grpcoord, grprange, grpheight, blind, type, ARMCapacity}) -- make the table lighter, as I don't really use the zone here
|
table.insert( SAM_Tbl, {grpname, grpcoord, grprange, grpheight, blind, type, ARMCapacity}) -- make the table lighter, as I don't really use the zone here
|
||||||
table.insert( SEAD_Grps, grpname )
|
if type ~= MANTIS.SamType.POINT then
|
||||||
|
table.insert( SEAD_Grps, grpname )
|
||||||
|
end
|
||||||
if type == MANTIS.SamType.LONG and radaralive then
|
if type == MANTIS.SamType.LONG and radaralive then
|
||||||
table.insert( SAM_Tbl_lg, {grpname, grpcoord, grprange, grpheight, blind, type})
|
table.insert( SAM_Tbl_lg, {grpname, grpcoord, grprange, grpheight, blind, type})
|
||||||
self:T({grpname,grprange, grpheight})
|
self:T({grpname,grprange, grpheight})
|
||||||
@@ -2110,7 +2116,7 @@ do
|
|||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param Wrapper.Group#GROUP targetGroup
|
-- @param Wrapper.Group#GROUP targetGroup
|
||||||
-- @param #string targetName
|
-- @param #string targetName
|
||||||
-- @param Wrapper.Group#GROUPattackerGroup
|
-- @param Wrapper.Group#GROUP attackerGroup
|
||||||
-- @param #string weaponName
|
-- @param #string weaponName
|
||||||
-- @param Wrapper.Weapon#WEAPON weaponWrapper
|
-- @param Wrapper.Weapon#WEAPON weaponWrapper
|
||||||
-- @param #number tti
|
-- @param #number tti
|
||||||
@@ -2129,12 +2135,14 @@ function MANTIS:SeadAllowSuppression(targetGroup, targetName, attackerGroup, wea
|
|||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
-- LOOK UP ARM CAPACITY FOR THIS SAM
|
-- LOOK UP ARM CAPACITY FOR THIS SAM
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
local armcap = nil
|
local armcap = targetGroup:GetProperty("ARMCapacity")
|
||||||
|
|
||||||
for _, sam in pairs(self.SAM_Table or {}) do
|
if not armcap then
|
||||||
if sam[1] == targetName then
|
for _, sam in pairs(self.SAM_Table or {}) do
|
||||||
armcap = sam[7] -- ARMCapacity
|
if sam[1] == targetName then
|
||||||
break
|
armcap = sam[7] -- ARMCapacity
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2228,6 +2236,7 @@ function MANTIS:SeadAllowSuppression(targetGroup, targetName, attackerGroup, wea
|
|||||||
if self.Shorad and self.Shorad.ActiveGroups and self.Shorad.ActiveGroups[name] then
|
if self.Shorad and self.Shorad.ActiveGroups and self.Shorad.ActiveGroups[name] then
|
||||||
activeshorad = true
|
activeshorad = true
|
||||||
end
|
end
|
||||||
|
if samgroup:GetProperty("SHORAD_ACTIVE") == true and activeshorad == false then activeshorad = true end
|
||||||
if IsInZone and (not suppressed) and (not activeshorad) then --check any target in zone and not currently managed by SEAD
|
if IsInZone and (not suppressed) and (not activeshorad) then --check any target in zone and not currently managed by SEAD
|
||||||
if samgroup:IsAlive() then
|
if samgroup:IsAlive() then
|
||||||
-- switch on SAM
|
-- switch on SAM
|
||||||
@@ -2460,6 +2469,7 @@ function MANTIS:SeadAllowSuppression(targetGroup, targetName, attackerGroup, wea
|
|||||||
self.ShoradLink = true
|
self.ShoradLink = true
|
||||||
self.Shorad.Groupset=self.ShoradGroupSet
|
self.Shorad.Groupset=self.ShoradGroupSet
|
||||||
self.Shorad.debug = self.debug
|
self.Shorad.debug = self.debug
|
||||||
|
self.Shorad:AddCallBack(self)
|
||||||
end
|
end
|
||||||
if self.shootandscoot and self.SkateZones and self.Shorad then
|
if self.shootandscoot and self.SkateZones and self.Shorad then
|
||||||
self.Shorad:AddScootZones(self.SkateZones,self.SkateNumber or 3,self.ScootRandom,self.ScootFormation)
|
self.Shorad:AddScootZones(self.SkateZones,self.SkateNumber or 3,self.ScootRandom,self.ScootFormation)
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ function SEAD:New( SEADGroupPrefixes, Padding )
|
|||||||
self:AddTransition("*", "ManageEvasion", "*")
|
self:AddTransition("*", "ManageEvasion", "*")
|
||||||
self:AddTransition("*", "CalculateHitZone", "*")
|
self:AddTransition("*", "CalculateHitZone", "*")
|
||||||
|
|
||||||
self:I("*** SEAD - Started Version 0.4.10")
|
self:I("*** SEAD - Started Version 0.4.11")
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -442,19 +442,12 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
|
|||||||
local SuppressionStartTime = timer.getTime() + delay
|
local SuppressionStartTime = timer.getTime() + delay
|
||||||
local SuppressionEndTime = timer.getTime() + delay + _tti + self.Padding + delay
|
local SuppressionEndTime = timer.getTime() + delay + _tti + self.Padding + delay
|
||||||
local _targetgroupname = _targetgroup:GetName()
|
local _targetgroupname = _targetgroup:GetName()
|
||||||
if not self.SuppressedGroups[_targetgroupname] then
|
local shoradactive = _targetgroup:GetProperty("SHORAD_ACTIVE")
|
||||||
|
if not self.SuppressedGroups[_targetgroupname] and shoradactive ~= true then
|
||||||
-- TODO: ask callback if suppression is allowed BEFORE scheduling timers
|
-- TODO: ask callback if suppression is allowed BEFORE scheduling timers
|
||||||
local allow = true
|
local allow = true
|
||||||
if self.UseCallBack and self.CallBack and self.CallBack.SeadAllowSuppression then
|
if self.UseCallBack and self.CallBack and self.CallBack.SeadAllowSuppression then
|
||||||
allow = self.CallBack:SeadAllowSuppression(
|
allow = self.CallBack:SeadAllowSuppression(_targetgroup,_targetgroupname,SEADGroup,SEADWeaponName,Weapon,_tti,delay)
|
||||||
_targetgroup,
|
|
||||||
_targetgroupname,
|
|
||||||
SEADGroup,
|
|
||||||
SEADWeaponName,
|
|
||||||
Weapon,
|
|
||||||
_tti,
|
|
||||||
delay
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
if not allow then
|
if not allow then
|
||||||
self:T(string.format("*** SEAD - %s | Suppression vetoed by callback", _targetgroupname))
|
self:T(string.format("*** SEAD - %s | Suppression vetoed by callback", _targetgroupname))
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
-- @image Functional.Shorad.jpg
|
-- @image Functional.Shorad.jpg
|
||||||
--
|
--
|
||||||
-- Date: Nov 2021
|
-- Date: Nov 2021
|
||||||
-- Last Update: Jan 2025
|
-- Last Update: Jan 2026
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **SHORAD** class, extends Core.Base#BASE
|
--- **SHORAD** class, extends Core.Base#BASE
|
||||||
@@ -196,7 +196,7 @@ do
|
|||||||
self.SmokeDecoyColor = SmokeDecoyColor or SMOKECOLOR.White
|
self.SmokeDecoyColor = SmokeDecoyColor or SMOKECOLOR.White
|
||||||
end
|
end
|
||||||
|
|
||||||
self:I("*** SHORAD - Started Version 0.3.5")
|
self:I("*** SHORAD - Started Version 0.3.6")
|
||||||
-- Set the string id for output to DCS.log file.
|
-- Set the string id for output to DCS.log file.
|
||||||
self.lid=string.format("SHORAD %s | ", self.name)
|
self.lid=string.format("SHORAD %s | ", self.name)
|
||||||
self:_InitState()
|
self:_InitState()
|
||||||
@@ -465,6 +465,17 @@ do
|
|||||||
return returnname
|
return returnname
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set an object to call back when going evasive.
|
||||||
|
-- @param #SHORAD self
|
||||||
|
-- @param #table Object The object to call.
|
||||||
|
-- @return #SHORAD self
|
||||||
|
function SHORAD:AddCallBack(Object)
|
||||||
|
self:T({Class=Object.ClassName})
|
||||||
|
self.CallBack = Object
|
||||||
|
self.UseCallBack = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Smoke a SHORAD Group
|
--- Smoke a SHORAD Group
|
||||||
-- @param #SHORAD self
|
-- @param #SHORAD self
|
||||||
-- @param Wrapper.Group#GROUP Group The Shorad Group to Smoke
|
-- @param Wrapper.Group#GROUP Group The Shorad Group to Smoke
|
||||||
@@ -524,7 +535,56 @@ do
|
|||||||
-- mymantis:Start()
|
-- mymantis:Start()
|
||||||
function SHORAD:onafterWakeUpShorad(From, Event, To, TargetGroup, Radius, ActiveTimer, TargetCat, ShotAt)
|
function SHORAD:onafterWakeUpShorad(From, Event, To, TargetGroup, Radius, ActiveTimer, TargetCat, ShotAt)
|
||||||
self:T(self.lid .. " WakeUpShorad")
|
self:T(self.lid .. " WakeUpShorad")
|
||||||
self:T({TargetGroup, Radius, ActiveTimer, TargetCat})
|
--self:T({TargetGroup, Radius, ActiveTimer, TargetCat})
|
||||||
|
|
||||||
|
local TDiff = 4
|
||||||
|
|
||||||
|
-- local function to switch off shorad again
|
||||||
|
local function SleepShorad(group)
|
||||||
|
if group and group:IsAlive() then
|
||||||
|
local groupname = group:GetName()
|
||||||
|
self.ActiveGroups[groupname] = nil
|
||||||
|
if self.UseEmOnOff then
|
||||||
|
group:EnableEmission(false)
|
||||||
|
else
|
||||||
|
group:OptionAlarmStateGreen()
|
||||||
|
end
|
||||||
|
group:SetProperty("SHORAD_ACTIVE",false)
|
||||||
|
local text = string.format("Sleeping SHORAD %s", group:GetName())
|
||||||
|
self:T(text)
|
||||||
|
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
||||||
|
--Shoot and Scoot
|
||||||
|
if self.shootandscoot then
|
||||||
|
self:__ShootAndScoot(1,group)
|
||||||
|
else
|
||||||
|
--group:RelocateGroundRandomInRadius(30,500,false,true,"Diamond",true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function WakeUp(_group,groupname)
|
||||||
|
-- shot at a group we protect
|
||||||
|
local text = string.format("Waking up SHORAD %s", _group:GetName())
|
||||||
|
self:T(text)
|
||||||
|
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
||||||
|
if self.UseEmOnOff then
|
||||||
|
_group:EnableEmission(true)
|
||||||
|
end
|
||||||
|
_group:OptionAlarmStateRed()
|
||||||
|
_group:SetProperty("SHORAD_ACTIVE",true)
|
||||||
|
self:_SmokeUnits(_group)
|
||||||
|
if self.ActiveGroups[groupname] == nil then -- no timer yet for this group
|
||||||
|
self.ActiveGroups[groupname] = { Timing = ActiveTimer }
|
||||||
|
local endtime = timer.getTime() + (ActiveTimer * math.random(75,100) / 100 ) -- randomize wakeup a bit
|
||||||
|
self.ActiveGroups[groupname].Timer = TIMER:New(SleepShorad,_group):Start(endtime)
|
||||||
|
--Shoot and Scoot
|
||||||
|
if self.shootandscoot then
|
||||||
|
self:__ShootAndScoot(TDiff,_group)
|
||||||
|
TDiff=TDiff+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local targetcat = TargetCat or Object.Category.UNIT
|
local targetcat = TargetCat or Object.Category.UNIT
|
||||||
local targetgroup = TargetGroup
|
local targetgroup = TargetGroup
|
||||||
local targetvec2 = nil
|
local targetvec2 = nil
|
||||||
@@ -541,70 +601,41 @@ do
|
|||||||
local groupset = self.Groupset --Core.Set#SET_GROUP
|
local groupset = self.Groupset --Core.Set#SET_GROUP
|
||||||
local shoradset = groupset:GetAliveSet() --#table
|
local shoradset = groupset:GetAliveSet() --#table
|
||||||
|
|
||||||
-- local function to switch off shorad again
|
|
||||||
local function SleepShorad(group)
|
|
||||||
if group and group:IsAlive() then
|
|
||||||
local groupname = group:GetName()
|
|
||||||
self.ActiveGroups[groupname] = nil
|
|
||||||
if self.UseEmOnOff then
|
|
||||||
group:EnableEmission(false)
|
|
||||||
else
|
|
||||||
group:OptionAlarmStateGreen()
|
|
||||||
end
|
|
||||||
local text = string.format("Sleeping SHORAD %s", group:GetName())
|
|
||||||
self:T(text)
|
|
||||||
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
|
||||||
--Shoot and Scoot
|
|
||||||
if self.shootandscoot then
|
|
||||||
self:__ShootAndScoot(1,group)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- go through set and find the one(s) to activate
|
-- go through set and find the one(s) to activate
|
||||||
local TDiff = 4
|
|
||||||
for _,_group in pairs (shoradset) do
|
for _,_group in pairs (shoradset) do
|
||||||
|
|
||||||
local groupname = _group:GetName()
|
local groupname = _group:GetName()
|
||||||
|
|
||||||
if groupname == TargetGroup and ShotAt==true then
|
if groupname == TargetGroup and ShotAt==true then
|
||||||
-- Shot at a SHORAD group
|
-- Shot at a SHORAD group
|
||||||
if self.UseEmOnOff then
|
local allow = false
|
||||||
_group:EnableEmission(false)
|
if self.CallBack and self.UseCallBack == true then
|
||||||
|
allow = self.CallBack:SeadAllowSuppression(_group,groupname)
|
||||||
end
|
end
|
||||||
_group:OptionAlarmStateGreen()
|
if allow == true then
|
||||||
self.ActiveGroups[groupname] = nil
|
if self.UseEmOnOff then
|
||||||
local text = string.format("Shot at SHORAD %s! Evading!", _group:GetName())
|
_group:EnableEmission(false)
|
||||||
self:T(text)
|
end
|
||||||
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
_group:OptionAlarmStateGreen()
|
||||||
self:_SmokeUnits(_group)
|
self.ActiveGroups[groupname] = nil
|
||||||
--Shoot and Scoot
|
local text = string.format("Shot at SHORAD %s! Evading!", _group:GetName())
|
||||||
if self.shootandscoot then
|
self:T(text)
|
||||||
self:__ShootAndScoot(1,_group)
|
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
||||||
end
|
self:_SmokeUnits(_group)
|
||||||
|
|
||||||
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)
|
|
||||||
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
|
|
||||||
if self.UseEmOnOff then
|
|
||||||
_group:EnableEmission(true)
|
|
||||||
end
|
|
||||||
_group:OptionAlarmStateRed()
|
|
||||||
self:_SmokeUnits(_group)
|
|
||||||
if self.ActiveGroups[groupname] == nil then -- no timer yet for this group
|
|
||||||
self.ActiveGroups[groupname] = { Timing = ActiveTimer }
|
|
||||||
local endtime = timer.getTime() + (ActiveTimer * math.random(75,100) / 100 ) -- randomize wakeup a bit
|
|
||||||
self.ActiveGroups[groupname].Timer = TIMER:New(SleepShorad,_group):Start(endtime)
|
|
||||||
--Shoot and Scoot
|
--Shoot and Scoot
|
||||||
if self.shootandscoot then
|
if self.shootandscoot then
|
||||||
self:__ShootAndScoot(TDiff,_group)
|
self:__ShootAndScoot(1,_group)
|
||||||
TDiff=TDiff+1
|
else
|
||||||
|
_group:RelocateGroundRandomInRadius(30,500,false,true,"Diamond",true)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
WakeUp(_group,groupname)
|
||||||
end
|
end
|
||||||
end
|
elseif _group:IsAnyInZone(targetzone) or groupname == TargetGroup then
|
||||||
end
|
WakeUp(_group,groupname)
|
||||||
|
end -- end if
|
||||||
|
end -- end in pairs
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -720,7 +751,7 @@ do
|
|||||||
-- @param Core.Event#EVENTDATA EventData The event details table data set
|
-- @param Core.Event#EVENTDATA EventData The event details table data set
|
||||||
-- @return #SHORAD self
|
-- @return #SHORAD self
|
||||||
function SHORAD:HandleEventShot( EventData )
|
function SHORAD:HandleEventShot( EventData )
|
||||||
self:T( { EventData } )
|
--self:T( { EventData.id } )
|
||||||
self:T(self.lid .. " HandleEventShot")
|
self:T(self.lid .. " HandleEventShot")
|
||||||
local ShootingWeapon = EventData.Weapon -- Identify the weapon fired
|
local ShootingWeapon = EventData.Weapon -- Identify the weapon fired
|
||||||
local ShootingWeaponName = EventData.WeaponName -- return weapon type
|
local ShootingWeaponName = EventData.WeaponName -- return weapon type
|
||||||
@@ -745,7 +776,7 @@ do
|
|||||||
-- Is there target data?
|
-- Is there target data?
|
||||||
if not targetdata or self.debug then
|
if not targetdata or self.debug then
|
||||||
if string.find(ShootingWeaponName,"AGM_88",1,true) then
|
if string.find(ShootingWeaponName,"AGM_88",1,true) then
|
||||||
self:I("**** Tracking AGM-88 with no target data.")
|
self:T("**** Tracking AGM-88 with no target data.")
|
||||||
local pos0 = EventData.IniUnit:GetCoordinate()
|
local pos0 = EventData.IniUnit:GetCoordinate()
|
||||||
local fheight = EventData.IniUnit:GetHeight()
|
local fheight = EventData.IniUnit:GetHeight()
|
||||||
self:__CalculateHitZone(20,ShootingWeapon,pos0,fheight,EventData.IniGroup)
|
self:__CalculateHitZone(20,ShootingWeapon,pos0,fheight,EventData.IniGroup)
|
||||||
|
|||||||
Reference in New Issue
Block a user