From abee323d2bf41a8bd3ce127b36b3881f757401df Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Sun, 25 Aug 2024 13:45:57 +0200 Subject: [PATCH] Add IsUnmounting condition to UnmountTask --- Questionable/Controller/Steps/Common/Mount.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Questionable/Controller/Steps/Common/Mount.cs b/Questionable/Controller/Steps/Common/Mount.cs index 144de5ba..9502455c 100644 --- a/Questionable/Controller/Steps/Common/Mount.cs +++ b/Questionable/Controller/Steps/Common/Mount.cs @@ -29,7 +29,7 @@ internal static class Mount public ITask Unmount() { - return new UnmountTask(condition, loggerFactory.CreateLogger(), gameFunctions); + return new UnmountTask(condition, loggerFactory.CreateLogger(), gameFunctions, clientState); } } @@ -119,7 +119,11 @@ internal static class Mount public override string ToString() => "Mount"; } - private sealed class UnmountTask(ICondition condition, ILogger logger, GameFunctions gameFunctions) + private sealed class UnmountTask( + ICondition condition, + ILogger logger, + GameFunctions gameFunctions, + IClientState clientState) : ITask { private bool _unmountTriggered; @@ -148,6 +152,9 @@ internal static class Mount if (_continueAt >= DateTime.Now) return ETaskResult.StillRunning; + if (IsUnmounting()) + return ETaskResult.StillRunning; + if (!_unmountTriggered) { // if still flying, we still need to land @@ -172,6 +179,8 @@ internal static class Mount : ETaskResult.TaskComplete; } + private unsafe bool IsUnmounting() => **(byte**)(clientState.LocalPlayer!.Address + 1432) == 1; + public override string ToString() => "Unmount"; }