Delay logic when to mount to after using aetherytes/aethernet
This commit is contained in:
parent
8e12b28f93
commit
65187cdaee
@ -77,14 +77,16 @@ internal static class Move
|
||||
float actualDistance = (position - Destination).Length();
|
||||
|
||||
if (Step.Mount == true)
|
||||
yield return serviceProvider.GetRequiredService<MountTask>().With(Step.TerritoryId);
|
||||
yield return serviceProvider.GetRequiredService<MountTask>()
|
||||
.With(Step.TerritoryId, MountTask.EMountIf.Always);
|
||||
else if (Step.Mount == false)
|
||||
yield return serviceProvider.GetRequiredService<UnmountTask>();
|
||||
|
||||
if (!Step.DisableNavmesh)
|
||||
{
|
||||
if (Step.Mount == null && actualDistance > 30f)
|
||||
yield return serviceProvider.GetRequiredService<MountTask>().With(Step.TerritoryId);
|
||||
if (Step.Mount == null)
|
||||
yield return serviceProvider.GetRequiredService<MountTask>()
|
||||
.With(Step.TerritoryId, MountTask.EMountIf.AwayFromPosition, Destination);
|
||||
|
||||
if (actualDistance > distance)
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -10,15 +11,24 @@ internal sealed class MountTask(
|
||||
GameFunctions gameFunctions,
|
||||
ICondition condition,
|
||||
TerritoryData territoryData,
|
||||
IClientState clientState,
|
||||
ILogger<MountTask> logger) : ITask
|
||||
{
|
||||
private ushort _territoryId;
|
||||
private EMountIf _mountIf;
|
||||
private Vector3? _position;
|
||||
|
||||
private bool _mountTriggered;
|
||||
private DateTime _retryAt = DateTime.MinValue;
|
||||
|
||||
public ITask With(ushort territoryId)
|
||||
public ITask With(ushort territoryId, EMountIf mountIf, Vector3? position = null)
|
||||
{
|
||||
_territoryId = territoryId;
|
||||
_mountIf = mountIf;
|
||||
_position = position;
|
||||
|
||||
if (_mountIf == EMountIf.AwayFromPosition)
|
||||
ArgumentNullException.ThrowIfNull(position);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -39,7 +49,21 @@ internal sealed class MountTask(
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.LogInformation("Step wants a mount, trying to mount in territory {Id}...", _territoryId);
|
||||
if (_mountIf == EMountIf.AwayFromPosition)
|
||||
{
|
||||
Vector3 playerPosition = clientState.LocalPlayer?.Position ?? Vector3.Zero;
|
||||
float distance = (playerPosition - _position.GetValueOrDefault()).Length();
|
||||
if (_territoryId == clientState.TerritoryType && distance < 30f)
|
||||
{
|
||||
logger.LogInformation("Not using mount, as we're close to the target");
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.LogInformation("Want to use mount if away from destination ({Distance} yalms), trying (in territory {Id})...", distance, _territoryId);
|
||||
}
|
||||
else
|
||||
logger.LogInformation("Want to use mount, trying (in territory {Id})...", _territoryId);
|
||||
|
||||
if (!condition[ConditionFlag.InCombat])
|
||||
{
|
||||
_retryAt = DateTime.Now.AddSeconds(0.5);
|
||||
@ -77,4 +101,10 @@ internal sealed class MountTask(
|
||||
}
|
||||
|
||||
public override string ToString() => "Mount";
|
||||
|
||||
public enum EMountIf
|
||||
{
|
||||
Always,
|
||||
AwayFromPosition,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user