mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix spawning unused aircraft.
These are assigned a squadron even though they're unused as a hack. We need to tolerate these aircraft having no pilot assigned since that's the desired case for unused aircraft (though only happens when the squadron runs out of pilots, which should be fixed).
This commit is contained in:
parent
24884e4a77
commit
7170a7b302
@ -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
|
||||
):
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user