From aa2a888ed0f9e5deeb36cfb48b6adff276f87057 Mon Sep 17 00:00:00 2001 From: zhexu14 <64713351+zhexu14@users.noreply.github.com> Date: Sat, 29 Apr 2023 12:03:35 +1000 Subject: [PATCH] Handle edge case where aircraft have built in TPGs --- game/ato/loadouts.py | 3 +++ game/dcs/aircrafttype.py | 6 ++++++ resources/units/aircraft/F-117A.yaml | 1 + resources/units/aircraft/F-15E.yaml | 1 + 4 files changed, 11 insertions(+) diff --git a/game/ato/loadouts.py b/game/ato/loadouts.py index c08d16cc..f770522f 100644 --- a/game/ato/loadouts.py +++ b/game/ato/loadouts.py @@ -92,6 +92,9 @@ class Loadout: if self.has_weapon_of_type(WeaponType.TGP): return + if unit_type.has_built_in_target_pod: + return + new_pylons = dict(self.pylons) for pylon_number, weapon in self.pylons.items(): if weapon is not None and weapon.weapon_group.type is WeaponType.LGB: diff --git a/game/dcs/aircrafttype.py b/game/dcs/aircrafttype.py index bfc19c6d..1b87e42d 100644 --- a/game/dcs/aircrafttype.py +++ b/game/dcs/aircrafttype.py @@ -200,6 +200,11 @@ class AircraftType(UnitType[Type[FlyingType]]): task_priorities: dict[FlightType, int] + # Set to True when aircraft mounts a targeting pod by default i.e. the pod does + # not take up a weapons station. If True, do not replace LGBs with dumb bombs + # when no TGP is mounted on any station. + has_built_in_target_pod: bool + _by_name: ClassVar[dict[str, AircraftType]] = {} _by_unit_type: ClassVar[dict[type[FlyingType], list[AircraftType]]] = defaultdict( list @@ -480,6 +485,7 @@ class AircraftType(UnitType[Type[FlyingType]]): cabin_size=data.get("cabin_size", 10 if aircraft.helicopter else 0), can_carry_crates=data.get("can_carry_crates", aircraft.helicopter), task_priorities=task_priorities, + has_built_in_target_pod=data.get("has_built_in_target_pod", False), ) def __hash__(self) -> int: diff --git a/resources/units/aircraft/F-117A.yaml b/resources/units/aircraft/F-117A.yaml index f231becf..29371eb1 100644 --- a/resources/units/aircraft/F-117A.yaml +++ b/resources/units/aircraft/F-117A.yaml @@ -19,3 +19,4 @@ variants: F-117A Nighthawk: {} tasks: Strike: 710 +has_built_in_target_pod: true diff --git a/resources/units/aircraft/F-15E.yaml b/resources/units/aircraft/F-15E.yaml index c5dbb1cf..98b74080 100644 --- a/resources/units/aircraft/F-15E.yaml +++ b/resources/units/aircraft/F-15E.yaml @@ -22,3 +22,4 @@ tasks: OCA/Runway: 630 Strike: 640 TARCAP: 240 +has_built_in_target_pod: true