From 02133048bf52b6cfd92995cec9a30f9ed510def9 Mon Sep 17 00:00:00 2001 From: Xian55 <367101+Xian55@users.noreply.github.com> Date: Sat, 18 Jan 2025 00:44:19 +0100 Subject: [PATCH] Core: CombatUtil: AcquiredTarget: After keypess await feedback. --- Core/GoalsComponent/CombatUtil.cs | 2 ++ Core/GoalsComponent/StopMoving.cs | 32 +++++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Core/GoalsComponent/CombatUtil.cs b/Core/GoalsComponent/CombatUtil.cs index 856c21da..78af5860 100644 --- a/Core/GoalsComponent/CombatUtil.cs +++ b/Core/GoalsComponent/CombatUtil.cs @@ -60,11 +60,13 @@ public bool AcquiredTarget(int maxTimeMs = 400) if (playerReader.PetTarget()) { input.PressTargetPet(); + wait.Update(); Log($"Pets target {playerReader.TargetTarget}"); if (playerReader.TargetTarget == UnitsTarget.PetHasATarget) { Log($"{nameof(AcquiredTarget)}: Found target by pet"); input.PressTargetOfTarget(); + wait.Update(); return true; } } diff --git a/Core/GoalsComponent/StopMoving.cs b/Core/GoalsComponent/StopMoving.cs index b0e5552a..30292c26 100644 --- a/Core/GoalsComponent/StopMoving.cs +++ b/Core/GoalsComponent/StopMoving.cs @@ -64,24 +64,24 @@ public void StopForward() public void StopTurn() { - if (direction != playerReader.Direction) + if (direction == playerReader.Direction) + return; + + bool pressedAny = false; + + if (input.IsKeyDown(input.TurnLeftKey)) { - bool pressedAny = false; - - if (input.IsKeyDown(input.TurnLeftKey)) - { - input.SetKeyState(input.TurnLeftKey, false, true); - pressedAny = true; - } - else if (input.IsKeyDown(input.TurnRightKey)) - { - input.SetKeyState(input.TurnRightKey, false, true); - pressedAny = true; - } - - if (pressedAny) - token.WaitHandle.WaitOne(1); + input.SetKeyState(input.TurnLeftKey, false, true); + pressedAny = true; } + else if (input.IsKeyDown(input.TurnRightKey)) + { + input.SetKeyState(input.TurnRightKey, false, true); + pressedAny = true; + } + + if (pressedAny) + token.WaitHandle.WaitOne(1); direction = playerReader.Direction; }