Skip to content

Commit

Permalink
Core: CombatUtil: AcquiredTarget: After keypess await feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xian55 committed Jan 17, 2025
1 parent 5712ea7 commit 0213304
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Core/GoalsComponent/CombatUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
32 changes: 16 additions & 16 deletions Core/GoalsComponent/StopMoving.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0213304

Please sign in to comment.