mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix IADS exception
Exception was caused by `skynet_nodes` trying to generate node for dead units, which would eventually be thrown by `dcs_name_for_group`
This commit is contained in:
parent
206c046382
commit
5896bdccc1
@ -53,7 +53,7 @@ class SkynetNode:
|
|||||||
# Statics will be placed as dead unit
|
# Statics will be placed as dead unit
|
||||||
return group.units[0].unit_name
|
return group.units[0].unit_name
|
||||||
# If no alive unit is available and not static raise error
|
# If no alive unit is available and not static raise error
|
||||||
raise IadsNetworkException("Group has no skynet usable units")
|
raise IadsNetworkException(f"{group.name} has no skynet usable units")
|
||||||
else:
|
else:
|
||||||
# Use the GroupName for SAMs, SAMAsEWR and PDs
|
# Use the GroupName for SAMs, SAMAsEWR and PDs
|
||||||
return group.group_name
|
return group.group_name
|
||||||
@ -121,6 +121,10 @@ class IadsNetwork:
|
|||||||
# Skip culled ground objects
|
# Skip culled ground objects
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
all_dead = not any([x.alive for x in node.group.units])
|
||||||
|
if all_dead:
|
||||||
|
continue
|
||||||
|
|
||||||
# SkynetNode.from_group(node.group) may raise an exception
|
# SkynetNode.from_group(node.group) may raise an exception
|
||||||
# (originating from SkynetNode.dcs_name_for_group)
|
# (originating from SkynetNode.dcs_name_for_group)
|
||||||
# but if it does, we want to know because it's supposed to be impossible afaict
|
# but if it does, we want to know because it's supposed to be impossible afaict
|
||||||
@ -217,7 +221,7 @@ class IadsNetwork:
|
|||||||
node: Optional[IadsNetworkNode] = None
|
node: Optional[IadsNetworkNode] = None
|
||||||
for group in tgo.groups:
|
for group in tgo.groups:
|
||||||
# TODO Cleanup
|
# TODO Cleanup
|
||||||
if isinstance(group, IadsGroundGroup):
|
if isinstance(group, IadsGroundGroup) and group.alive_units > 0:
|
||||||
# The first IadsGroundGroup is always the primary Group
|
# The first IadsGroundGroup is always the primary Group
|
||||||
if not node and group.iads_role.participate:
|
if not node and group.iads_role.participate:
|
||||||
# Primary Node
|
# Primary Node
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user