Follow-up on flight TOT offset

This commit is contained in:
Raffson
2023-06-04 01:43:48 +02:00
parent 529eea0c01
commit c559d6e2be
9 changed files with 43 additions and 18 deletions

View File

@@ -44,7 +44,7 @@ class CustomFlightPlan(FlightPlan[CustomLayout]):
def tot_for_waypoint(self, waypoint: FlightWaypoint) -> timedelta | None:
if waypoint == self.tot_waypoint:
return self.package.time_over_target
return self.package.time_over_target + self.tot_offset
return None
def depart_time_for_waypoint(self, waypoint: FlightWaypoint) -> timedelta | None:

View File

@@ -21,7 +21,6 @@ from .planningerror import PlanningError
from ..flightwaypointtype import FlightWaypointType
from ..starttype import StartType
from ..traveltime import GroundSpeed, TravelTime
from ...savecompat import has_save_compat_for
if TYPE_CHECKING:
from game.dcs.aircrafttype import FuelConsumption
@@ -68,7 +67,6 @@ class FlightPlan(ABC, Generic[LayoutT]):
self.layout = layout
self.tot_offset = self.default_tot_offset()
@has_save_compat_for(7)
def __setstate__(self, state: dict[str, Any]) -> None:
if "tot_offset" not in state:
state["tot_offset"] = self.default_tot_offset()

View File

@@ -97,9 +97,9 @@ class FormationFlightPlan(LoiterFlightPlan, ABC):
def tot_for_waypoint(self, waypoint: FlightWaypoint) -> timedelta | None:
if waypoint == self.layout.join:
return self.join_time
return self.join_time + self.tot_offset
elif waypoint == self.layout.split:
return self.split_time
return self.split_time + self.tot_offset
return None
@property

View File

@@ -30,7 +30,7 @@ class LoiterFlightPlan(StandardFlightPlan[Any], ABC):
def depart_time_for_waypoint(self, waypoint: FlightWaypoint) -> timedelta | None:
if waypoint == self.layout.hold:
return self.push_time
return self.push_time + self.tot_offset
return None
def travel_time_between_waypoints(

View File

@@ -73,7 +73,7 @@ class PatrollingFlightPlan(StandardFlightPlan[LayoutT], UiZoneDisplay, ABC):
@property
def patrol_start_time(self) -> timedelta:
return self.package.time_over_target
return self.package.time_over_target + self.tot_offset
@property
def patrol_end_time(self) -> timedelta:

View File

@@ -66,14 +66,14 @@ class SweepFlightPlan(LoiterFlightPlan):
def tot_for_waypoint(self, waypoint: FlightWaypoint) -> timedelta | None:
if waypoint == self.layout.sweep_start:
return self.sweep_start_time
return self.sweep_start_time + self.tot_offset
if waypoint == self.layout.sweep_end:
return self.sweep_end_time
return self.sweep_end_time + self.tot_offset
return None
def depart_time_for_waypoint(self, waypoint: FlightWaypoint) -> timedelta | None:
if waypoint == self.layout.hold:
return self.push_time
return self.push_time + self.tot_offset
return None
@property