qstbak/Questionable/Questionable.Controller.Steps.Movement/WaitForNearDataIdExecutor.cs
2025-10-09 07:47:19 +10:00

28 lines
808 B
C#

using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Plugin.Services;
using Questionable.Functions;
namespace Questionable.Controller.Steps.Movement;
internal sealed class WaitForNearDataIdExecutor(GameFunctions gameFunctions, IClientState clientState) : TaskExecutor<WaitForNearDataId>()
{
protected override bool Start()
{
return true;
}
public override ETaskResult Update()
{
IGameObject gameObject = gameFunctions.FindObjectByDataId(base.Task.DataId);
if (gameObject == null || (gameObject.Position - clientState.LocalPlayer.Position).Length() > base.Task.StopDistance)
{
throw new TaskException("Object not found or too far away, no position so we can't move");
}
return ETaskResult.TaskComplete;
}
public override bool ShouldInterruptOnDamage()
{
return false;
}
}