From f965c9ffa7f988936060feb840de1cdaa7fb9f6d 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 2cf9ae2d..b184cc66 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 85d01a38..511c9394 100644 --- a/game/dcs/aircrafttype.py +++ b/game/dcs/aircrafttype.py @@ -192,6 +192,11 @@ class AircraftType(UnitType[Type[FlyingType]]): # will be set to true for helos by default can_carry_crates: bool + # 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 + @property def flyable(self) -> bool: return self.dcs_unit_type.flyable @@ -441,4 +446,5 @@ class AircraftType(UnitType[Type[FlyingType]]): unit_class=unit_class, cabin_size=data.get("cabin_size", 10 if aircraft.helicopter else 0), can_carry_crates=data.get("can_carry_crates", aircraft.helicopter), + has_built_in_target_pod=data.get("has_built_in_target_pod", False), ) diff --git a/resources/units/aircraft/F-117A.yaml b/resources/units/aircraft/F-117A.yaml index 1dfabd52..bb8cb88d 100644 --- a/resources/units/aircraft/F-117A.yaml +++ b/resources/units/aircraft/F-117A.yaml @@ -17,3 +17,4 @@ price: 35 role: Stealth Attack variants: F-117A Nighthawk: {} +has_built_in_target_pod: true diff --git a/resources/units/aircraft/F-15E.yaml b/resources/units/aircraft/F-15E.yaml index ecba91bd..f25d9b94 100644 --- a/resources/units/aircraft/F-15E.yaml +++ b/resources/units/aircraft/F-15E.yaml @@ -10,3 +10,4 @@ role: Multirole Strike Fighter max_range: 300 variants: F-15E Strike Eagle: {} +has_built_in_target_pod: true