mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add TOT generation for all waypoints (#425)
This commit is contained in:
parent
80b3af18df
commit
0eb06f9af5
@ -32,7 +32,9 @@
|
||||
* **[Mission Generation]** Ability to choose whether player flights can spawn on the sixpack or not
|
||||
* **[Options]** New options in Mission Generator section: Limit AI radio callouts & Suppress AI radio callouts.
|
||||
* **[Options]** New option to use the combat landing flag in the landing waypoint task for helicopters.
|
||||
* **[UI/UX]** Sync package waypoints when primary flight's waypoints are updated and recreate other flights within the package to ensure JOIN, INGRESS & SPLIT are synced
|
||||
* **[UI/UX]** Sync package waypoints when primary flight's waypoints are updated and recreate other flights within the package to ensure JOIN, INGRESS & SPLIT are synced
|
||||
* **[UI/UX]** Allow changing loadout on flight creation
|
||||
* **[UI]** Display TOT for all waypoints in the flight plan
|
||||
|
||||
## Fixes
|
||||
* **[UI/UX]** A-10A flights can be edited again
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
from typing import Optional
|
||||
|
||||
from PySide6.QtCore import QItemSelectionModel, QPoint, QModelIndex
|
||||
from PySide6.QtGui import QStandardItem, QStandardItemModel
|
||||
from PySide6.QtWidgets import (
|
||||
@ -32,6 +34,7 @@ class AltitudeEditorDelegate(QStyledItemDelegate):
|
||||
class QFlightWaypointList(QTableView):
|
||||
def __init__(self, package: Package, flight: Flight):
|
||||
super().__init__()
|
||||
self._last_waypoint: Optional[FlightWaypoint] = None
|
||||
self.package = package
|
||||
self.flight = flight
|
||||
|
||||
@ -83,7 +86,10 @@ class QFlightWaypointList(QTableView):
|
||||
self.update(self.currentIndex())
|
||||
|
||||
def _add_waypoint_row(
|
||||
self, row: int, flight: Flight, waypoint: FlightWaypoint
|
||||
self,
|
||||
row: int,
|
||||
flight: Flight,
|
||||
waypoint: FlightWaypoint,
|
||||
) -> None:
|
||||
self.model.insertRow(self.model.rowCount())
|
||||
|
||||
@ -112,18 +118,36 @@ class QFlightWaypointList(QTableView):
|
||||
name = self.model.item(i, 0).text()
|
||||
self.flight.flight_plan.waypoints[i].pretty_name = name
|
||||
|
||||
def tot_text(self, flight: Flight, waypoint: FlightWaypoint) -> str:
|
||||
def tot_text(
|
||||
self,
|
||||
flight: Flight,
|
||||
waypoint: FlightWaypoint,
|
||||
) -> str:
|
||||
if waypoint.waypoint_type == FlightWaypointType.TAKEOFF:
|
||||
self.update_last_tot(flight.flight_plan.takeoff_time())
|
||||
self._last_waypoint = waypoint
|
||||
return self.takeoff_text(flight)
|
||||
prefix = ""
|
||||
time = flight.flight_plan.tot_for_waypoint(waypoint)
|
||||
if time is None:
|
||||
prefix = "Depart "
|
||||
time = flight.flight_plan.depart_time_for_waypoint(waypoint)
|
||||
if time is None:
|
||||
if time is None and self._last_waypoint is not None:
|
||||
prefix = ""
|
||||
timedelta = flight.flight_plan.travel_time_between_waypoints(
|
||||
self._last_waypoint, waypoint
|
||||
)
|
||||
time = self._last_tot + timedelta
|
||||
else:
|
||||
return ""
|
||||
self.update_last_tot(time)
|
||||
self._last_waypoint = waypoint
|
||||
return f"{prefix}{time:%H:%M:%S}"
|
||||
|
||||
@staticmethod
|
||||
def takeoff_text(flight: Flight) -> str:
|
||||
return f"{flight.flight_plan.takeoff_time():%H:%M:%S}"
|
||||
|
||||
def update_last_tot(self, time) -> None:
|
||||
if time is not None:
|
||||
self._last_tot = time
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user