mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Clean up remaining Flight.from_cp users.
The preferred API for this has been `Flight.departure` for a while.
This commit is contained in:
parent
de8d42e3e5
commit
b549af9cb7
0
game/aircraftparkinglocation.py
Normal file
0
game/aircraftparkinglocation.py
Normal file
@ -149,10 +149,6 @@ class Flight(SidcDescribable):
|
|||||||
def is_helo(self) -> bool:
|
def is_helo(self) -> bool:
|
||||||
return self.unit_type.dcs_unit_type.helicopter
|
return self.unit_type.dcs_unit_type.helicopter
|
||||||
|
|
||||||
@property
|
|
||||||
def from_cp(self) -> ControlPoint:
|
|
||||||
return self.departure
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def points(self) -> List[FlightWaypoint]:
|
def points(self) -> List[FlightWaypoint]:
|
||||||
return self.flight_plan.waypoints[1:]
|
return self.flight_plan.waypoints[1:]
|
||||||
|
|||||||
@ -283,7 +283,7 @@ class FlightPlan(ABC, Generic[LayoutT]):
|
|||||||
def estimate_ground_ops(self) -> timedelta:
|
def estimate_ground_ops(self) -> timedelta:
|
||||||
if self.flight.start_type in {StartType.RUNWAY, StartType.IN_FLIGHT}:
|
if self.flight.start_type in {StartType.RUNWAY, StartType.IN_FLIGHT}:
|
||||||
return timedelta()
|
return timedelta()
|
||||||
if self.flight.from_cp.is_fleet:
|
if self.flight.departure.is_fleet:
|
||||||
return timedelta(minutes=2)
|
return timedelta(minutes=2)
|
||||||
else:
|
else:
|
||||||
return timedelta(minutes=8)
|
return timedelta(minutes=8)
|
||||||
|
|||||||
@ -110,7 +110,7 @@ class FlightGroupConfigurator:
|
|||||||
flight_type=self.flight.flight_type,
|
flight_type=self.flight.flight_type,
|
||||||
units=self.group.units,
|
units=self.group.units,
|
||||||
size=len(self.group.units),
|
size=len(self.group.units),
|
||||||
friendly=self.flight.from_cp.captured,
|
friendly=self.flight.departure.captured,
|
||||||
departure_delay=mission_start_time,
|
departure_delay=mission_start_time,
|
||||||
departure=self.flight.departure.active_runway(
|
departure=self.flight.departure.active_runway(
|
||||||
self.game.theater, self.game.conditions, self.dynamic_runways
|
self.game.theater, self.game.conditions, self.dynamic_runways
|
||||||
|
|||||||
@ -286,7 +286,7 @@ class WaypointGenerator:
|
|||||||
# hot aircraft hours before their takeoff time.
|
# hot aircraft hours before their takeoff time.
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if self.flight.from_cp.is_fleet:
|
if self.flight.departure.is_fleet:
|
||||||
# Carrier spawns will crowd the carrier deck, especially without
|
# Carrier spawns will crowd the carrier deck, especially without
|
||||||
# super carrier.
|
# super carrier.
|
||||||
# TODO: Is there enough parking on the supercarrier?
|
# TODO: Is there enough parking on the supercarrier?
|
||||||
|
|||||||
@ -138,7 +138,7 @@ class PackageModel(QAbstractListModel):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def text_for_flight(flight: Flight) -> str:
|
def text_for_flight(flight: Flight) -> str:
|
||||||
"""Returns the text that should be displayed for the flight."""
|
"""Returns the text that should be displayed for the flight."""
|
||||||
origin = flight.from_cp.name
|
origin = flight.departure.name
|
||||||
startup = flight.flight_plan.startup_time()
|
startup = flight.flight_plan.startup_time()
|
||||||
return f"{flight} from {origin} at {startup}"
|
return f"{flight} from {origin} at {startup}"
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class FlightDelegate(TwoColumnRowDelegate):
|
|||||||
clients = self.num_clients(index)
|
clients = self.num_clients(index)
|
||||||
return f"Player Slots: {clients}" if clients else ""
|
return f"Player Slots: {clients}" if clients else ""
|
||||||
elif (row, column) == (1, 0):
|
elif (row, column) == (1, 0):
|
||||||
origin = flight.from_cp.name
|
origin = flight.departure.name
|
||||||
if flight.arrival != flight.departure:
|
if flight.arrival != flight.departure:
|
||||||
return f"From {origin} to {flight.arrival.name}"
|
return f"From {origin} to {flight.arrival.name}"
|
||||||
return f"From {origin}"
|
return f"From {origin}"
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class QPlannedFlightsView(QListView):
|
|||||||
self.flight_items = []
|
self.flight_items = []
|
||||||
for package in self.game_model.ato_model.packages:
|
for package in self.game_model.ato_model.packages:
|
||||||
for flight in package.flights:
|
for flight in package.flights:
|
||||||
if flight.from_cp == self.cp:
|
if flight.departure == self.cp:
|
||||||
item = QFlightItem(package.package, flight)
|
item = QFlightItem(package.package, flight)
|
||||||
self.flight_items.append(item)
|
self.flight_items.append(item)
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class FlightPlanPropertiesGroup(QGroupBox):
|
|||||||
self.departure_time = QLabel()
|
self.departure_time = QLabel()
|
||||||
layout.addLayout(
|
layout.addLayout(
|
||||||
QLabeledWidget(
|
QLabeledWidget(
|
||||||
f"Departing from <b>{flight.from_cp.name}</b>", self.departure_time
|
f"Departing from <b>{flight.departure.name}</b>", self.departure_time
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.package_model.tot_changed.connect(self.update_departure_time)
|
self.package_model.tot_changed.connect(self.update_departure_time)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user