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:
@@ -9,6 +9,7 @@ from game.server.combat.models import FrozenCombatJs
|
||||
from game.server.controlpoints.models import ControlPointJs
|
||||
from game.server.flights.models import FlightJs
|
||||
from game.server.frontlines.models import FrontLineJs
|
||||
from game.server.iadsnetwork.models import IadsConnectionJs
|
||||
from game.server.leaflet import LeafletPoint
|
||||
from game.server.mapzones.models import UnculledZoneJs
|
||||
|
||||
@@ -34,6 +35,8 @@ class GameUpdateEventsJs(BaseModel):
|
||||
deleted_front_lines: set[UUID]
|
||||
updated_tgos: set[UUID]
|
||||
updated_control_points: list[ControlPointJs]
|
||||
updated_iads: list[IadsConnectionJs]
|
||||
deleted_iads: set[UUID]
|
||||
reset_on_map_center: LeafletPoint | None
|
||||
game_unloaded: bool
|
||||
new_turn: bool
|
||||
@@ -48,6 +51,7 @@ class GameUpdateEventsJs(BaseModel):
|
||||
new_combats = []
|
||||
updated_combats = []
|
||||
updated_unculled_zones = []
|
||||
updated_iads = []
|
||||
if game is not None:
|
||||
new_combats = [
|
||||
FrozenCombatJs.for_combat(c, game.theater) for c in events.new_combats
|
||||
@@ -57,6 +61,8 @@ class GameUpdateEventsJs(BaseModel):
|
||||
for c in events.updated_combats
|
||||
]
|
||||
updated_unculled_zones = UnculledZoneJs.from_game(game)
|
||||
for node in events.updated_iads:
|
||||
updated_iads.extend(IadsConnectionJs.connections_for_node(node))
|
||||
|
||||
return GameUpdateEventsJs(
|
||||
updated_flight_positions={
|
||||
@@ -87,6 +93,8 @@ class GameUpdateEventsJs(BaseModel):
|
||||
ControlPointJs.for_control_point(cp)
|
||||
for cp in events.updated_control_points
|
||||
],
|
||||
updated_iads=updated_iads,
|
||||
deleted_iads=events.deleted_iads_connections,
|
||||
reset_on_map_center=events.reset_on_map_center,
|
||||
game_unloaded=events.game_unloaded,
|
||||
new_turn=events.new_turn,
|
||||
|
||||
Reference in New Issue
Block a user