mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Fix loadout downgrading bugs.
If the pylon had no weapon this would raise, and if no replacement was found we wouldn't clear the pylon.
This commit is contained in:
parent
d4c27da892
commit
f80b948fb1
@ -35,6 +35,9 @@ class Loadout:
|
|||||||
|
|
||||||
new_pylons = dict(self.pylons)
|
new_pylons = dict(self.pylons)
|
||||||
for pylon_number, weapon in self.pylons.items():
|
for pylon_number, weapon in self.pylons.items():
|
||||||
|
if weapon is None:
|
||||||
|
del new_pylons[pylon_number]
|
||||||
|
continue
|
||||||
if not weapon.available_on(date):
|
if not weapon.available_on(date):
|
||||||
pylon = Pylon.for_aircraft(unit_type, pylon_number)
|
pylon = Pylon.for_aircraft(unit_type, pylon_number)
|
||||||
for fallback in weapon.fallbacks:
|
for fallback in weapon.fallbacks:
|
||||||
@ -44,6 +47,8 @@ class Loadout:
|
|||||||
continue
|
continue
|
||||||
new_pylons[pylon_number] = fallback
|
new_pylons[pylon_number] = fallback
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
del new_pylons[pylon_number]
|
||||||
return Loadout(f"{self.name} ({date.year})", new_pylons, date)
|
return Loadout(f"{self.name} ({date.year})", new_pylons, date)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user