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:
Raffson
2022-06-30 03:58:49 +02:00
committed by GitHub
parent 5f071a6138
commit 27dff95df5
7 changed files with 47 additions and 14 deletions

View File

@@ -12,6 +12,7 @@ if TYPE_CHECKING:
from game.ato import Flight, Package
from game.sim.combat import FrozenCombat
from game.theater import ControlPoint, FrontLine, TheaterGroundObject
from game.theater.iadsnetwork.iadsnetwork import IadsNetworkNode
@dataclass
@@ -33,6 +34,8 @@ class GameUpdateEvents:
deleted_front_lines: set[UUID] = field(default_factory=set)
updated_tgos: set[UUID] = field(default_factory=set)
updated_control_points: set[ControlPoint] = field(default_factory=set)
updated_iads: set[IadsNetworkNode] = field(default_factory=set)
deleted_iads_connections: set[UUID] = field(default_factory=set)
reset_on_map_center: LatLng | None = None
game_unloaded: bool = False
new_turn: bool = False
@@ -121,6 +124,14 @@ class GameUpdateEvents:
self.updated_control_points.add(control_point)
return self
def update_iads_node(self, iads_node: IadsNetworkNode) -> GameUpdateEvents:
self.updated_iads.add(iads_node)
return self
def delete_iads_connection(self, connection_id: UUID) -> GameUpdateEvents:
self.deleted_iads_connections.add(connection_id)
return self
def game_loaded(self, game: Game | None) -> GameUpdateEvents:
if game is None:
self.game_unloaded = True