muffin v7.5.2
This commit is contained in:
parent
965a736f84
commit
41e27710e2
3 changed files with 743 additions and 775 deletions
|
|
@ -139,11 +139,11 @@ internal sealed class MovementController : IDisposable
|
|||
get
|
||||
{
|
||||
Task<List<Vector3>> pathfindTask = _pathfindTask;
|
||||
if (pathfindTask == null || pathfindTask.IsCompleted)
|
||||
if (pathfindTask != null)
|
||||
{
|
||||
return _navmeshIpc.IsSimpleMovePathfindInProgress;
|
||||
return !pathfindTask.IsCompleted;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -473,20 +473,34 @@ internal sealed class MovementController : IDisposable
|
|||
to = vector;
|
||||
}
|
||||
PrepareNavigation(type, dataId, to, fly, sprint, stopDistance, verticalStopDistance ?? 1.95f, land, useNavmesh: true);
|
||||
_logger.LogInformation("Pathfinding to {Destination} via SimpleMove", Destination);
|
||||
_logger.LogInformation("Pathfinding to {Destination}", Destination);
|
||||
Destination.NavmeshCalculations++;
|
||||
float range = stopDistance ?? 2.8f;
|
||||
if (!_navmeshIpc.SimplePathfindAndMoveCloseTo(to, fly, range))
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
_cancellationTokenSource.CancelAfter(TimeSpan.FromSeconds(30L));
|
||||
Vector3 vector2 = _objectTable[0]?.Position ?? Vector3.Zero;
|
||||
if (fly && _aetheryteData.CalculateDistance(vector2, _clientState.TerritoryType, EAetheryteLocation.CoerthasCentralHighlandsCampDragonhead) < 11f)
|
||||
{
|
||||
_logger.LogWarning("SimpleMove rejected pathfind request (already in progress), stopping first");
|
||||
_navmeshIpc.Stop();
|
||||
if (!_navmeshIpc.SimplePathfindAndMoveCloseTo(to, fly, range))
|
||||
Vector3 vector = vector2;
|
||||
vector.Y = vector2.Y + 1f;
|
||||
vector2 = vector;
|
||||
_logger.LogInformation("Using modified start position for flying pathfinding: {StartPosition}", vector2.ToString("G", CultureInfo.InvariantCulture));
|
||||
}
|
||||
else if (fly)
|
||||
{
|
||||
_logger.LogWarning("SimpleMove still rejected after stop");
|
||||
Vector3 vector = vector2;
|
||||
vector.Y = vector2.Y + 0.2f;
|
||||
vector2 = vector;
|
||||
}
|
||||
_pathfindStartTime = Environment.TickCount64;
|
||||
if (fly && land)
|
||||
{
|
||||
_logger.LogInformation("Using tolerance-based pathfinding for landing (tolerance: 5.0)");
|
||||
_pathfindTask = _navmeshIpc.PathfindWithTolerance(vector2, to, fly, 5f, _cancellationTokenSource.Token);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pathfindTask = _navmeshIpc.Pathfind(vector2, to, fly, _cancellationTokenSource.Token);
|
||||
}
|
||||
MovementStartedAt = DateTime.Now;
|
||||
StartPlayerInputTracking();
|
||||
}
|
||||
|
||||
public void NavigateTo(EMovementType type, uint? dataId, List<Vector3> to, bool fly, bool sprint, float? stopDistance, float? verticalStopDistance = null, bool land = false)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -43,12 +43,6 @@ internal sealed class NavmeshIpc
|
|||
|
||||
private readonly ICallGateSubscriber<bool> _navRebuild;
|
||||
|
||||
private readonly ICallGateSubscriber<Vector3, bool, bool> _simpleMovePathfindAndMoveTo;
|
||||
|
||||
private readonly ICallGateSubscriber<Vector3, bool, float, bool> _simpleMovePathfindAndMoveCloseTo;
|
||||
|
||||
private readonly ICallGateSubscriber<bool> _simpleMovePathfindInProgress;
|
||||
|
||||
public bool IsNavmeshAvailable
|
||||
{
|
||||
get
|
||||
|
|
@ -129,21 +123,6 @@ internal sealed class NavmeshIpc
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsSimpleMovePathfindInProgress
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return _simpleMovePathfindInProgress.InvokeFunc();
|
||||
}
|
||||
catch (IpcError)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public NavmeshIpc(IDalamudPluginInterface pluginInterface, ILogger<NavmeshIpc> logger)
|
||||
{
|
||||
_pluginInterface = pluginInterface;
|
||||
|
|
@ -162,9 +141,6 @@ internal sealed class NavmeshIpc
|
|||
_buildProgress = pluginInterface.GetIpcSubscriber<float>("vnavmesh.Nav.BuildProgress");
|
||||
_navReload = pluginInterface.GetIpcSubscriber<bool>("vnavmesh.Nav.Reload");
|
||||
_navRebuild = pluginInterface.GetIpcSubscriber<bool>("vnavmesh.Nav.Rebuild");
|
||||
_simpleMovePathfindAndMoveTo = pluginInterface.GetIpcSubscriber<Vector3, bool, bool>("vnavmesh.SimpleMove.PathfindAndMoveTo");
|
||||
_simpleMovePathfindAndMoveCloseTo = pluginInterface.GetIpcSubscriber<Vector3, bool, float, bool>("vnavmesh.SimpleMove.PathfindAndMoveCloseTo");
|
||||
_simpleMovePathfindInProgress = pluginInterface.GetIpcSubscriber<bool>("vnavmesh.SimpleMove.PathfindInProgress");
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
|
|
@ -304,40 +280,6 @@ internal sealed class NavmeshIpc
|
|||
}
|
||||
}
|
||||
|
||||
public bool SimplePathfindAndMoveTo(Vector3 destination, bool fly)
|
||||
{
|
||||
if (!IsNavmeshAvailable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
return _simpleMovePathfindAndMoveTo.InvokeFunc(destination, fly);
|
||||
}
|
||||
catch (IpcError exception)
|
||||
{
|
||||
_logger.LogWarning(exception, "Could not pathfind and move via SimpleMove");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool SimplePathfindAndMoveCloseTo(Vector3 destination, bool fly, float range)
|
||||
{
|
||||
if (!IsNavmeshAvailable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
return _simpleMovePathfindAndMoveCloseTo.InvokeFunc(destination, fly, range);
|
||||
}
|
||||
catch (IpcError exception)
|
||||
{
|
||||
_logger.LogWarning(exception, "Could not pathfind and move close to via SimpleMove");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Vector3> GetWaypoints()
|
||||
{
|
||||
if (IsPathRunning)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue