mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Update all TGOs on capture.
We need to update all TGOs, not just the cleared ones, because the captured buildings need to update their icon to show the new color.
This commit is contained in:
parent
fef123c2d4
commit
34111cfc67
@ -730,11 +730,11 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC):
|
||||
for squadron in self.squadrons:
|
||||
self._retreat_squadron(game, squadron)
|
||||
|
||||
def depopulate_uncapturable_tgos(self, events: GameUpdateEvents) -> None:
|
||||
def depopulate_uncapturable_tgos(self) -> None:
|
||||
# TODO Rework this.
|
||||
for tgo in self.connected_objectives:
|
||||
if not tgo.capturable:
|
||||
tgo.clear(events)
|
||||
tgo.clear()
|
||||
|
||||
# TODO: Should be Airbase specific.
|
||||
def capture(self, game: Game, events: GameUpdateEvents, for_player: bool) -> None:
|
||||
@ -742,7 +742,12 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC):
|
||||
self.ground_unit_orders.refund_all(self.coalition)
|
||||
self.retreat_ground_units(game)
|
||||
self.retreat_air_units(game)
|
||||
self.depopulate_uncapturable_tgos(events)
|
||||
self.depopulate_uncapturable_tgos()
|
||||
|
||||
# All the attached TGOs have either been depopulated or captured. Tell the UI to
|
||||
# update their state.
|
||||
for tgo in self.connected_objectives:
|
||||
events.update_tgo(tgo)
|
||||
|
||||
self._coalition = new_coalition
|
||||
self.base.set_strength_to_minimum()
|
||||
|
||||
@ -23,7 +23,6 @@ from ..data.radar_db import LAUNCHER_TRACKER_PAIRS, TELARS, TRACK_RADARS
|
||||
from ..utils import Distance, Heading, meters
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game.sim import GameUpdateEvents
|
||||
from .theatergroup import TheaterUnit, TheaterGroup
|
||||
from .controlpoint import ControlPoint
|
||||
from ..ato.flighttype import FlightType
|
||||
@ -215,9 +214,8 @@ class TheaterGroundObject(MissionTarget, SidcDescribable, ABC):
|
||||
def mark_locations(self) -> Iterator[Point]:
|
||||
yield self.position
|
||||
|
||||
def clear(self, events: GameUpdateEvents) -> None:
|
||||
def clear(self) -> None:
|
||||
self.groups = []
|
||||
events.update_tgo(self)
|
||||
|
||||
@property
|
||||
def capturable(self) -> bool:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user