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.
This commit is contained in:
Raffson 2024-08-18 18:17:46 +02:00
parent 3a1d90ce6a
commit 171f0722dc
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

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