mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Implement advanced skynet functions
- factor out own class for the iadsnetwork within the conflicttheater - This class will handle all Skynet related things - no specific group_name handling necessary in future - make iadsbuilding own TGO class because SAM & EWRs are Vehicle Groups. IADS Elements dont have any groups attached. - added command center, connection node and power source as Ground objects which can be added by the campaign designer - adjust lua generator to support new iads units - parse the campaign yaml to get the iads network information - use the range as fallback if no yaml information was found - complete rewrite of the skynet lua script - allow destruction of iads network to be persistent over all rounds - modified the presetlocation handling: the wrapper PresetLocation for PointWithHeading now stores the original name from the campaign miz to have the ability to process campaign yaml configurations based on the ground unit - Implementation of the UI representation for the IADS Network - Give user the option to enable or disable advanced iads - Extended the layout system: Implement Sub task handling to support PD
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"nameInUI": "Skynet IADS (NOT WORKING FOR BUILDS > #3478)",
|
||||
"defaultValue": false,
|
||||
"nameInUI": "Skynet IADS",
|
||||
"defaultValue": true,
|
||||
"specificOptions": [
|
||||
{
|
||||
"nameInUI": "create IADS for RED coalition",
|
||||
|
||||
@@ -39,6 +39,30 @@ if dcsLiberation and SkynetIADS then
|
||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - debugBLUE=%s",tostring(debugBLUE)))
|
||||
|
||||
-- actual configuration code
|
||||
local function initializeIADSElement(iads, iads_unit, element)
|
||||
if element.ConnectionNode then
|
||||
for i,cn in pairs(element.ConnectionNode) do
|
||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - adding IADS ConnectionNode %s", cn))
|
||||
local connection_node = StaticObject.getByName(cn .. " object") -- pydcs adds ' object' to the unit name for static elements
|
||||
iads_unit:addConnectionNode(connection_node)
|
||||
end
|
||||
end
|
||||
if element.PowerSource then
|
||||
for i,ps in pairs(element.PowerSource) do
|
||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - adding IADS PowerSource %s", ps))
|
||||
local power_source = StaticObject.getByName(ps .. " object") -- pydcs adds ' object' to the unit name for static elements
|
||||
iads_unit:addPowerSource(power_source)
|
||||
end
|
||||
end
|
||||
if element.PD then
|
||||
for i,pd in pairs(element.PD) do
|
||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - adding IADS Point Defence %s", pd))
|
||||
local point_defence = iads:addSAMSite(pd)
|
||||
iads_unit:addPointDefence(point_defence)
|
||||
iads_unit:setIgnoreHARMSWhilePointDefencesHaveAmmo(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function initializeIADS(iads, coalition, inRadio, debug)
|
||||
|
||||
@@ -65,12 +89,6 @@ if dcsLiberation and SkynetIADS then
|
||||
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
|
||||
@@ -89,37 +107,37 @@ if dcsLiberation and SkynetIADS then
|
||||
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"
|
||||
-- add the IADS Elements: SAM, EWR, and Command Centers
|
||||
if dcsLiberation.IADS then
|
||||
local coalition_iads = dcsLiberation.IADS[coalitionPrefix]
|
||||
if coalition_iads.Ewr then
|
||||
for _,unit in pairs(coalition_iads.Ewr) do
|
||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - processing IADS EWR %s", unit.dcsGroupName))
|
||||
local iads_unit = iads:addEarlyWarningRadar(unit.dcsGroupName)
|
||||
initializeIADSElement(iads, iads_unit, unit)
|
||||
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
|
||||
if coalition_iads.Sam then
|
||||
for _,unit in pairs(coalition_iads.Sam) do
|
||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - processing IADS SAM %s", unit.dcsGroupName))
|
||||
local iads_unit = iads:addSAMSite(unit.dcsGroupName)
|
||||
initializeIADSElement(iads, iads_unit, unit)
|
||||
end
|
||||
end
|
||||
if coalition_iads.SamAsEwr then
|
||||
for _,unit in pairs(coalition_iads.SamAsEwr) do
|
||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - processing IADS SAM as EWR %s", unit.dcsGroupName))
|
||||
local iads_unit = iads:addSAMSite(unit.dcsGroupName)
|
||||
iads_unit:setActAsEW(true)
|
||||
initializeIADSElement(iads, iads_unit, unit)
|
||||
end
|
||||
end
|
||||
if coalition_iads.CommandCenter then
|
||||
for _,unit in pairs(coalition_iads.CommandCenter) do
|
||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - processing IADS Command Center %s", unit.dcsGroupName))
|
||||
local commandCenter = StaticObject.getByName(unit.dcsGroupName .. " object") -- pydcs adds ' object' to the unit name for static elements
|
||||
local iads_unit = iads:addCommandCenter(commandCenter)
|
||||
initializeIADSElement(iads, iads_unit, unit)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -139,13 +157,13 @@ if dcsLiberation and SkynetIADS then
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
if createRedIADS then
|
||||
env.info("DCSLiberation|Skynet-IADS plugin - creating red IADS")
|
||||
redIADS = SkynetIADS:create("IADS")
|
||||
local 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")
|
||||
local blueIADS = SkynetIADS:create("IADS")
|
||||
initializeIADS(blueIADS, 2, includeBlueInRadio, debugBLUE) -- BLUE
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user