Skip to content

Commit

Permalink
Merge pull request #41 from walder/nasam
Browse files Browse the repository at this point in the history
added NASAM Suppport
  • Loading branch information
walder authored Jul 28, 2021
2 parents 39f2946 + 5923be4 commit 0d24891
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 9 deletions.
Binary file not shown.
28 changes: 26 additions & 2 deletions demo-missions/skynet-iads-compiled.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
env.info("--- SKYNET VERSION: 2.1.0 | BUILD TIME: 27.03.2021 2125Z ---")
env.info("--- SKYNET VERSION: 2.2.0 | BUILD TIME: 28.07.2021 1023Z ---")
do
--this file contains the required units per sam type
samTypesDB = {
Expand Down Expand Up @@ -194,7 +194,31 @@ samTypesDB = {
['NATO'] = 'Roland ADS',
},
['harm_detection_chance'] = 60
},
},

['NASAM'] = {
['type'] = 'complex',
['searchRadar'] = {
['NASAMS_Radar_MPQ64F1'] = {
},
},
['launchers'] = {
['NASAMS_LN_B'] = {
},
['NASAMS_LN_C'] = {
},
},

['name'] = {
['NATO'] = 'NASAM',
},
['misc'] = {
['NASAMS_Command_Post'] = {
['required'] = false,
},
},
},

['2S6 Tunguska'] = {
['type'] = 'single',
['searchRadar'] = {
Expand Down
Binary file modified demo-missions/skynet-test-persian-gulf -stress-test.miz
Binary file not shown.
Binary file modified demo-missions/skynet-test-persian-gulf.miz
Binary file not shown.
26 changes: 25 additions & 1 deletion skynet-iads-source/skynet-iads-supported-types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,31 @@ samTypesDB = {
['NATO'] = 'Roland ADS',
},
['harm_detection_chance'] = 60
},
},

['NASAM'] = {
['type'] = 'complex',
['searchRadar'] = {
['NASAMS_Radar_MPQ64F1'] = {
},
},
['launchers'] = {
['NASAMS_LN_B'] = {
},
['NASAMS_LN_C'] = {
},
},

['name'] = {
['NATO'] = 'NASAM',
},
['misc'] = {
['NASAMS_Command_Post'] = {
['required'] = false,
},
},
},

['2S6 Tunguska'] = {
['type'] = 'single',
['searchRadar'] = {
Expand Down
Binary file modified unit-tests/highdigitsams/highdigitsams-unit-tests.miz
Binary file not shown.
Binary file modified unit-tests/skynet-unit-tests.miz
Binary file not shown.
24 changes: 20 additions & 4 deletions unit-tests/test-skynet-iads-abstract-radar-element.lua
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ function TestSkynetIADSAbstractRadarElement:testCheckSA3GroupNumberOfLaunchersAn
self.samSite:analyseAndAddUnit(SkynetIADSSAMSearchRadar, array, unitData)
local searchRadar = array[1]
lu.assertEquals(#array, 1)
lu.assertEquals(searchRadar:getMaxRangeFindingTarget(), 106998.453125)
lu.assertEquals(searchRadar:getMaxRangeFindingTarget(), 53499.2265625)

array = {}
unitData = {
Expand All @@ -559,7 +559,8 @@ function TestSkynetIADSAbstractRadarElement:testCheckSA3GroupNumberOfLaunchersAn
}
self.samSite:analyseAndAddUnit(SkynetIADSSAMTrackingRadar, array, unitData)
local searchRadar = array[1]
lu.assertEquals(searchRadar:getMaxRangeFindingTarget(), 106998.453125)

lu.assertEquals(searchRadar:getMaxRangeFindingTarget(), 53499.2265625)

lu.assertEquals(#self.samSite:getLaunchers(), 1)
lu.assertEquals(#self.samSite:getSearchRadars(), 1)
Expand Down Expand Up @@ -1253,14 +1254,15 @@ function TestSkynetIADSAbstractRadarElement:testSA2InformOfContactTargetInRangeM
local searchRadar = self.samSite:getSearchRadars()[1]
lu.assertEquals(searchRadar:getTypeName(), 'p-19 s-125 sr')
local sensors = Unit.getByName('Unit #005'):getSensors()
lu.assertEquals(searchRadar:getMaxRangeFindingTarget(), 106998.453125)

lu.assertEquals(searchRadar:getMaxRangeFindingTarget(), 53499.2265625)

local launcher = self.samSite:getLaunchers()[1]
lu.assertEquals(launcher:getRange(), 40000)

local trackingRadar = self.samSite:getTrackingRadars()[1]
--in its current implementation the SA-2 tracking radar returns the values of the search radar, I presume its only a placeholder in DCS
lu.assertEquals(trackingRadar:getMaxRangeFindingTarget(), 106998.453125)
lu.assertEquals(trackingRadar:getMaxRangeFindingTarget(), 53499.2265625)

lu.assertEquals(self.samSite:isActive(), true)
lu.assertEquals(self.samSite:isTargetInRange(target), true)
Expand Down Expand Up @@ -1967,6 +1969,20 @@ Launcher:
lu.assertEquals(self.samSite:getLaunchers()[1]:getInitialNumberOfMissiles(), 10)
end

function TestSkynetIADSAbstractRadarElement:testNASAM()

self.samSiteName = "BLUE-SAM-NASAM"
self:setUp()
lu.assertEquals(self.samSite:getNatoName(), "NASAM")
lu.assertEquals(self.samSite:getRadars()[1]:getMaxRangeFindingTarget(), 26749.61328125)
lu.assertEquals(self.samSite:getLaunchers()[1]:getRange(), 57000)
lu.assertEquals(self.samSite:getLaunchers()[1]:getInitialNumberOfMissiles(), 6)

lu.assertEquals(self.samSite:getLaunchers()[2]:getRange(), 61000)
lu.assertEquals(self.samSite:getLaunchers()[2]:getInitialNumberOfMissiles(), 6)

end

function TestSkynetIADSAbstractRadarElement:testHQ7LauncherAndRadar()
--[[
HQ-7:
Expand Down
4 changes: 2 additions & 2 deletions unit-tests/test-skynet-iads-sam-site.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function TestSkynetIADSSAMSite:testSA2InformOfContactTargetNotInRange()
lu.assertEquals(self.samSite:isTargetInRange(target), false)
lu.assertEquals(self.samSite:isActive(), false)
end

--[[
function TestSkynetIADSSAMSite:testSA2InforOfContactInSearchRangeSAMSiteGoLiveWhenSetToSearchRange()
self.samSiteName = "test-SAM-SA-2-test"
self:setUp()
Expand All @@ -119,7 +119,7 @@ function TestSkynetIADSSAMSite:testSA2InforOfContactInSearchRangeSAMSiteGoLiveWh
lu.assertEquals(self.samSite:isActive(), true)
lu.assertEquals(self.samSite:isTargetInRange(target), true)
end

--]]
function TestSkynetIADSSAMSite:testSAMStaysActiveWhenInAutonomousMode()
self.samSiteName = "test-SAM-SA-2-test"
self:setUp()
Expand Down

0 comments on commit 0d24891

Please sign in to comment.