Rename faction.aircrafts -> faction.all_aircraft

This commit is contained in:
Raffson
2023-12-29 15:19:56 +01:00
parent 9ff9fa5b69
commit 62df761d9c
8 changed files with 27 additions and 31 deletions

View File

@@ -98,7 +98,7 @@ class DefaultSquadronAssigner:
)
return None
if aircraft not in self.coalition.faction.aircrafts:
if aircraft not in self.coalition.faction.all_aircrafts:
return None
lo = self.coalition.faction.liveries_overrides

View File

@@ -25,7 +25,7 @@ class SquadronDefGenerator:
) -> Optional[SquadronDef]:
aircraft_choice: Optional[AircraftType] = None
for aircraft in AircraftType.priority_list_for_task(task):
if aircraft not in self.faction.aircrafts:
if aircraft not in self.faction.all_aircrafts:
continue
if not control_point.can_operate(aircraft):
continue

View File

@@ -180,7 +180,7 @@ class Faction:
return sorted(air_defenses)
@cached_property
def aircrafts(self) -> list[UnitType[Any]]:
def all_aircrafts(self) -> list[UnitType[Any]]:
# Migrator can't cope with this, so we need to do it here...
self.aircraft = set(self.aircraft)
self.awacs = set(self.awacs)
@@ -537,14 +537,14 @@ class Faction:
self.remove_ship("Destroyer_carrier")
def remove_aircraft(self, name: str) -> None:
for i in list(self.aircrafts):
for i in list(self.all_aircrafts):
if i.dcs_unit_type.id == name:
self.aircrafts.remove(i)
self.all_aircrafts.remove(i)
def remove_aircraft_by_name(self, name: str) -> None:
for i in list(self.aircrafts):
for i in list(self.all_aircrafts):
if i.display_name == name:
self.aircrafts.remove(i)
self.all_aircrafts.remove(i)
def remove_preset(self, name: str) -> None:
for pg in self.preset_groups:

View File

@@ -61,7 +61,7 @@ class ProcurementAi:
return 0
# faction has no planes or no squadrons
if len(self.faction.aircrafts) == 0 or len(self.air_wing.squadrons) == 0:
if len(self.faction.all_aircrafts) == 0 or len(self.air_wing.squadrons) == 0:
return 1
parking_type = ParkingType(

View File

@@ -38,7 +38,7 @@ class SquadronDefLoader:
f"{squadron_def.country.name}, need {country.name}: {path}"
)
continue
if squadron_def.aircraft not in faction.aircrafts:
if squadron_def.aircraft not in faction.all_aircrafts:
logging.debug(
f"Not using squadron because {faction.name} cannot use "
f"{squadron_def.aircraft}: {path}"