From 171f0722dcad5ac1c585f75b264e37ec7dd98671 Mon Sep 17 00:00:00 2001 From: Raffson Date: Sun, 18 Aug 2024 18:17:46 +0200 Subject: [PATCH] Fix bug in default squadron assigner/loader The root cause of the issue are lines like "if aircraft in faction.all_aircrafts" that weren't working as intended, i.e. the condition would always fail. By implementing the __eq__ method we fix this issue, effectively making the default squadron assigner make use of squadrons instead of simply skipping them. --- game/dcs/aircrafttype.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/game/dcs/aircrafttype.py b/game/dcs/aircrafttype.py index 27a8087f..598c39f4 100644 --- a/game/dcs/aircrafttype.py +++ b/game/dcs/aircrafttype.py @@ -265,6 +265,9 @@ class AircraftType(UnitType[Type[FlyingType]]): self.task_priorities.update(enrich) + def __eq__(self, other: object) -> bool: + return isinstance(other, AircraftType) and self.variant_id == other.variant_id + @classmethod def register(cls, unit_type: AircraftType) -> None: cls._by_name[unit_type.variant_id] = unit_type