Handle edge case where aircraft have built in TPGs

This commit is contained in:
zhexu14 2023-04-29 12:03:35 +10:00 committed by Raffson
parent 0ff60283c2
commit f965c9ffa7
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
4 changed files with 11 additions and 0 deletions

View File

@ -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:

View File

@ -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),
)

View File

@ -17,3 +17,4 @@ price: 35
role: Stealth Attack
variants:
F-117A Nighthawk: {}
has_built_in_target_pod: true

View File

@ -10,3 +10,4 @@ role: Multirole Strike Fighter
max_range: 300
variants:
F-15E Strike Eagle: {}
has_built_in_target_pod: true