From 82ce688a0deb758271f26e91b50fc604e7dfa0e9 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 27 May 2021 01:15:52 -0700 Subject: [PATCH] Allow players to be defined in the squadron file. https://github.com/dcs-liberation/dcs_liberation/issues/276 --- game/squadrons.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/game/squadrons.py b/game/squadrons.py index 33c35a47..25e57997 100644 --- a/game/squadrons.py +++ b/game/squadrons.py @@ -112,6 +112,9 @@ class Squadron: if unit_type is None: raise KeyError(f"Could not find any aircraft with the ID {unit_type}") + pilots = [Pilot(n, player=False) for n in data.get("pilots", [])] + pilots.extend([Pilot(n, player=True) for n in data.get("players", [])]) + return Squadron( name=data["name"], nickname=data["nickname"], @@ -120,7 +123,7 @@ class Squadron: aircraft=unit_type, livery=data.get("livery"), mission_types=tuple(FlightType.from_name(n) for n in data["mission_types"]), - pilots=[Pilot(n) for n in data.get("pilots", [])], + pilots=pilots, game=game, player=player, )