mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
- added information about the role of the aa site - moved handling of ground name from tgo to the sam generator to make the tgo cleaner - adjusted the skynet-config lua to the changes
152 lines
6.8 KiB
Lua
152 lines
6.8 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/dcs-liberation/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 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
|
|
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 - 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, 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 = true
|
|
iadsDebug.ewRadarNoConnection = true
|
|
iadsDebug.samNoConnection = true
|
|
iadsDebug.jammerProbability = true
|
|
iadsDebug.addedEWRadar = true
|
|
iadsDebug.hasNoPower = true
|
|
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|")
|
|
|
|
-- 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
|
|
|
|
local sites = iads:getSAMSites()
|
|
for i = 1, #sites do
|
|
local site = sites[i]
|
|
local name = site:getDCSName()
|
|
|
|
if string.match(name, "|SamAsEwr|") then
|
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - %s now acting as EWR", name))
|
|
site:setActAsEW(true)
|
|
end
|
|
|
|
if not string.match(name, "|PD") then
|
|
-- Name is prefixed with `$color|SAM|$tgoid`. For pre-4.1 generated
|
|
-- campaigns that's the full name of the primary SAM and any PD are just
|
|
-- that name suffixed with |PD.
|
|
--
|
|
-- For 4.1+ generated campaigns the name will be
|
|
-- `$color|SAM|$tgoid|$role|$gid`, so we need to replace the content
|
|
-- beginning with the third pipe with `|PD` to find our PDs.
|
|
local first_pipe = string.find(name, "|")
|
|
local second_pipe = string.find(name, "|", first_pipe + 1)
|
|
local third_pipe = string.find(name, "|", second_pipe + 1)
|
|
local pd_prefix = name .. "|PD"
|
|
if third_pipe ~= nil then
|
|
pd_prefix = string.sub(name, 1, third_pipe) .. "PD"
|
|
end
|
|
local pds = iads:getSAMSitesByPrefix(pd_prefix)
|
|
for j = 1, #pds do
|
|
pd = pds[j]
|
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - Adding %s as PD for %s", pd:getDCSName(), name))
|
|
site:addPointDefence(pd)
|
|
site:setIgnoreHARMSWhilePointDefencesHaveAmmo(true)
|
|
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, includeRedInRadio, debugRED) -- RED
|
|
end
|
|
|
|
if createBlueIADS then
|
|
env.info("DCSLiberation|Skynet-IADS plugin - creating blue IADS")
|
|
blueIADS = SkynetIADS:create("IADS")
|
|
initializeIADS(blueIADS, 2, includeBlueInRadio, debugBLUE) -- BLUE
|
|
end
|
|
|
|
end |