Fix movement
authorLiza Carvelli <liza@carvel.li>
Thu, 3 Apr 2025 23:22:27 +0000 (01:22 +0200)
committerLiza Carvelli <liza@carvel.li>
Thu, 3 Apr 2025 23:50:31 +0000 (01:50 +0200)
Questionable/Controller/MovementController.cs
Questionable/Controller/Steps/Movement/MoveExecutor.cs

index d753a35..0bb7abf 100644 (file)
@@ -360,6 +360,9 @@ internal sealed class MovementController : IDisposable
         if (Destination == null)
             throw new InvalidOperationException("Destination is null");
 
+        if (DateTime.Now - MovementStartedAt <= TimeSpan.FromSeconds(5))
+            return;
+
         var nextWaypoint = navPoints.FirstOrDefault();
         if (nextWaypoint != default)
         {
index 16181d1..1789de9 100644 (file)
@@ -96,7 +96,7 @@ internal sealed class MoveExecutor : TaskExecutor<MoveTask>, IToastAware
         if (requiresMovement)
             PrepareMovementIfNeeded();
 
-        if (Task.Mount == true || Task.Fly)
+        if (Task.Mount == true)
         {
             var mountTask = new Mount.MountTask(Task.TerritoryId, Mount.EMountIf.Always);
             _mountBeforeMovement = (_serviceProvider.GetRequiredService<Mount.MountExecutor>(), mountTask);
@@ -121,11 +121,20 @@ internal sealed class MoveExecutor : TaskExecutor<MoveTask>, IToastAware
                         : Mount.EMountIf.AwayFromPosition;
                 var mountTask = new Mount.MountTask(Task.TerritoryId, mountIf, _destination);
                 DateTime retryAt = DateTime.Now;
-                _mountDuringMovement = (_serviceProvider.GetRequiredService<Mount.MountExecutor>(), mountTask);
+                (Mount.MountExecutor Executor, Mount.MountTask)? move;
+
                 if (_mountEvaluator.EvaluateMountState(mountTask, true, ref retryAt) != Mount.MountResult.DontMount)
-                    _mountDuringMovement.Value.Executor.Start(mountTask);
+                {
+                    move = (_serviceProvider.GetRequiredService<Mount.MountExecutor>(), mountTask);
+                    move.Value.Executor.Start(mountTask);
+                }
+                else
+                    move = null;
+
+                if (Task.Fly)
+                    _mountBeforeMovement = move;
                 else
-                    _mountDuringMovement = null;
+                    _mountDuringMovement = move;
             }
         }