diff --git a/game/event/event.py b/game/event/event.py index df63d34b..6c842347 100644 --- a/game/event/event.py +++ b/game/event/event.py @@ -122,7 +122,7 @@ class Event: def commit_air_losses(self, debriefing: Debriefing) -> None: for loss in debriefing.air_losses.losses: - if ( + if loss.pilot is not None and ( not loss.pilot.player or not self.game.settings.invulnerable_player_pilots ): diff --git a/game/unitmap.py b/game/unitmap.py index c1778091..c3273cf7 100644 --- a/game/unitmap.py +++ b/game/unitmap.py @@ -19,7 +19,7 @@ from gen.flights.flight import Flight @dataclass(frozen=True) class FlyingUnit: flight: Flight - pilot: Pilot + pilot: Optional[Pilot] @dataclass(frozen=True) @@ -70,8 +70,6 @@ class UnitMap: name = str(unit.name) if name in self.aircraft: raise RuntimeError(f"Duplicate unit name: {name}") - if pilot is None: - raise ValueError(f"{name} has no pilot assigned") self.aircraft[name] = FlyingUnit(flight, pilot) if flight.cargo is not None: self.add_airlift_units(group, flight.cargo)