From 64f6a10cedb24618ccdfa984b52df84922a27a5f Mon Sep 17 00:00:00 2001 From: Raffson Date: Fri, 21 Jul 2023 22:05:51 +0200 Subject: [PATCH] Attempt to fix index-out-of-range Injecting pylons in the F-100 seems to go out of bounds here --- game/dcs/aircrafttype.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/game/dcs/aircrafttype.py b/game/dcs/aircrafttype.py index 1bcb3fdd..aa14aa43 100644 --- a/game/dcs/aircrafttype.py +++ b/game/dcs/aircrafttype.py @@ -515,7 +515,12 @@ class AircraftType(UnitType[Type[FlyingType]]): for pylon_number, weapons in wpn_injection.items(): for w in weapons: weapon = weapon_ids[w] - setattr(pylons[pylon_number - 1], w, (pylon_number, weapon)) + pylon = [ + pylon + for pylon in pylons + if int(pylon.__name__.replace("Pylon", "")) == pylon_number + ][0] + setattr(pylon, w, (pylon_number, weapon)) def __hash__(self) -> int: return hash(self.name)