Fixed not all generated flights getting inserted into Pretense data structures.

This commit is contained in:
MetalStormGhost 2023-09-19 19:10:36 +03:00
parent 064d17aab0
commit 5fa7757ae1
2 changed files with 15 additions and 3 deletions

View File

@ -556,9 +556,9 @@ class PretenseAircraftGenerator:
StartType.COLD,
divert=cp,
)
for pilot in flight.roster.pilots:
if pilot is not None:
pilot.player = True
for roster_pilot in flight.roster.pilots:
if roster_pilot is not None:
roster_pilot.player = True
print(
f"Generated flight for {squadron.primary_task} flying {squadron.aircraft.name} at {squadron.location.name}. Pilot client count: {flight.client_count}"
)

View File

@ -128,6 +128,10 @@ class PretenseFlightGroupSpawner(FlightGroupSpawner):
if pad_group is not None:
return pad_group
if cp.has_ground_spawns and (self.flight.client_count > 0 or is_heli):
if self.flight.client_count == 0:
self.flight.coalition.game.pretense_air[cp_side][
cp_name_trimmed
][self.flight.flight_type].append(name)
pad_group = self._generate_at_cp_ground_spawn(name, cp)
if pad_group is not None:
return pad_group
@ -139,6 +143,10 @@ class PretenseFlightGroupSpawner(FlightGroupSpawner):
elif isinstance(cp, Airfield):
is_heli = self.flight.squadron.aircraft.helicopter
if cp.has_helipads and is_heli:
if self.flight.client_count == 0:
self.flight.coalition.game.pretense_air[cp_side][
cp_name_trimmed
][self.flight.flight_type].append(name)
pad_group = self._generate_at_cp_helipad(name, cp)
if pad_group is not None:
return pad_group
@ -149,6 +157,10 @@ class PretenseFlightGroupSpawner(FlightGroupSpawner):
>= self.flight.count
and (self.flight.client_count > 0 or is_heli)
):
if self.flight.client_count == 0:
self.flight.coalition.game.pretense_air[cp_side][
cp_name_trimmed
][self.flight.flight_type].append(name)
pad_group = self._generate_at_cp_ground_spawn(name, cp)
if pad_group is not None:
return pad_group