From 7d314f8ee428cc26f25f56fb2c631849f5fd59ef Mon Sep 17 00:00:00 2001 From: Raffson Date: Sat, 21 Oct 2023 15:43:48 +0200 Subject: [PATCH] Lock waypoint speed if ETA is 0 & avoid negative ETAs --- .../aircraft/waypoints/pydcswaypointbuilder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game/missiongenerator/aircraft/waypoints/pydcswaypointbuilder.py b/game/missiongenerator/aircraft/waypoints/pydcswaypointbuilder.py index 4575ac69..c6c094eb 100644 --- a/game/missiongenerator/aircraft/waypoints/pydcswaypointbuilder.py +++ b/game/missiongenerator/aircraft/waypoints/pydcswaypointbuilder.py @@ -86,9 +86,9 @@ class PydcsWaypointBuilder: def set_waypoint_tot(self, waypoint: MovingPoint, tot: datetime) -> None: self.waypoint.tot = tot if not self._viggen_client_tot(): - waypoint.ETA = int((tot - self.now).total_seconds()) + waypoint.ETA = max(0, int((tot - self.now).total_seconds())) waypoint.ETA_locked = True - waypoint.speed_locked = False + waypoint.speed_locked = waypoint.ETA == 0 def _viggen_client_tot(self) -> bool: """Viggen player aircraft consider any waypoint with a TOT set to be a target ("M") waypoint.