mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Stop ticking elapsed waypoints.
If the parent tick caused the flight to move to the next waypoint, we shouldn't send events for the elapsed waypoint.
This commit is contained in:
parent
a6a44ef433
commit
e95a9e0685
@ -29,6 +29,7 @@ class InFlight(FlightState, ABC):
|
|||||||
self.next_waypoint = waypoints[self.waypoint_index + 1]
|
self.next_waypoint = waypoints[self.waypoint_index + 1]
|
||||||
self.total_time_to_next_waypoint = self.travel_time_between_waypoints()
|
self.total_time_to_next_waypoint = self.travel_time_between_waypoints()
|
||||||
self.elapsed_time = timedelta()
|
self.elapsed_time = timedelta()
|
||||||
|
self.current_waypoint_elapsed = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def in_flight(self) -> bool:
|
def in_flight(self) -> bool:
|
||||||
@ -91,6 +92,7 @@ class InFlight(FlightState, ABC):
|
|||||||
|
|
||||||
def advance_to_next_waypoint(self) -> None:
|
def advance_to_next_waypoint(self) -> None:
|
||||||
self.flight.set_state(self.next_waypoint_state())
|
self.flight.set_state(self.next_waypoint_state())
|
||||||
|
self.current_waypoint_elapsed = True
|
||||||
|
|
||||||
def on_game_tick(
|
def on_game_tick(
|
||||||
self, events: GameUpdateEvents, time: datetime, duration: timedelta
|
self, events: GameUpdateEvents, time: datetime, duration: timedelta
|
||||||
|
|||||||
@ -22,7 +22,11 @@ class Navigating(InFlight):
|
|||||||
self, events: GameUpdateEvents, time: datetime, duration: timedelta
|
self, events: GameUpdateEvents, time: datetime, duration: timedelta
|
||||||
) -> None:
|
) -> None:
|
||||||
super().on_game_tick(events, time, duration)
|
super().on_game_tick(events, time, duration)
|
||||||
events.update_flight_position(self.flight, self.estimate_position())
|
|
||||||
|
# If the parent tick caused this waypoint to become inactive don't update the
|
||||||
|
# position based on our now invalid state.
|
||||||
|
if not self.current_waypoint_elapsed:
|
||||||
|
events.update_flight_position(self.flight, self.estimate_position())
|
||||||
|
|
||||||
def progress(self) -> float:
|
def progress(self) -> float:
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user