Add Recovery Tankers (#2661)

Add support for recovery tankers at aircraft carriers.

Cherry picked from 9a81121ac1 and
0fd0f0e7c0
This commit is contained in:
SnappyComebacks
2022-12-20 22:17:02 -07:00
committed by GitHub
parent 715c60583a
commit 5bf5b41f2d
15 changed files with 215 additions and 14 deletions

View File

@@ -34,6 +34,7 @@ class FrontLineUnit:
@dataclass(frozen=True)
class TheaterUnitMapping:
dcs_group_id: int
theater_unit: TheaterUnit
dcs_unit: Unit
@@ -104,14 +105,16 @@ class UnitMap:
return self.front_line_units.get(name, None)
def add_theater_unit_mapping(
self, theater_unit: TheaterUnit, dcs_unit: Unit
self, dcs_group_id: int, theater_unit: TheaterUnit, dcs_unit: Unit
) -> None:
# Deaths for units at TGOs are recorded in the corresponding GroundUnit within
# the GroundGroup, so we have to match the dcs unit with the liberation unit
name = str(dcs_unit.name)
if name in self.theater_objects:
raise RuntimeError(f"Duplicate TGO unit: {name}")
self.theater_objects[name] = TheaterUnitMapping(theater_unit, dcs_unit)
self.theater_objects[name] = TheaterUnitMapping(
dcs_group_id, theater_unit, dcs_unit
)
def theater_units(self, name: str) -> Optional[TheaterUnitMapping]:
return self.theater_objects.get(name, None)