Skip aetheryte teleport if you're standing within interaction distance of your target

arr-p5
Liza 2024-07-10 18:53:34 +02:00
parent 0bd15c03f5
commit 917ae4f4b8
Signed by: liza
GPG Key ID: 7199F8D727D55F67
4 changed files with 18 additions and 9 deletions

View File

@ -9,6 +9,8 @@ namespace Questionable.Model.V1;
public sealed class QuestStep
{
public const float DefaultStopDistance = 3f;
public EInteractionType InteractionType { get; set; }
public uint? DataId { get; set; }
@ -64,4 +66,12 @@ public sealed class QuestStep
Position = position;
TerritoryId = territoryId;
}
public float CalculateActualStopDistance()
{
if (InteractionType == EInteractionType.WalkTo)
return StopDistance ?? 0.25f;
else
return StopDistance ?? DefaultStopDistance;
}
}

View File

@ -23,8 +23,6 @@ namespace Questionable.Controller;
internal sealed class MovementController : IDisposable
{
public const float DefaultStopDistance = 3f;
private static readonly List<BlacklistedArea> BlacklistedAreas =
[
new(1191, new(-223.0412f, 31.937134f, -584.03906f), 5f, 7.75f),
@ -266,7 +264,7 @@ internal sealed class MovementController : IDisposable
_chatFunctions.ExecuteCommand("/automove off");
}
Destination = new DestinationData(dataId, to, stopDistance ?? (DefaultStopDistance - 0.2f), fly, sprint,
Destination = new DestinationData(dataId, to, stopDistance ?? (QuestStep.DefaultStopDistance - 0.2f), fly, sprint,
useNavmesh);
MovementStartedAt = DateTime.MaxValue;
}

View File

@ -75,6 +75,12 @@ internal static class AetheryteShortcut
}
Vector3 pos = clientState.LocalPlayer!.Position;
if (Step.Position != null && (pos - Step.Position.Value).Length() < Step.CalculateActualStopDistance())
{
logger.LogInformation("Skipping aetheryte teleport, we're near the target");
return false;
}
if (aetheryteData.CalculateDistance(pos, territoryType, TargetAetheryte) < 20 ||
(Step.AethernetShortcut != null &&
(aetheryteData.CalculateDistance(pos, territoryType, Step.AethernetShortcut.From) < 20 ||

View File

@ -69,12 +69,7 @@ internal static class Move
yield return new WaitConditionTask(() => movementController.IsNavmeshReady,
"Wait(navmesh ready)");
float distance;
if (Step.InteractionType == EInteractionType.WalkTo)
distance = Step.StopDistance ?? 0.25f;
else
distance = Step.StopDistance ?? MovementController.DefaultStopDistance;
float distance = Step.CalculateActualStopDistance();
var position = clientState.LocalPlayer?.Position ?? new Vector3();
float actualDistance = (position - Destination).Length();