mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Set the flight airfields based on the Squadron.
This commit is contained in:
@@ -606,41 +606,36 @@ class AircraftConflictGenerator:
|
||||
|
||||
for squadron in control_point.squadrons:
|
||||
try:
|
||||
self._spawn_unused_at(control_point, country, faction, squadron)
|
||||
self._spawn_unused_for(squadron, country, faction)
|
||||
except NoParkingSlotError:
|
||||
# If we run out of parking, stop spawning aircraft.
|
||||
return
|
||||
|
||||
def _spawn_unused_at(
|
||||
self,
|
||||
control_point: Airfield,
|
||||
country: Country,
|
||||
faction: Faction,
|
||||
squadron: Squadron,
|
||||
def _spawn_unused_for(
|
||||
self, squadron: Squadron, country: Country, faction: Faction
|
||||
) -> None:
|
||||
assert isinstance(squadron.location, Airfield)
|
||||
for _ in range(squadron.untasked_aircraft):
|
||||
# Creating a flight even those this isn't a fragged mission lets us
|
||||
# reuse the existing debriefing code.
|
||||
# TODO: Special flight type?
|
||||
flight = Flight(
|
||||
Package(control_point),
|
||||
Package(squadron.location),
|
||||
faction.country,
|
||||
squadron,
|
||||
1,
|
||||
FlightType.BARCAP,
|
||||
"Cold",
|
||||
departure=control_point,
|
||||
arrival=control_point,
|
||||
divert=None,
|
||||
)
|
||||
|
||||
group = self._generate_at_airport(
|
||||
name=namegen.next_aircraft_name(country, control_point.id, flight),
|
||||
name=namegen.next_aircraft_name(country, flight.departure.id, flight),
|
||||
side=country,
|
||||
unit_type=squadron.aircraft.dcs_unit_type,
|
||||
count=1,
|
||||
start_type="Cold",
|
||||
airport=control_point.airport,
|
||||
airport=squadron.location.airport,
|
||||
)
|
||||
|
||||
self._setup_livery(flight, group)
|
||||
|
||||
@@ -280,8 +280,6 @@ class Flight:
|
||||
count: int,
|
||||
flight_type: FlightType,
|
||||
start_type: str,
|
||||
departure: ControlPoint,
|
||||
arrival: ControlPoint,
|
||||
divert: Optional[ControlPoint],
|
||||
custom_name: Optional[str] = None,
|
||||
cargo: Optional[TransferOrder] = None,
|
||||
@@ -295,8 +293,8 @@ class Flight:
|
||||
self.roster = FlightRoster(self.squadron, initial_size=count)
|
||||
else:
|
||||
self.roster = roster
|
||||
self.departure = departure
|
||||
self.arrival = arrival
|
||||
self.departure = self.squadron.location
|
||||
self.arrival = self.squadron.arrival
|
||||
self.divert = divert
|
||||
self.flight_type = flight_type
|
||||
# TODO: Replace with FlightPlan.
|
||||
|
||||
Reference in New Issue
Block a user