Update Skynet to 3.0.1

This commit is contained in:
Raffson 2022-11-07 20:58:03 +01:00
parent 810c202f1b
commit f7f4803fdc
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -1,4 +1,4 @@
env.info("--- SKYNET VERSION: 3.0.0 | BUILD TIME: 23.07.2022 1512Z ---") env.info("--- SKYNET VERSION: 3.0.1 | BUILD TIME: 06.11.2022 1728Z ---")
do do
--this file contains the required units per sam type --this file contains the required units per sam type
samTypesDB = { samTypesDB = {
@ -9,17 +9,17 @@ samTypesDB = {
['name'] = { ['name'] = {
['NATO'] = 'Tin Shield', ['NATO'] = 'Tin Shield',
}, },
}, },
['p-19 s-125 sr'] = { ['p-19 s-125 sr'] = {
['name'] = { ['name'] = {
['NATO'] = 'Flat Face', ['NATO'] = 'Flat Face',
}, },
}, },
}, },
['EWR P-37 BAR LOCK'] = { ['EWR P-37 BAR LOCK'] = {
['Name'] = { ['Name'] = {
['NATO'] = "Bar lock", ['NATO'] = "Bar lock",
}, },
}, },
['trackingRadar'] = { ['trackingRadar'] = {
['RPC_5N62V'] = { ['RPC_5N62V'] = {
@ -99,7 +99,7 @@ samTypesDB = {
['name'] = { ['name'] = {
['NATO'] = 'Flat Face', ['NATO'] = 'Flat Face',
}, },
}, },
}, },
['trackingRadar'] = { ['trackingRadar'] = {
['snr s-125 tr'] = { ['snr s-125 tr'] = {
@ -210,7 +210,7 @@ samTypesDB = {
}, },
['harm_detection_chance'] = 40 ['harm_detection_chance'] = 40
}, },
['Roland ADS'] = { ['Roland ADS'] = {
['type'] = 'single', ['type'] = 'single',
['searchRadar'] = { ['searchRadar'] = {
@ -226,7 +226,7 @@ samTypesDB = {
['NATO'] = 'Roland ADS', ['NATO'] = 'Roland ADS',
}, },
['harm_detection_chance'] = 60 ['harm_detection_chance'] = 60
}, },
['NASAMS'] = { ['NASAMS'] = {
['type'] = 'complex', ['type'] = 'complex',
['searchRadar'] = { ['searchRadar'] = {
@ -234,12 +234,12 @@ samTypesDB = {
}, },
}, },
['launchers'] = { ['launchers'] = {
['NASAMS_LN_B'] = { ['NASAMS_LN_B'] = {
}, },
['NASAMS_LN_C'] = { ['NASAMS_LN_C'] = {
}, },
}, },
['name'] = { ['name'] = {
['NATO'] = 'NASAMS', ['NATO'] = 'NASAMS',
}, },
@ -250,7 +250,7 @@ samTypesDB = {
}, },
['can_engage_harm'] = true, ['can_engage_harm'] = true,
['harm_detection_chance'] = 90 ['harm_detection_chance'] = 90
}, },
['2S6 Tunguska'] = { ['2S6 Tunguska'] = {
['type'] = 'single', ['type'] = 'single',
['searchRadar'] = { ['searchRadar'] = {
@ -264,7 +264,7 @@ samTypesDB = {
['name'] = { ['name'] = {
['NATO'] = 'SA-19 Grison', ['NATO'] = 'SA-19 Grison',
}, },
}, },
['Osa'] = { ['Osa'] = {
['type'] = 'single', ['type'] = 'single',
['searchRadar'] = { ['searchRadar'] = {
@ -273,14 +273,14 @@ samTypesDB = {
}, },
['launchers'] = { ['launchers'] = {
['Osa 9A33 ln'] = { ['Osa 9A33 ln'] = {
}, },
}, },
['name'] = { ['name'] = {
['NATO'] = 'SA-8 Gecko', ['NATO'] = 'SA-8 Gecko',
}, },
['harm_detection_chance'] = 20 ['harm_detection_chance'] = 20
}, },
['Strela-10M3'] = { ['Strela-10M3'] = {
['type'] = 'single', ['type'] = 'single',
['searchRadar'] = { ['searchRadar'] = {
@ -295,7 +295,7 @@ samTypesDB = {
['name'] = { ['name'] = {
['NATO'] = 'SA-13 Gopher', ['NATO'] = 'SA-13 Gopher',
}, },
}, },
['Strela-1 9P31'] = { ['Strela-1 9P31'] = {
['type'] = 'single', ['type'] = 'single',
['searchRadar'] = { ['searchRadar'] = {
@ -326,7 +326,7 @@ samTypesDB = {
}, },
['harm_detection_chance'] = 90, ['harm_detection_chance'] = 90,
['can_engage_harm'] = true ['can_engage_harm'] = true
}, },
['Gepard'] = { ['Gepard'] = {
['type'] = 'single', ['type'] = 'single',
@ -342,7 +342,7 @@ samTypesDB = {
['NATO'] = 'Gepard', ['NATO'] = 'Gepard',
}, },
['harm_detection_chance'] = 10 ['harm_detection_chance'] = 10
}, },
['Rapier'] = { ['Rapier'] = {
['searchRadar'] = { ['searchRadar'] = {
['rapier_fsa_blindfire_radar'] = { ['rapier_fsa_blindfire_radar'] = {
@ -362,7 +362,7 @@ samTypesDB = {
['NATO'] = 'Rapier', ['NATO'] = 'Rapier',
}, },
['harm_detection_chance'] = 10 ['harm_detection_chance'] = 10
}, },
['ZSU-23-4 Shilka'] = { ['ZSU-23-4 Shilka'] = {
['type'] = 'single', ['type'] = 'single',
['searchRadar'] = { ['searchRadar'] = {
@ -440,7 +440,7 @@ samTypesDB = {
}, },
['harm_detection_chance'] = 60 ['harm_detection_chance'] = 60
}, },
} }
end end
do do
@ -474,7 +474,7 @@ samTypesDB['S-300PMU1'] = {
['searchRadar'] = { ['searchRadar'] = {
['S-300PMU1 40B6MD sr'] = s300PMU140B6MDsr, ['S-300PMU1 40B6MD sr'] = s300PMU140B6MDsr,
['S-300PMU1 64N6E sr'] = s300PMU164N6Esr, ['S-300PMU1 64N6E sr'] = s300PMU164N6Esr,
['S-300PS 40B6MD sr'] = { ['S-300PS 40B6MD sr'] = {
['name'] = { ['name'] = {
['NATO'] = '', ['NATO'] = '',
@ -520,7 +520,7 @@ samTypesDB['S-300PMU1'] = {
}, },
['harm_detection_chance'] = 90, ['harm_detection_chance'] = 90,
['can_engage_harm'] = true ['can_engage_harm'] = true
} }
--[[ Units in the SA-23 Group: --[[ Units in the SA-23 Group:
2020-12-11 16:40:52.072 INFO SCRIPTING: S-300VM 9A82ME ln 2020-12-11 16:40:52.072 INFO SCRIPTING: S-300VM 9A82ME ln
@ -565,7 +565,7 @@ samTypesDB['S-300VM'] = {
}, },
['harm_detection_chance'] = 90, ['harm_detection_chance'] = 90,
['can_engage_harm'] = true ['can_engage_harm'] = true
} }
--[[ Units in the SA-10B Group: --[[ Units in the SA-10B Group:
2021-01-01 20:39:14.413 INFO SCRIPTING: S-300PS SA-10B 40B6MD MAST sr 2021-01-01 20:39:14.413 INFO SCRIPTING: S-300PS SA-10B 40B6MD MAST sr
@ -595,9 +595,9 @@ samTypesDB['S-300PS'] = {
['S-300PS 40B6M tr'] = { ['S-300PS 40B6M tr'] = {
}, },
['S-300PMU1 40B6M tr'] = { ['S-300PMU1 40B6M tr'] = {
}, },
['S-300PMU1 30N6E tr'] = { ['S-300PMU1 30N6E tr'] = {
}, },
}, },
['misc'] = { ['misc'] = {
['S-300PS SA-10B 54K6 cp'] = { ['S-300PS SA-10B 54K6 cp'] = {
@ -745,12 +745,12 @@ samTypesDB['S-300PMU2'] = {
}, },
['S-300PMU1 40B6MD sr'] = s300PMU140B6MDsr, ['S-300PMU1 40B6MD sr'] = s300PMU140B6MDsr,
['S-300PMU1 64N6E sr'] = s300PMU164N6Esr, ['S-300PMU1 64N6E sr'] = s300PMU164N6Esr,
['S-300PS 40B6MD sr'] = { ['S-300PS 40B6MD sr'] = {
['name'] = { ['name'] = {
['NATO'] = '', ['NATO'] = '',
}, },
}, },
['S-300PS 64H6E sr'] = { ['S-300PS 64H6E sr'] = {
['name'] = { ['name'] = {
['NATO'] = '', ['NATO'] = '',
@ -843,18 +843,18 @@ function SkynetIADSLogger:printEarlyWarningRadarStatus()
local connectionNodes = ewRadar:getConnectionNodes() local connectionNodes = ewRadar:getConnectionNodes()
local firstRadar = nil local firstRadar = nil
local radars = ewRadar:getRadars() local radars = ewRadar:getRadars()
--get the first existing radar to prevent issues in calculating the distance later on: --get the first existing radar to prevent issues in calculating the distance later on:
for i = 1, #radars do for i = 1, #radars do
if radars[i]:isExist() then if radars[i]:isExist() then
firstRadar = radars[i] firstRadar = radars[i]
break break
end end
end end
local numDamagedConnectionNodes = 0 local numDamagedConnectionNodes = 0
for j = 1, #connectionNodes do for j = 1, #connectionNodes do
local connectionNode = connectionNodes[j] local connectionNode = connectionNodes[j]
if connectionNode:isExist() == false then if connectionNode:isExist() == false then
@ -862,7 +862,7 @@ function SkynetIADSLogger:printEarlyWarningRadarStatus()
end end
end end
local intactConnectionNodes = numConnectionNodes - numDamagedConnectionNodes local intactConnectionNodes = numConnectionNodes - numDamagedConnectionNodes
local powerSources = ewRadar:getPowerSources() local powerSources = ewRadar:getPowerSources()
local numDamagedPowerSources = 0 local numDamagedPowerSources = 0
for j = 1, #powerSources do for j = 1, #powerSources do
@ -871,17 +871,17 @@ function SkynetIADSLogger:printEarlyWarningRadarStatus()
numDamagedPowerSources = numDamagedPowerSources + 1 numDamagedPowerSources = numDamagedPowerSources + 1
end end
end end
local intactPowerSources = numPowerSources - numDamagedPowerSources local intactPowerSources = numPowerSources - numDamagedPowerSources
local detectedTargets = ewRadar:getDetectedTargets() local detectedTargets = ewRadar:getDetectedTargets()
local samSitesInCoveredArea = ewRadar:getChildRadars() local samSitesInCoveredArea = ewRadar:getChildRadars()
local unitName = "DESTROYED" local unitName = "DESTROYED"
if ewRadar:getDCSRepresentation():isExist() then if ewRadar:getDCSRepresentation():isExist() then
unitName = ewRadar:getDCSName() unitName = ewRadar:getDCSName()
end end
self:printOutputToLog("UNIT: "..unitName.." | TYPE: "..ewRadar:getNatoName()) self:printOutputToLog("UNIT: "..unitName.." | TYPE: "..ewRadar:getNatoName())
self:printOutputToLog("ACTIVE: "..tostring(isActive).."| DETECTED TARGETS: "..#detectedTargets.." | DEFENDING HARM: "..tostring(ewRadar:isDefendingHARM())) self:printOutputToLog("ACTIVE: "..tostring(isActive).."| DETECTED TARGETS: "..#detectedTargets.." | DEFENDING HARM: "..tostring(ewRadar:isDefendingHARM()))
if numConnectionNodes > 0 then if numConnectionNodes > 0 then
@ -894,13 +894,13 @@ function SkynetIADSLogger:printEarlyWarningRadarStatus()
else else
self:printOutputToLog("NO POWER SOURCES SET") self:printOutputToLog("NO POWER SOURCES SET")
end end
self:printOutputToLog("SAM SITES IN COVERED AREA: "..#samSitesInCoveredArea) self:printOutputToLog("SAM SITES IN COVERED AREA: "..#samSitesInCoveredArea)
for j = 1, #samSitesInCoveredArea do for j = 1, #samSitesInCoveredArea do
local samSiteCovered = samSitesInCoveredArea[j] local samSiteCovered = samSitesInCoveredArea[j]
self:printOutputToLog(samSiteCovered:getDCSName()) self:printOutputToLog(samSiteCovered:getDCSName())
end end
for j = 1, #detectedTargets do for j = 1, #detectedTargets do
local contact = detectedTargets[j] local contact = detectedTargets[j]
if firstRadar ~= nil and firstRadar:isExist() then if firstRadar ~= nil and firstRadar:isExist() then
@ -908,9 +908,9 @@ function SkynetIADSLogger:printEarlyWarningRadarStatus()
self:printOutputToLog("CONTACT: "..contact:getName().." | TYPE: "..contact:getTypeName().." | DISTANCE NM: "..distance) self:printOutputToLog("CONTACT: "..contact:getName().." | TYPE: "..contact:getTypeName().." | DISTANCE NM: "..distance)
end end
end end
self:printOutputToLog("---------------------------------------------------") self:printOutputToLog("---------------------------------------------------")
end end
end end
@ -932,7 +932,7 @@ end
function SkynetIADSLogger:printSAMSiteStatus() function SkynetIADSLogger:printSAMSiteStatus()
local samSites = self.iads:getSAMSites() local samSites = self.iads:getSAMSites()
self:printOutputToLog("------------------------------------------ SAM STATUS: "..self.iads:getCoalitionString().." -------------------------------") self:printOutputToLog("------------------------------------------ SAM STATUS: "..self.iads:getCoalitionString().." -------------------------------")
for i = 1, #samSites do for i = 1, #samSites do
local samSite = samSites[i] local samSite = samSites[i]
@ -940,7 +940,7 @@ function SkynetIADSLogger:printSAMSiteStatus()
local numPowerSources = #samSite:getPowerSources() local numPowerSources = #samSite:getPowerSources()
local isAutonomous = samSite:getAutonomousState() local isAutonomous = samSite:getAutonomousState()
local isActive = samSite:isActive() local isActive = samSite:isActive()
local connectionNodes = samSite:getConnectionNodes() local connectionNodes = samSite:getConnectionNodes()
local firstRadar = samSite:getRadars()[1] local firstRadar = samSite:getRadars()[1]
local numDamagedConnectionNodes = 0 local numDamagedConnectionNodes = 0
@ -951,7 +951,7 @@ function SkynetIADSLogger:printSAMSiteStatus()
end end
end end
local intactConnectionNodes = numConnectionNodes - numDamagedConnectionNodes local intactConnectionNodes = numConnectionNodes - numDamagedConnectionNodes
local powerSources = samSite:getPowerSources() local powerSources = samSite:getPowerSources()
local numDamagedPowerSources = 0 local numDamagedPowerSources = 0
for j = 1, #powerSources do for j = 1, #powerSources do
@ -960,21 +960,21 @@ function SkynetIADSLogger:printSAMSiteStatus()
numDamagedPowerSources = numDamagedPowerSources + 1 numDamagedPowerSources = numDamagedPowerSources + 1
end end
end end
local intactPowerSources = numPowerSources - numDamagedPowerSources local intactPowerSources = numPowerSources - numDamagedPowerSources
local detectedTargets = samSite:getDetectedTargets() local detectedTargets = samSite:getDetectedTargets()
local samSitesInCoveredArea = samSite:getChildRadars() local samSitesInCoveredArea = samSite:getChildRadars()
local engageAirWeapons = samSite:getCanEngageAirWeapons() local engageAirWeapons = samSite:getCanEngageAirWeapons()
local engageHARMS = samSite:getCanEngageHARM() local engageHARMS = samSite:getCanEngageHARM()
local hasAmmo = samSite:hasRemainingAmmo() local hasAmmo = samSite:hasRemainingAmmo()
self:printOutputToLog("GROUP: "..samSite:getDCSName().." | TYPE: "..samSite:getNatoName()) self:printOutputToLog("GROUP: "..samSite:getDCSName().." | TYPE: "..samSite:getNatoName())
self:printOutputToLog("ACTIVE: "..tostring(isActive).." | AUTONOMOUS: "..tostring(isAutonomous).." | IS ACTING AS EW: "..tostring(samSite:getActAsEW()).." | CAN ENGAGE AIR WEAPONS : "..tostring(engageAirWeapons).." | CAN ENGAGE HARMS : "..tostring(engageHARMS).." | HAS AMMO: "..tostring(hasAmmo).." | DETECTED TARGETS: "..#detectedTargets.." | DEFENDING HARM: "..tostring(samSite:isDefendingHARM()).." | MISSILES IN FLIGHT: "..tostring(samSite:getNumberOfMissilesInFlight())) self:printOutputToLog("ACTIVE: "..tostring(isActive).." | AUTONOMOUS: "..tostring(isAutonomous).." | IS ACTING AS EW: "..tostring(samSite:getActAsEW()).." | CAN ENGAGE AIR WEAPONS : "..tostring(engageAirWeapons).." | CAN ENGAGE HARMS : "..tostring(engageHARMS).." | HAS AMMO: "..tostring(hasAmmo).." | DETECTED TARGETS: "..#detectedTargets.." | DEFENDING HARM: "..tostring(samSite:isDefendingHARM()).." | MISSILES IN FLIGHT: "..tostring(samSite:getNumberOfMissilesInFlight()))
if numConnectionNodes > 0 then if numConnectionNodes > 0 then
self:printOutputToLog("CONNECTION NODES: "..numConnectionNodes.." | DAMAGED: "..numDamagedConnectionNodes.." | INTACT: "..intactConnectionNodes) self:printOutputToLog("CONNECTION NODES: "..numConnectionNodes.." | DAMAGED: "..numDamagedConnectionNodes.." | INTACT: "..intactConnectionNodes)
else else
@ -985,13 +985,13 @@ function SkynetIADSLogger:printSAMSiteStatus()
else else
self:printOutputToLog("NO POWER SOURCES SET") self:printOutputToLog("NO POWER SOURCES SET")
end end
self:printOutputToLog("SAM SITES IN COVERED AREA: "..#samSitesInCoveredArea) self:printOutputToLog("SAM SITES IN COVERED AREA: "..#samSitesInCoveredArea)
for j = 1, #samSitesInCoveredArea do for j = 1, #samSitesInCoveredArea do
local samSiteCovered = samSitesInCoveredArea[j] local samSiteCovered = samSitesInCoveredArea[j]
self:printOutputToLog(samSiteCovered:getDCSName()) self:printOutputToLog(samSiteCovered:getDCSName())
end end
for j = 1, #detectedTargets do for j = 1, #detectedTargets do
local contact = detectedTargets[j] local contact = detectedTargets[j]
if firstRadar ~= nil and firstRadar:isExist() then if firstRadar ~= nil and firstRadar:isExist() then
@ -999,7 +999,7 @@ function SkynetIADSLogger:printSAMSiteStatus()
self:printOutputToLog("CONTACT: "..contact:getName().." | TYPE: "..contact:getTypeName().." | DISTANCE NM: "..distance) self:printOutputToLog("CONTACT: "..contact:getName().." | TYPE: "..contact:getTypeName().." | DISTANCE NM: "..distance)
end end
end end
self:printOutputToLog("---------------------------------------------------") self:printOutputToLog("---------------------------------------------------")
end end
end end
@ -1007,7 +1007,7 @@ end
function SkynetIADSLogger:printCommandCenterStatus() function SkynetIADSLogger:printCommandCenterStatus()
local commandCenters = self.iads:getCommandCenters() local commandCenters = self.iads:getCommandCenters()
self:printOutputToLog("------------------------------------------ COMMAND CENTER STATUS: "..self.iads:getCoalitionString().." -------------------------------") self:printOutputToLog("------------------------------------------ COMMAND CENTER STATUS: "..self.iads:getCoalitionString().." -------------------------------")
for i = 1, #commandCenters do for i = 1, #commandCenters do
local commandCenter = commandCenters[i] local commandCenter = commandCenters[i]
local numConnectionNodes = #commandCenter:getConnectionNodes() local numConnectionNodes = #commandCenter:getConnectionNodes()
@ -1028,13 +1028,13 @@ function SkynetIADSLogger:printCommandCenterStatus()
end end
end end
function SkynetIADSLogger:printSystemStatus() function SkynetIADSLogger:printSystemStatus()
if self:getDebugSettings().IADSStatus or self:getDebugSettings().contacts then if self:getDebugSettings().IADSStatus or self:getDebugSettings().contacts then
local coalitionStr = self.iads:getCoalitionString() local coalitionStr = self.iads:getCoalitionString()
self:printOutput("---- IADS: "..coalitionStr.." ------") self:printOutput("---- IADS: "..coalitionStr.." ------")
end end
if self:getDebugSettings().IADSStatus then if self:getDebugSettings().IADSStatus then
local commandCenters = self.iads:getCommandCenters() local commandCenters = self.iads:getCommandCenters()
@ -1055,12 +1055,12 @@ function SkynetIADSLogger:printSystemStatus()
numIntactComCenters = numIntactComCenters + 1 numIntactComCenters = numIntactComCenters + 1
end end
end end
numDestroyedComCenters = numComCenters - numIntactComCenters numDestroyedComCenters = numComCenters - numIntactComCenters
self:printOutput("COMMAND CENTERS: "..numComCenters.." | Destroyed: "..numDestroyedComCenters.." | NoPowr: "..numComCentersNoPower.." | NoCon: "..numComCentersNoConnectionNode) self:printOutput("COMMAND CENTERS: "..numComCenters.." | Destroyed: "..numDestroyedComCenters.." | NoPowr: "..numComCentersNoPower.." | NoCon: "..numComCentersNoConnectionNode)
local ewNoPower = 0 local ewNoPower = 0
local earlyWarningRadars = self.iads:getEarlyWarningRadars() local earlyWarningRadars = self.iads:getEarlyWarningRadars()
local ewTotal = #earlyWarningRadars local ewTotal = #earlyWarningRadars
@ -1080,11 +1080,11 @@ function SkynetIADSLogger:printSystemStatus()
ewActive = ewActive + 1 ewActive = ewActive + 1
end end
end end
ewRadarsInactive = ewTotal - ewActive ewRadarsInactive = ewTotal - ewActive
local numEWRadarsDestroyed = #self.iads:getDestroyedEarlyWarningRadars() local numEWRadarsDestroyed = #self.iads:getDestroyedEarlyWarningRadars()
self:printOutput("EW: "..ewTotal.." | On: "..ewActive.." | Off: "..ewRadarsInactive.." | Destroyed: "..numEWRadarsDestroyed.." | NoPowr: "..ewNoPower.." | NoCon: "..ewNoConnectionNode) self:printOutput("EW: "..ewTotal.." | On: "..ewActive.." | Off: "..ewRadarsInactive.." | Destroyed: "..numEWRadarsDestroyed.." | NoPowr: "..ewNoPower.." | NoCon: "..ewNoConnectionNode)
local samSitesInactive = 0 local samSitesInactive = 0
local samSitesActive = 0 local samSitesActive = 0
local samSites = self.iads:getSAMSites() local samSites = self.iads:getSAMSites()
@ -1115,11 +1115,11 @@ function SkynetIADSLogger:printSystemStatus()
samSiteRadarDestroyed = samSiteRadarDestroyed + 1 samSiteRadarDestroyed = samSiteRadarDestroyed + 1
end end
end end
samSitesInactive = samSitesTotal - samSitesActive samSitesInactive = samSitesTotal - samSitesActive
self:printOutput("SAM: "..samSitesTotal.." | On: "..samSitesActive.." | Off: "..samSitesInactive.." | Autonm: "..samSiteAutonomous.." | Raddest: "..samSiteRadarDestroyed.." | NoPowr: "..samSitesNoPower.." | NoCon: "..samSitesNoConnectionNode.." | NoAmmo: "..samSitesOutOfAmmo) self:printOutput("SAM: "..samSitesTotal.." | On: "..samSitesActive.." | Off: "..samSitesInactive.." | Autonm: "..samSiteAutonomous.." | Raddest: "..samSiteRadarDestroyed.." | NoPowr: "..samSitesNoPower.." | NoCon: "..samSitesNoConnectionNode.." | NoAmmo: "..samSitesOutOfAmmo)
end end
if self:getDebugSettings().contacts then if self:getDebugSettings().contacts then
local contacts = self.iads:getContacts() local contacts = self.iads:getContacts()
if contacts then if contacts then
@ -1129,7 +1129,7 @@ function SkynetIADSLogger:printSystemStatus()
end end
end end
end end
if self:getDebugSettings().commandCenterStatusEnvOutput then if self:getDebugSettings().commandCenterStatusEnvOutput then
self:printCommandCenterStatus() self:printCommandCenterStatus()
end end
@ -1137,7 +1137,7 @@ function SkynetIADSLogger:printSystemStatus()
if self:getDebugSettings().earlyWarningRadarStatusEnvOutput then if self:getDebugSettings().earlyWarningRadarStatusEnvOutput then
self:printEarlyWarningRadarStatus() self:printEarlyWarningRadarStatus()
end end
if self:getDebugSettings().samSiteStatusEnvOutput then if self:getDebugSettings().samSiteStatusEnvOutput then
self:printSAMSiteStatus() self:printSAMSiteStatus()
end end
@ -1223,7 +1223,7 @@ function SkynetIADS:getUsableEarlyWarningRadars()
return self:getUsableAbstractRadarElemtentsOfTable(self.earlyWarningRadars) return self:getUsableAbstractRadarElemtentsOfTable(self.earlyWarningRadars)
end end
function SkynetIADS:createTableDelegator(units) function SkynetIADS:createTableDelegator(units)
local sites = SkynetIADSTableDelegator:create() local sites = SkynetIADSTableDelegator:create()
for i = 1, #units do for i = 1, #units do
local site = units[i] local site = units[i]
@ -1261,7 +1261,7 @@ function SkynetIADS:addEarlyWarningRadar(earlyWarningRadarUnitName)
ewRadar = SkynetIADSEWRadar:create(earlyWarningRadarUnit, self) ewRadar = SkynetIADSEWRadar:create(earlyWarningRadarUnit, self)
end end
ewRadar:setupElements() ewRadar:setupElements()
ewRadar:setCachedTargetsMaxAge(self:getCachedTargetsMaxAge()) ewRadar:setCachedTargetsMaxAge(self:getCachedTargetsMaxAge())
-- for performance improvement, if iads is not scanning no update coverage update needs to be done, will be executed once when iads activates -- for performance improvement, if iads is not scanning no update coverage update needs to be done, will be executed once when iads activates
if self.ewRadarScanMistTaskID ~= nil then if self.ewRadarScanMistTaskID ~= nil then
self:buildRadarCoverageForEarlyWarningRadar(ewRadar) self:buildRadarCoverageForEarlyWarningRadar(ewRadar)
@ -1352,7 +1352,7 @@ function SkynetIADS:addSAMSite(samSiteName)
self:buildRadarCoverageForSAMSite(samSite) self:buildRadarCoverageForSAMSite(samSite)
end end
return samSite return samSite
end end
end end
function SkynetIADS:getUsableSAMSites() function SkynetIADS:getUsableSAMSites()
@ -1432,7 +1432,7 @@ function SkynetIADS.evaluateContacts(self)
local ewRadars = self:getUsableEarlyWarningRadars() local ewRadars = self:getUsableEarlyWarningRadars()
local samSites = self:getUsableSAMSites() local samSites = self:getUsableSAMSites()
--will add SAM Sites acting as EW Rardars to the ewRadars array: --will add SAM Sites acting as EW Rardars to the ewRadars array:
for i = 1, #samSites do for i = 1, #samSites do
local samSite = samSites[i] local samSite = samSites[i]
@ -1452,7 +1452,7 @@ function SkynetIADS.evaluateContacts(self)
end end
local samSitesToTrigger = {} local samSitesToTrigger = {}
for i = 1, #ewRadars do for i = 1, #ewRadars do
local ewRadar = ewRadars[i] local ewRadar = ewRadars[i]
--call go live in case ewRadar had to shut down (HARM attack) --call go live in case ewRadar had to shut down (HARM attack)
@ -1480,7 +1480,7 @@ function SkynetIADS.evaluateContacts(self)
end end
self:cleanAgedTargets() self:cleanAgedTargets()
for samName, samToTrigger in pairs(samSitesToTrigger) do for samName, samToTrigger in pairs(samSitesToTrigger) do
for j = 1, #self.contacts do for j = 1, #self.contacts do
local contact = self.contacts[j] local contact = self.contacts[j]
@ -1493,15 +1493,15 @@ function SkynetIADS.evaluateContacts(self)
end end
end end
end end
for i = 1, #samSites do for i = 1, #samSites do
local samSite = samSites[i] local samSite = samSites[i]
samSite:targetCycleUpdateEnd() samSite:targetCycleUpdateEnd()
end end
self.harmDetection:setContacts(self:getContacts()) self.harmDetection:setContacts(self:getContacts())
self.harmDetection:evaluateContacts() self.harmDetection:evaluateContacts()
self.logger:printSystemStatus() self.logger:printSystemStatus()
end end
@ -1521,12 +1521,12 @@ function SkynetIADS:getAbstracRadarElements()
local abstractRadarElements = {} local abstractRadarElements = {}
local ewRadars = self:getEarlyWarningRadars() local ewRadars = self:getEarlyWarningRadars()
local samSites = self:getSAMSites() local samSites = self:getSAMSites()
for i = 1, #ewRadars do for i = 1, #ewRadars do
local ewRadar = ewRadars[i] local ewRadar = ewRadars[i]
table.insert(abstractRadarElements, ewRadar) table.insert(abstractRadarElements, ewRadar)
end end
for i = 1, #samSites do for i = 1, #samSites do
local samSite = samSites[i] local samSite = samSites[i]
table.insert(abstractRadarElements, samSite) table.insert(abstractRadarElements, samSite)
@ -1542,8 +1542,8 @@ function SkynetIADS:addRadarsToCommandCenters()
for i = 1, #comCenters do for i = 1, #comCenters do
local comCenter = comCenters[i] local comCenter = comCenters[i]
comCenter:clearChildRadars() comCenter:clearChildRadars()
end end
-- then we add child radars to the command centers -- then we add child radars to the command centers
local abstractRadarElements = self:getAbstracRadarElements() local abstractRadarElements = self:getAbstracRadarElements()
for i = 1, #abstractRadarElements do for i = 1, #abstractRadarElements do
@ -1557,39 +1557,39 @@ function SkynetIADS:addSingleRadarToCommandCenters(abstractRadarElement)
for i = 1, #comCenters do for i = 1, #comCenters do
local comCenter = comCenters[i] local comCenter = comCenters[i]
comCenter:addChildRadar(abstractRadarElement) comCenter:addChildRadar(abstractRadarElement)
end end
end end
-- this method rebuilds the radar coverage of the IADS, a complete rebuild is only required the first time the IADS is activated -- this method rebuilds the radar coverage of the IADS, a complete rebuild is only required the first time the IADS is activated
-- during runtime it is sufficient to call buildRadarCoverageForSAMSite or buildRadarCoverageForEarlyWarningRadar method that just updates the IADS for one unit, this saves script execution time -- during runtime it is sufficient to call buildRadarCoverageForSAMSite or buildRadarCoverageForEarlyWarningRadar method that just updates the IADS for one unit, this saves script execution time
function SkynetIADS:buildRadarCoverage() function SkynetIADS:buildRadarCoverage()
--to build the basic radar coverage we use all SAM sites. Checks if SAM site has power or a connection node is done when using the SAM site later on --to build the basic radar coverage we use all SAM sites. Checks if SAM site has power or a connection node is done when using the SAM site later on
local samSites = self:getSAMSites() local samSites = self:getSAMSites()
--first we clear all child and parent radars that may have been added previously --first we clear all child and parent radars that may have been added previously
for i = 1, #samSites do for i = 1, #samSites do
local samSite = samSites[i] local samSite = samSites[i]
samSite:clearChildRadars() samSite:clearChildRadars()
samSite:clearParentRadars() samSite:clearParentRadars()
end end
local ewRadars = self:getEarlyWarningRadars() local ewRadars = self:getEarlyWarningRadars()
for i = 1, #ewRadars do for i = 1, #ewRadars do
local ewRadar = ewRadars[i] local ewRadar = ewRadars[i]
ewRadar:clearChildRadars() ewRadar:clearChildRadars()
end end
--then we rebuild the radar coverage --then we rebuild the radar coverage
local abstractRadarElements = self:getAbstracRadarElements() local abstractRadarElements = self:getAbstracRadarElements()
for i = 1, #abstractRadarElements do for i = 1, #abstractRadarElements do
local abstract = abstractRadarElements[i] local abstract = abstractRadarElements[i]
self:buildRadarCoverageForAbstractRadarElement(abstract) self:buildRadarCoverageForAbstractRadarElement(abstract)
end end
self:addRadarsToCommandCenters() self:addRadarsToCommandCenters()
--we call this once on all sam sites, to make sure autonomous sites go live when IADS activates --we call this once on all sam sites, to make sure autonomous sites go live when IADS activates
for i = 1, #samSites do for i = 1, #samSites do
local samSite = samSites[i] local samSite = samSites[i]
@ -1711,7 +1711,7 @@ function SkynetIADS:deactivateEarlyWarningRadars()
local ewRadar = self.earlyWarningRadars[i] local ewRadar = self.earlyWarningRadars[i]
ewRadar:cleanUp() ewRadar:cleanUp()
end end
end end
function SkynetIADS:addRadioMenu() function SkynetIADS:addRadioMenu()
self.radioMenu = missionCommands.addSubMenu('SKYNET IADS '..self:getCoalitionString()) self.radioMenu = missionCommands.addSubMenu('SKYNET IADS '..self:getCoalitionString())
@ -1743,11 +1743,11 @@ function SkynetIADS:getCoalitionString()
elseif self.coalitionID == coalition.side.NEUTRAL then elseif self.coalitionID == coalition.side.NEUTRAL then
coalitionStr = "NEUTRAL" coalitionStr = "NEUTRAL"
end end
if self.name then if self.name then
coalitionStr = "COALITION: "..coalitionStr.." | NAME: "..self.name coalitionStr = "COALITION: "..coalitionStr.." | NAME: "..self.name
end end
return coalitionStr return coalitionStr
end end
@ -1813,17 +1813,17 @@ function SkynetMooseA2ADispatcherConnector:getSAMSiteGroupNames()
end end
function SkynetMooseA2ADispatcherConnector:update() function SkynetMooseA2ADispatcherConnector:update()
--mooseGroup elements are type of: --mooseGroup elements are type of:
--https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Set.html##(SET_GROUP) --https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Set.html##(SET_GROUP)
--remove previously set group names: --remove previously set group names:
for i = 1, #self.mooseGroups do for i = 1, #self.mooseGroups do
local mooseGroup = self.mooseGroups[i] local mooseGroup = self.mooseGroups[i]
mooseGroup:RemoveGroupsByName(self.ewRadarGroupNames) mooseGroup:RemoveGroupsByName(self.ewRadarGroupNames)
mooseGroup:RemoveGroupsByName(self.samSiteGroupNames) mooseGroup:RemoveGroupsByName(self.samSiteGroupNames)
end end
--add group names of IADS radars that are currently usable by the IADS: --add group names of IADS radars that are currently usable by the IADS:
for i = 1, #self.mooseGroups do for i = 1, #self.mooseGroups do
local mooseGroup = self.mooseGroups[i] local mooseGroup = self.mooseGroups[i]
@ -2078,12 +2078,12 @@ end
--placeholder method, can be implemented by subclasses --placeholder method, can be implemented by subclasses
function SkynetIADSAbstractElement:weaponFired(event) function SkynetIADSAbstractElement:weaponFired(event)
end end
--placeholder method, can be implemented by subclasses --placeholder method, can be implemented by subclasses
function SkynetIADSAbstractElement:goDark() function SkynetIADSAbstractElement:goDark()
end end
--placeholder method, can be implemented by subclasses --placeholder method, can be implemented by subclasses
@ -2098,7 +2098,7 @@ end
--placeholder method, can be implemented by subclasses --placeholder method, can be implemented by subclasses
function SkynetIADSAbstractElement:informChildrenOfStateChange() function SkynetIADSAbstractElement:informChildrenOfStateChange()
end end
end end
@ -2244,7 +2244,7 @@ function SkynetIADSAbstractRadarElement:getUsableChildRadars()
if childRadar:hasWorkingPowerSource() and childRadar:hasActiveConnectionNode() then if childRadar:hasWorkingPowerSource() and childRadar:hasActiveConnectionNode() then
table.insert(usableRadars, childRadar) table.insert(usableRadars, childRadar)
end end
end end
return usableRadars return usableRadars
end end
@ -2329,7 +2329,7 @@ function SkynetIADSAbstractRadarElement:hasEnoughLaunchersToEngageMissiles(minNu
local launchers = self:getLaunchers() local launchers = self:getLaunchers()
if(launchers ~= nil) then if(launchers ~= nil) then
launchers = #self:getLaunchers() launchers = #self:getLaunchers()
else else
launchers = 0 launchers = 0
end end
return self:hasRequiredNumberOfMissiles(minNumberOfLaunchers, launchers) return self:hasRequiredNumberOfMissiles(minNumberOfLaunchers, launchers)
@ -2339,7 +2339,7 @@ function SkynetIADSAbstractRadarElement:pointDefencesHaveEnoughLaunchers(minNumb
local numOfLaunchers = 0 local numOfLaunchers = 0
for i = 1, #self.pointDefences do for i = 1, #self.pointDefences do
local pointDefence = self.pointDefences[i] local pointDefence = self.pointDefences[i]
numOfLaunchers = numOfLaunchers + #pointDefence:getLaunchers() numOfLaunchers = numOfLaunchers + #pointDefence:getLaunchers()
end end
return self:hasRequiredNumberOfMissiles(minNumberOfLaunchers, numOfLaunchers) return self:hasRequiredNumberOfMissiles(minNumberOfLaunchers, numOfLaunchers)
end end
@ -2378,7 +2378,7 @@ end
function SkynetIADSAbstractRadarElement:getActAsEW() function SkynetIADSAbstractRadarElement:getActAsEW()
return self.actAsEW return self.actAsEW
end end
function SkynetIADSAbstractRadarElement:setActAsEW(ewState) function SkynetIADSAbstractRadarElement:setActAsEW(ewState)
if ewState == true or ewState == false then if ewState == true or ewState == false then
@ -2483,17 +2483,17 @@ function SkynetIADSAbstractRadarElement:setupElements()
hasTrackingRadar = true hasTrackingRadar = true
end end
end end
--this check ensures a unit or group has all required elements for the specific sam or ew type: --this check ensures a unit or group has all required elements for the specific sam or ew type:
if (hasLauncher and hasSearchRadar and hasTrackingRadar and #self.launchers > 0 and #self.searchRadars > 0 and #self.trackingRadars > 0 ) if (hasLauncher and hasSearchRadar and hasTrackingRadar and #self.launchers > 0 and #self.searchRadars > 0 and #self.trackingRadars > 0 )
or (hasSearchRadar and hasLauncher and #self.searchRadars > 0 and #self.launchers > 0) then or (hasSearchRadar and hasLauncher and #self.searchRadars > 0 and #self.launchers > 0) then
self:setHARMDetectionChance(dataType['harm_detection_chance']) self:setHARMDetectionChance(dataType['harm_detection_chance'])
self.dataBaseSupportedTypesCanEngageHARM = dataType['can_engage_harm'] self.dataBaseSupportedTypesCanEngageHARM = dataType['can_engage_harm']
self:setCanEngageHARM(self.dataBaseSupportedTypesCanEngageHARM) self:setCanEngageHARM(self.dataBaseSupportedTypesCanEngageHARM)
local natoName = dataType['name']['NATO'] local natoName = dataType['name']['NATO']
self:buildNatoName(natoName) self:buildNatoName(natoName)
break break
end end
end end
end end
@ -2585,10 +2585,10 @@ function SkynetIADSAbstractRadarElement:getTrackingRadars()
end end
function SkynetIADSAbstractRadarElement:getRadars() function SkynetIADSAbstractRadarElement:getRadars()
local radarUnits = {} local radarUnits = {}
for i = 1, #self.searchRadars do for i = 1, #self.searchRadars do
table.insert(radarUnits, self.searchRadars[i]) table.insert(radarUnits, self.searchRadars[i])
end end
for i = 1, #self.trackingRadars do for i = 1, #self.trackingRadars do
table.insert(radarUnits, self.trackingRadars[i]) table.insert(radarUnits, self.trackingRadars[i])
end end
@ -2597,7 +2597,7 @@ end
function SkynetIADSAbstractRadarElement:setGoLiveRangeInPercent(percent) function SkynetIADSAbstractRadarElement:setGoLiveRangeInPercent(percent)
if percent ~= nil then if percent ~= nil then
self.firingRangePercent = percent self.firingRangePercent = percent
for i = 1, #self.launchers do for i = 1, #self.launchers do
local launcher = self.launchers[i] local launcher = self.launchers[i]
launcher:setFiringRangePercent(self.firingRangePercent) launcher:setFiringRangePercent(self.firingRangePercent)
@ -2628,12 +2628,12 @@ function SkynetIADSAbstractRadarElement:getEngagementZone()
end end
function SkynetIADSAbstractRadarElement:goLive() function SkynetIADSAbstractRadarElement:goLive()
if ( self.aiState == false and self:hasWorkingPowerSource() and self.harmSilenceID == nil) if ( self.aiState == false and self:hasWorkingPowerSource() and self.harmSilenceID == nil)
and (self:hasRemainingAmmo() == true ) and (self:hasRemainingAmmo() == true )
then then
if self:isDestroyed() == false then if self:isDestroyed() == false then
local cont = self:getController() local cont = self:getController()
cont:setOption(AI.Option.Ground.id.ALARM_STATE, AI.Option.Ground.val.ALARM_STATE.RED) cont:setOption(AI.Option.Ground.id.ALARM_STATE, AI.Option.Ground.val.ALARM_STATE.RED)
cont:setOption(AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.WEAPON_FREE) cont:setOption(AI.Option.Air.id.ROE, AI.Option.Air.val.ROE.WEAPON_FREE)
self:getDCSRepresentation():enableEmission(true) self:getDCSRepresentation():enableEmission(true)
self.goLiveTime = timer.getTime() self.goLiveTime = timer.getTime()
@ -2656,8 +2656,8 @@ end
function SkynetIADSAbstractRadarElement:goDark() function SkynetIADSAbstractRadarElement:goDark()
if (self:hasWorkingPowerSource() == false) or ( self.aiState == true ) if (self:hasWorkingPowerSource() == false) or ( self.aiState == true )
and (self.harmSilenceID ~= nil or ( self.harmSilenceID == nil and #self:getDetectedTargets() == 0 and self:hasMissilesInFlight() == false) or ( self.harmSilenceID == nil and #self:getDetectedTargets() > 0 and self:hasMissilesInFlight() == false and self:hasRemainingAmmo() == false ) ) and (self.harmSilenceID ~= nil or ( self.harmSilenceID == nil and #self:getDetectedTargets() == 0 and self:hasMissilesInFlight() == false) or ( self.harmSilenceID == nil and #self:getDetectedTargets() > 0 and self:hasMissilesInFlight() == false and self:hasRemainingAmmo() == false ) )
then then
if self:isDestroyed() == false then if self:isDestroyed() == false then
self:getDCSRepresentation():enableEmission(false) self:getDCSRepresentation():enableEmission(false)
@ -2695,7 +2695,7 @@ function SkynetIADSAbstractRadarElement:isTargetInRange(target)
local isSearchRadarInRange = false local isSearchRadarInRange = false
local isTrackingRadarInRange = false local isTrackingRadarInRange = false
local isLauncherInRange = false local isLauncherInRange = false
local isSearchRadarInRange = ( #self.searchRadars == 0 ) local isSearchRadarInRange = ( #self.searchRadars == 0 )
for i = 1, #self.searchRadars do for i = 1, #self.searchRadars do
local searchRadar = self.searchRadars[i] local searchRadar = self.searchRadars[i]
@ -2704,9 +2704,9 @@ function SkynetIADSAbstractRadarElement:isTargetInRange(target)
break break
end end
end end
if self.goLiveRange == SkynetIADSAbstractRadarElement.GO_LIVE_WHEN_IN_KILL_ZONE then if self.goLiveRange == SkynetIADSAbstractRadarElement.GO_LIVE_WHEN_IN_KILL_ZONE then
isLauncherInRange = ( #self.launchers == 0 ) isLauncherInRange = ( #self.launchers == 0 )
for i = 1, #self.launchers do for i = 1, #self.launchers do
local launcher = self.launchers[i] local launcher = self.launchers[i]
@ -2715,7 +2715,7 @@ function SkynetIADSAbstractRadarElement:isTargetInRange(target)
break break
end end
end end
isTrackingRadarInRange = ( #self.trackingRadars == 0 ) isTrackingRadarInRange = ( #self.trackingRadars == 0 )
for i = 1, #self.trackingRadars do for i = 1, #self.trackingRadars do
local trackingRadar = self.trackingRadars[i] local trackingRadar = self.trackingRadars[i]
@ -2739,7 +2739,7 @@ function SkynetIADSAbstractRadarElement:isInRadarDetectionRangeOf(abstractRadarE
for j = 1, #abstractRadarElementRadars do for j = 1, #abstractRadarElementRadars do
local abstractRadarElementRadar = abstractRadarElementRadars[j] local abstractRadarElementRadar = abstractRadarElementRadars[j]
if abstractRadarElementRadar:isExist() and radar:isExist() then if abstractRadarElementRadar:isExist() and radar:isExist() then
local distance = self:getDistanceToUnit(radar:getDCSRepresentation():getPosition().p, abstractRadarElementRadar:getDCSRepresentation():getPosition().p) local distance = self:getDistanceToUnit(radar:getDCSRepresentation():getPosition().p, abstractRadarElementRadar:getDCSRepresentation():getPosition().p)
if abstractRadarElementRadar:getMaxRangeFindingTarget() >= distance then if abstractRadarElementRadar:getMaxRangeFindingTarget() >= distance then
return true return true
end end
@ -2809,10 +2809,10 @@ function SkynetIADSAbstractRadarElement:goSilentToEvadeHARM(timeToImpact)
if ( timeToImpact == nil ) then if ( timeToImpact == nil ) then
timeToImpact = 0 timeToImpact = 0
end end
self.minHarmShutdownTime = self:calculateMinimalShutdownTimeInSeconds(timeToImpact) self.minHarmShutdownTime = self:calculateMinimalShutdownTimeInSeconds(timeToImpact)
self.maxHarmShutDownTime = self:calculateMaximalShutdownTimeInSeconds(self.minHarmShutdownTime) self.maxHarmShutDownTime = self:calculateMaximalShutdownTimeInSeconds(self.minHarmShutdownTime)
self.harmShutdownTime = self:calculateHARMShutdownTime() self.harmShutdownTime = self:calculateHARMShutdownTime()
if self.iads:getDebugSettings().harmDefence then if self.iads:getDebugSettings().harmDefence then
self.iads:printOutputToLog("HARM DEFENCE SHUTTING DOWN: "..self:getDCSName().." | FOR: "..self.harmShutdownTime.." seconds | TTI: "..timeToImpact) self.iads:printOutputToLog("HARM DEFENCE SHUTTING DOWN: "..self:getDCSName().." | FOR: "..self.harmShutdownTime.." seconds | TTI: "..timeToImpact)
@ -2834,10 +2834,10 @@ function SkynetIADSAbstractRadarElement.finishHarmDefence(self)
mist.removeFunction(self.harmSilenceID) mist.removeFunction(self.harmSilenceID)
self.harmSilenceID = nil self.harmSilenceID = nil
self.harmShutdownTime = 0 self.harmShutdownTime = 0
if ( self:getAutonomousState() == true ) then if ( self:getAutonomousState() == true ) then
self:goAutonomous() self:goAutonomous()
end end
end end
function SkynetIADSAbstractRadarElement:getDetectedTargets() function SkynetIADSAbstractRadarElement:getDetectedTargets()
@ -2881,7 +2881,7 @@ function SkynetIADSAbstractRadarElement:calculateMinimalShutdownTimeInSeconds(ti
return timeToImpact + self.minHarmPresetShutdownTime return timeToImpact + self.minHarmPresetShutdownTime
end end
function SkynetIADSAbstractRadarElement:calculateMaximalShutdownTimeInSeconds(minShutdownTime) function SkynetIADSAbstractRadarElement:calculateMaximalShutdownTimeInSeconds(minShutdownTime)
return minShutdownTime + mist.random(1, self.maxHarmPresetShutdownTime) return minShutdownTime + mist.random(1, self.maxHarmPresetShutdownTime)
end end
@ -2975,9 +2975,9 @@ function SkynetIADSAbstractRadarElement.evaluateIfTargetsContainHARMs(self)
self:jam(0) self:jam(0)
self.lastJammerUpdate = 0 self.lastJammerUpdate = 0
end end
--we use the regular interval of this method to update to other states: --we use the regular interval of this method to update to other states:
self:updateMissilesInFlight() self:updateMissilesInFlight()
self:cleanUpOldObjectsIdentifiedAsHARMS() self:cleanUpOldObjectsIdentifiedAsHARMS()
end end
@ -3006,7 +3006,7 @@ end
-- AWACs will not scan for HARMS -- AWACs will not scan for HARMS
function SkynetIADSAWACSRadar:scanForHarms() function SkynetIADSAWACSRadar:scanForHarms()
end end
function SkynetIADSAWACSRadar:getMaxAllowedMovementForAutonomousUpdateInNM() function SkynetIADSAWACSRadar:getMaxAllowedMovementForAutonomousUpdateInNM()
@ -3179,19 +3179,19 @@ function SkynetIADSContact:refresh()
self.speed = (distance / hours) self.speed = (distance / hours)
self:updateSimpleAltitudeProfile() self:updateSimpleAltitudeProfile()
self.position = self:getDCSRepresentation():getPosition() self.position = self:getDCSRepresentation():getPosition()
end end
end end
self.lastTimeSeen = timer.getAbsTime() self.lastTimeSeen = timer.getAbsTime()
end end
function SkynetIADSContact:updateSimpleAltitudeProfile() function SkynetIADSContact:updateSimpleAltitudeProfile()
local currentAltitude = self:getDCSRepresentation():getPosition().p.y local currentAltitude = self:getDCSRepresentation():getPosition().p.y
local previousPath = "" local previousPath = ""
if #self.simpleAltitudeProfile > 0 then if #self.simpleAltitudeProfile > 0 then
previousPath = self.simpleAltitudeProfile[#self.simpleAltitudeProfile] previousPath = self.simpleAltitudeProfile[#self.simpleAltitudeProfile]
end end
if self.position.p.y > currentAltitude and previousPath ~= SkynetIADSContact.DESCEND then if self.position.p.y > currentAltitude and previousPath ~= SkynetIADSContact.DESCEND then
table.insert(self.simpleAltitudeProfile, SkynetIADSContact.DESCEND) table.insert(self.simpleAltitudeProfile, SkynetIADSContact.DESCEND)
elseif self.position.p.y < currentAltitude and previousPath ~= SkynetIADSContact.CLIMB then elseif self.position.p.y < currentAltitude and previousPath ~= SkynetIADSContact.CLIMB then
@ -3359,7 +3359,7 @@ function SkynetIADSJammer.runCycle(self)
for i = 1, #self.iads do for i = 1, #self.iads do
local iads = self.iads[i] local iads = self.iads[i]
local samSites = iads:getActiveSAMSites() local samSites = iads:getActiveSAMSites()
for j = 1, #samSites do for j = 1, #samSites do
local samSite = samSites[j] local samSite = samSites[j]
local radars = samSite:getRadars() local radars = samSite:getRadars()
@ -3385,7 +3385,7 @@ function SkynetIADSJammer:hasLineOfSightToRadar(radar)
local radarPos = radar:getPosition().p local radarPos = radar:getPosition().p
--lift the radar 30 meters off the ground, some 3d models are dug in to the ground, creating issues in calculating LOS --lift the radar 30 meters off the ground, some 3d models are dug in to the ground, creating issues in calculating LOS
radarPos.y = radarPos.y + 30 radarPos.y = radarPos.y + 30
return land.isVisible(radarPos, self.emitter:getPosition().p) return land.isVisible(radarPos, self.emitter:getPosition().p)
end end
function SkynetIADSJammer:masterArmSafe() function SkynetIADSJammer:masterArmSafe()
@ -3450,7 +3450,7 @@ function SkynetIADSSAMSearchRadar:setupRangeData()
local sensorInformation = subEntries[j] local sensorInformation = subEntries[j]
-- some sam sites have IR and passive EWR detection, we are just interested in the radar data -- some sam sites have IR and passive EWR detection, we are just interested in the radar data
-- investigate if upperHemisphere and headOn is ok, I guess it will work for most detection cases -- investigate if upperHemisphere and headOn is ok, I guess it will work for most detection cases
if sensorInformation.type == Unit.SensorType.RADAR then if sensorInformation.type == Unit.SensorType.RADAR and sensorInformation['detectionDistanceAir'] then
local upperHemisphere = sensorInformation['detectionDistanceAir']['upperHemisphere']['headOn'] local upperHemisphere = sensorInformation['detectionDistanceAir']['upperHemisphere']['headOn']
local lowerHemisphere = sensorInformation['detectionDistanceAir']['lowerHemisphere']['headOn'] local lowerHemisphere = sensorInformation['detectionDistanceAir']['lowerHemisphere']['headOn']
self.maximumRange = upperHemisphere self.maximumRange = upperHemisphere
@ -3509,9 +3509,23 @@ function SkynetIADSSamSite:create(samGroup, iads)
setmetatable(sam, self) setmetatable(sam, self)
self.__index = self self.__index = self
sam.targetsInRange = false sam.targetsInRange = false
sam.goLiveConstraints = {}
return sam return sam
end end
function SkynetIADSSamSite:addGoLiveConstraint(constraintName, constraint)
self.goLiveConstraints[constraintName] = constraint
end
function SkynetIADSAbstractRadarElement:areGoLiveConstraintsSatisfied(contact)
for constraintName, constraint in pairs(self.goLiveConstraints) do
if ( constraint(contact) ~= true ) then
return false
end
end
return true
end
function SkynetIADSSamSite:isDestroyed() function SkynetIADSSamSite:isDestroyed()
local isDestroyed = true local isDestroyed = true
for i = 1, #self.launchers do for i = 1, #self.launchers do
@ -3526,7 +3540,7 @@ function SkynetIADSSamSite:isDestroyed()
if radar:isExist() == true then if radar:isExist() == true then
isDestroyed = false isDestroyed = false
end end
end end
return isDestroyed return isDestroyed
end end
@ -3542,7 +3556,7 @@ end
function SkynetIADSSamSite:informOfContact(contact) function SkynetIADSSamSite:informOfContact(contact)
-- we make sure isTargetInRange (expensive call) is only triggered if no previous calls to this method resulted in targets in range -- we make sure isTargetInRange (expensive call) is only triggered if no previous calls to this method resulted in targets in range
if ( self.targetsInRange == false and self:isTargetInRange(contact) and ( contact:isIdentifiedAsHARM() == false or ( contact:isIdentifiedAsHARM() == true and self:getCanEngageHARM() == true ) ) ) then if ( self.targetsInRange == false and self:areGoLiveConstraintsSatisfied(contact) == true and self:isTargetInRange(contact) and ( contact:isIdentifiedAsHARM() == false or ( contact:isIdentifiedAsHARM() == true and self:getCanEngageHARM() == true ) ) ) then
self:goLive() self:goLive()
self.targetsInRange = true self.targetsInRange = true
end end