This commit is contained in:
Raffson
2023-05-14 15:13:44 +02:00
parent 0b6575ca97
commit 3ce0473c86

View File

@@ -62,9 +62,6 @@ class SquadronDef:
@classmethod
def from_yaml(cls, path: Path) -> SquadronDef:
from game.ato.ai_flight_planner_db import tasks_for_aircraft
from game.ato import FlightType
with path.open(encoding="utf8") as squadron_file:
data = yaml.safe_load(squadron_file)
@@ -78,16 +75,6 @@ class SquadronDef:
pilots.extend([Pilot(n, player=True) for n in data.get("players", [])])
female_pilot_percentage = data.get("female_pilot_percentage", 6)
mission_types = [FlightType.from_name(n) for n in data["mission_types"]]
tasks = tasks_for_aircraft(unit_type)
for mission_type in list(mission_types):
if mission_type not in tasks:
logging.error(
f"Squadron has mission type {mission_type} but {unit_type} is not "
f"capable of that task: {path}"
)
mission_types.remove(mission_type)
return SquadronDef(
name=data["name"],
nickname=data.get("nickname"),