mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Handle IADS updates properly.
This adds the missing events in the backend, and handles them properly in the front end.
This commit is contained in:
@@ -843,7 +843,7 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC):
|
||||
tgo, VehicleGroupGroundObject
|
||||
):
|
||||
if isinstance(tgo, IadsGroundObject):
|
||||
game.theater.iads_network.update_tgo(tgo)
|
||||
game.theater.iads_network.update_tgo(tgo, events)
|
||||
conflict_heading = game.theater.heading_to_conflict_from(tgo.position)
|
||||
tgo.rotate(conflict_heading or tgo.heading)
|
||||
if not tgo.is_control_point:
|
||||
|
||||
@@ -18,6 +18,7 @@ from game.theater.theatergroup import IadsGroundGroup
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game.game import Game
|
||||
from game.sim import GameUpdateEvents
|
||||
|
||||
|
||||
class IadsNetworkException(Exception):
|
||||
@@ -133,19 +134,21 @@ class IadsNetwork:
|
||||
skynet_nodes.append(skynet_node)
|
||||
return skynet_nodes
|
||||
|
||||
def update_tgo(self, tgo: TheaterGroundObject) -> None:
|
||||
def update_tgo(self, tgo: TheaterGroundObject, events: GameUpdateEvents) -> None:
|
||||
"""Update the IADS Network for the given TGO"""
|
||||
# Remove existing nodes for the given tgo
|
||||
for cn in self.nodes:
|
||||
if cn.group.ground_object == tgo:
|
||||
self.nodes.remove(cn)
|
||||
for cID in cn.connections:
|
||||
events.delete_iads_connection(cID)
|
||||
|
||||
# Create a new node for the tgo
|
||||
node = self.node_for_tgo(tgo)
|
||||
if node is None:
|
||||
# Not participating
|
||||
return
|
||||
# TODO Add the connections or calculate them..
|
||||
events.update_iads_node(node)
|
||||
|
||||
def node_for_group(self, group: IadsGroundGroup) -> IadsNetworkNode:
|
||||
"""Get existing node from the iads network or create a new node"""
|
||||
|
||||
Reference in New Issue
Block a user