mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix TOT-offset issues
This commit is contained in:
@@ -26,7 +26,7 @@ class FlightState(ABC):
|
||||
|
||||
start_time = self.flight.flight_plan.startup_time()
|
||||
if start_time <= now:
|
||||
self._set_active_flight_state(now)
|
||||
self._set_active_flight_state(start_time)
|
||||
else:
|
||||
self.flight.set_state(
|
||||
WaitingForStart(self.flight, self.settings, start_time)
|
||||
|
||||
@@ -26,6 +26,7 @@ class InFlight(FlightState, ABC):
|
||||
settings: Settings,
|
||||
waypoint_index: int,
|
||||
has_aborted: bool = False,
|
||||
elapsed_time: timedelta = timedelta(),
|
||||
) -> None:
|
||||
super().__init__(flight, settings)
|
||||
waypoints = self.flight.flight_plan.waypoints
|
||||
@@ -35,7 +36,7 @@ class InFlight(FlightState, ABC):
|
||||
# TODO: Error checking for flight plans without landing waypoints.
|
||||
self.next_waypoint = waypoints[self.waypoint_index + 1]
|
||||
self.total_time_to_next_waypoint = self.travel_time_between_waypoints()
|
||||
self.elapsed_time = timedelta()
|
||||
self.elapsed_time = elapsed_time
|
||||
self.current_waypoint_elapsed = False
|
||||
|
||||
@property
|
||||
|
||||
@@ -24,7 +24,7 @@ class StartUp(AtDeparture):
|
||||
) -> None:
|
||||
if time < self.completion_time:
|
||||
return
|
||||
self.flight.set_state(Taxi(self.flight, self.settings, time))
|
||||
self.flight.set_state(Taxi(self.flight, self.settings, self.completion_time))
|
||||
|
||||
@property
|
||||
def is_waiting_for_start(self) -> bool:
|
||||
|
||||
@@ -19,14 +19,19 @@ class Takeoff(AtDeparture):
|
||||
def __init__(self, flight: Flight, settings: Settings, now: datetime) -> None:
|
||||
super().__init__(flight, settings)
|
||||
# TODO: Not accounted for in FlightPlan, can cause discrepancy without loiter.
|
||||
self.completion_time = now + timedelta(seconds=30)
|
||||
self.completion_time = now + flight.flight_plan.estimate_takeoff_time()
|
||||
|
||||
def on_game_tick(
|
||||
self, events: GameUpdateEvents, time: datetime, duration: timedelta
|
||||
) -> None:
|
||||
if time < self.completion_time:
|
||||
return
|
||||
self.flight.set_state(Navigating(self.flight, self.settings, waypoint_index=0))
|
||||
rollover = time - self.completion_time
|
||||
self.flight.set_state(
|
||||
Navigating(
|
||||
self.flight, self.settings, waypoint_index=0, elapsed_time=rollover
|
||||
)
|
||||
)
|
||||
|
||||
@property
|
||||
def is_waiting_for_start(self) -> bool:
|
||||
|
||||
@@ -24,7 +24,7 @@ class Taxi(AtDeparture):
|
||||
) -> None:
|
||||
if time < self.completion_time:
|
||||
return
|
||||
self.flight.set_state(Takeoff(self.flight, self.settings, time))
|
||||
self.flight.set_state(Takeoff(self.flight, self.settings, self.completion_time))
|
||||
|
||||
@property
|
||||
def is_waiting_for_start(self) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user