Dan Albert 56b51c85bb Fix targeting SAMs with strike missions.
The changes for Skynet unfortunately broke this because the names used
by the TGO and the name of the group itself were no longer in sync.
This deserves a larger cleanup where we decouple that naming
requirement (TGOs don't need a lot of the data they currently have),
but this works until we have the time to do that.

Fixes https://github.com/Khopa/dcs_liberation/issues/298
2020-11-07 13:37:52 -08:00

130 lines
5.2 KiB
Lua

-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Mission configuration file for the Skynet-IADS framework
-- see https://github.com/walder/Skynet-IADS
--
-- This configuration is tailored for a mission generated by DCS Liberation
-- see https://github.com/Khopa/dcs_liberation
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Skynet-IADS plugin - configuration
env.info("DCSLiberation|Skynet-IADS plugin - configuration")
if dcsLiberation and SkynetIADS then
-- specific options
local createRedIADS = false
local createBlueIADS = false
local actAsEwrRED = false
local actAsEwrBLUE = false
local includeRedInRadio = false
local includeBlueInRadio = false
local debugRED = false
local debugBLUE = false
-- retrieve specific options values
if dcsLiberation.plugins then
if dcsLiberation.plugins.skynetiads then
createRedIADS = dcsLiberation.plugins.skynetiads.createRedIADS
createBlueIADS = dcsLiberation.plugins.skynetiads.createBlueIADS
actAsEwrRED = dcsLiberation.plugins.skynetiads.actAsEwrRED
actAsEwrBLUE = dcsLiberation.plugins.skynetiads.actAsEwrBLUE
includeRedInRadio = dcsLiberation.plugins.skynetiads.includeRedInRadio
includeBlueInRadio = dcsLiberation.plugins.skynetiads.includeBlueInRadio
debugRED = dcsLiberation.plugins.skynetiads.debugRED
debugBLUE = dcsLiberation.plugins.skynetiads.debugBLUE
end
end
env.info(string.format("DCSLiberation|Skynet-IADS plugin - createRedIADS=%s",tostring(createRedIADS)))
env.info(string.format("DCSLiberation|Skynet-IADS plugin - createBlueIADS=%s",tostring(createBlueIADS)))
env.info(string.format("DCSLiberation|Skynet-IADS plugin - actAsEwrRED=%s",tostring(actAsEwrRED)))
env.info(string.format("DCSLiberation|Skynet-IADS plugin - actAsEwrBLUE=%s",tostring(actAsEwrBLUE)))
env.info(string.format("DCSLiberation|Skynet-IADS plugin - includeRedInRadio=%s",tostring(includeRedInRadio)))
env.info(string.format("DCSLiberation|Skynet-IADS plugin - includeBlueInRadio=%s",tostring(includeBlueInRadio)))
env.info(string.format("DCSLiberation|Skynet-IADS plugin - debugRED=%s",tostring(debugRED)))
env.info(string.format("DCSLiberation|Skynet-IADS plugin - debugBLUE=%s",tostring(debugBLUE)))
-- actual configuration code
local function initializeIADS(iads, coalition, actAsEwr, inRadio, debug)
local coalitionPrefix = "BLUE"
if coalition == 1 then
coalitionPrefix = "RED"
end
if debug then
env.info("adding debug information")
local iadsDebug = iads:getDebugSettings()
iadsDebug.IADSStatus = true
iadsDebug.samWentDark = true
iadsDebug.contacts = true
iadsDebug.radarWentLive = true
iadsDebug.noWorkingCommmandCenter = false
iadsDebug.ewRadarNoConnection = false
iadsDebug.samNoConnection = false
iadsDebug.jammerProbability = true
iadsDebug.addedEWRadar = false
iadsDebug.hasNoPower = false
iadsDebug.harmDefence = true
iadsDebug.samSiteStatusEnvOutput = true
iadsDebug.earlyWarningRadarStatusEnvOutput = true
end
--add EW units to the IADS:
iads:addEarlyWarningRadarsByPrefix(coalitionPrefix .. "|EWR|")
--add SAM groups to the IADS:
iads:addSAMSitesByPrefix(coalitionPrefix .. "|SAM|")
-- specific configurations, for each SAM type
if actAsEwr then
iads:getSAMSitesByNatoName('SA-10'):setActAsEW(true)
iads:getSAMSitesByNatoName('SA-6'):setActAsEW(true)
iads:getSAMSitesByNatoName('Patriot'):setActAsEW(true)
end
-- add the AWACS
if dcsLiberation.AWACs then
for _, data in pairs(dcsLiberation.AWACs) do
env.info(string.format("DCSLiberation|Skynet-IADS plugin - processing AWACS %s", data.dcsGroupName))
local group = Group.getByName(data.dcsGroupName)
if group then
if group:getCoalition() == coalition then
local unit = group:getUnit(1)
if unit then
local unitName = unit:getName()
env.info(string.format("DCSLiberation|Skynet-IADS plugin - adding AWACS %s", unitName))
iads:addEarlyWarningRadar(unitName)
end
end
end
end
end
if inRadio then
--activate the radio menu to toggle IADS Status output
env.info("DCSLiberation|Skynet-IADS plugin - adding in radio menu")
iads:addRadioMenu()
end
--activate the IADS
iads:setupSAMSitesAndThenActivate()
end
------------------------------------------------------------------------------------------------------------------------------------------------------------
-- create the IADS networks
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if createRedIADS then
env.info("DCSLiberation|Skynet-IADS plugin - creating red IADS")
redIADS = SkynetIADS:create("IADS")
initializeIADS(redIADS, 1, actAsEwrRED, includeRedInRadio, debugRED) -- RED
end
if createBlueIADS then
env.info("DCSLiberation|Skynet-IADS plugin - creating blue IADS")
blueIADS = SkynetIADS:create("IADS")
initializeIADS(blueIADS, 2, actAsEwrBLUE, includeBlueInRadio, debugBLUE) -- BLUE
end
end