Move TGOs out of MapModel.

This commit is contained in:
Dan Albert
2022-03-03 17:10:12 -08:00
parent d0ad554e14
commit c5c596dc2f
19 changed files with 186 additions and 186 deletions

View File

@@ -9,7 +9,7 @@ from dcs import Point
if TYPE_CHECKING:
from game.ato import Flight, Package
from game.sim.combat import FrozenCombat
from game.theater import FrontLine
from game.theater import FrontLine, TheaterGroundObject
@dataclass
@@ -30,6 +30,7 @@ class GameUpdateEvents:
new_front_lines: set[FrontLine] = field(default_factory=set)
updated_front_lines: set[UUID] = field(default_factory=set)
deleted_front_lines: set[UUID] = field(default_factory=set)
updated_tgos: set[UUID] = field(default_factory=set)
shutting_down: bool = False
@property
@@ -111,6 +112,10 @@ class GameUpdateEvents:
self.deleted_front_lines.add(front_line.id)
return self
def update_tgo(self, tgo: TheaterGroundObject) -> GameUpdateEvents:
self.updated_tgos.add(tgo.id)
return self
def shut_down(self) -> GameUpdateEvents:
self.shutting_down = True
return self

View File

@@ -30,7 +30,7 @@ class MissionResultsProcessor:
self.commit_convoy_losses(debriefing)
self.commit_cargo_ship_losses(debriefing)
self.commit_airlift_losses(debriefing)
self.commit_ground_losses(debriefing)
self.commit_ground_losses(debriefing, events)
self.commit_damaged_runways(debriefing)
self.commit_captures(debriefing, events)
self.commit_front_line_battle_impact(debriefing, events)
@@ -131,11 +131,11 @@ class MissionResultsProcessor:
)
@staticmethod
def commit_ground_losses(debriefing: Debriefing) -> None:
def commit_ground_losses(debriefing: Debriefing, events: GameUpdateEvents) -> None:
for ground_object_loss in debriefing.ground_object_losses:
ground_object_loss.theater_unit.kill()
ground_object_loss.theater_unit.kill(events)
for scenery_object_loss in debriefing.scenery_object_losses:
scenery_object_loss.ground_unit.kill()
scenery_object_loss.ground_unit.kill(events)
@staticmethod
def commit_damaged_runways(debriefing: Debriefing) -> None: