mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix Skynet scripting errors
added a better exception handling closes #2205
This commit is contained in:
parent
799e01c7b3
commit
321bd4e874
@ -66,16 +66,20 @@ if dcsLiberation and SkynetIADS then
|
|||||||
for i, cn in pairs(element.ConnectionNode) do
|
for i, cn in pairs(element.ConnectionNode) do
|
||||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - adding IADS ConnectionNode %s", cn))
|
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
|
local connection_node = StaticObject.getByName(cn .. " object") -- pydcs adds ' object' to the unit name for static elements
|
||||||
|
if connection_node then
|
||||||
iads_unit:addConnectionNode(connection_node)
|
iads_unit:addConnectionNode(connection_node)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if element.PowerSource then
|
if element.PowerSource then
|
||||||
for i, ps in pairs(element.PowerSource) do
|
for i, ps in pairs(element.PowerSource) do
|
||||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - adding IADS PowerSource %s", ps))
|
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
|
local power_source = StaticObject.getByName(ps .. " object") -- pydcs adds ' object' to the unit name for static elements
|
||||||
|
if power_source then
|
||||||
iads_unit:addPowerSource(power_source)
|
iads_unit:addPowerSource(power_source)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if element.PD then
|
if element.PD then
|
||||||
for i, pd in pairs(element.PD) do
|
for i, pd in pairs(element.PD) do
|
||||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - adding IADS Point Defence %s", pd))
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - adding IADS Point Defence %s", pd))
|
||||||
@ -153,19 +157,24 @@ if dcsLiberation and SkynetIADS then
|
|||||||
for _, unit in pairs(coalition_iads.SamAsEwr) do
|
for _, unit in pairs(coalition_iads.SamAsEwr) do
|
||||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - processing IADS SAM as EWR %s", unit.dcsGroupName))
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - processing IADS SAM as EWR %s", unit.dcsGroupName))
|
||||||
local iads_unit = iads:addSAMSite(unit.dcsGroupName)
|
local iads_unit = iads:addSAMSite(unit.dcsGroupName)
|
||||||
|
if iads_unit ~= nil then
|
||||||
|
-- only process if its a valid skynet group
|
||||||
iads_unit:setActAsEW(true)
|
iads_unit:setActAsEW(true)
|
||||||
initializeIADSElement(iads, iads_unit, unit)
|
initializeIADSElement(iads, iads_unit, unit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if coalition_iads.CommandCenter then
|
if coalition_iads.CommandCenter then
|
||||||
for _, unit in pairs(coalition_iads.CommandCenter) do
|
for _, unit in pairs(coalition_iads.CommandCenter) do
|
||||||
env.info(string.format("DCSLiberation|Skynet-IADS plugin - processing IADS Command Center %s", unit.dcsGroupName))
|
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 commandCenter = StaticObject.getByName(unit.dcsGroupName .. " object") -- pydcs adds ' object' to the unit name for static elements
|
||||||
|
if commandCenter then
|
||||||
local iads_unit = iads:addCommandCenter(commandCenter)
|
local iads_unit = iads:addCommandCenter(commandCenter)
|
||||||
initializeIADSElement(iads, iads_unit, unit)
|
initializeIADSElement(iads, iads_unit, unit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if inRadio then
|
if inRadio then
|
||||||
--activate the radio menu to toggle IADS Status output
|
--activate the radio menu to toggle IADS Status output
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user