muffin v7.4
This commit is contained in:
parent
8a7847ff37
commit
a4175abacd
54 changed files with 95984 additions and 123967 deletions
|
|
@ -43,6 +43,26 @@ internal sealed class NavmeshIpc
|
|||
|
||||
private readonly ICallGateSubscriber<bool> _navRebuild;
|
||||
|
||||
public bool IsNavmeshAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
_isNavReady.InvokeFunc();
|
||||
return true;
|
||||
}
|
||||
catch (IpcNotReadyError)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch (IpcError)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReady
|
||||
{
|
||||
get
|
||||
|
|
@ -125,6 +145,10 @@ internal sealed class NavmeshIpc
|
|||
|
||||
public void Stop()
|
||||
{
|
||||
if (!IsNavmeshAvailable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_pathStop.InvokeAction();
|
||||
|
|
@ -137,6 +161,10 @@ internal sealed class NavmeshIpc
|
|||
|
||||
public void Reload()
|
||||
{
|
||||
if (!IsNavmeshAvailable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_navReload.InvokeFunc();
|
||||
|
|
@ -149,6 +177,10 @@ internal sealed class NavmeshIpc
|
|||
|
||||
public void Rebuild()
|
||||
{
|
||||
if (!IsNavmeshAvailable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_navRebuild.InvokeFunc();
|
||||
|
|
@ -161,6 +193,10 @@ internal sealed class NavmeshIpc
|
|||
|
||||
public Task<List<Vector3>> Pathfind(Vector3 localPlayerPosition, Vector3 targetPosition, bool fly, CancellationToken cancellationToken)
|
||||
{
|
||||
if (!IsNavmeshAvailable)
|
||||
{
|
||||
return Task.FromResult(new List<Vector3>());
|
||||
}
|
||||
try
|
||||
{
|
||||
_pathSetTolerance.InvokeAction(0.25f);
|
||||
|
|
@ -175,10 +211,14 @@ internal sealed class NavmeshIpc
|
|||
|
||||
public Task<List<Vector3>> PathfindWithTolerance(Vector3 localPlayerPosition, Vector3 targetPosition, bool fly, float tolerance, CancellationToken cancellationToken)
|
||||
{
|
||||
if (!IsNavmeshAvailable)
|
||||
{
|
||||
return Task.FromResult(new List<Vector3>());
|
||||
}
|
||||
try
|
||||
{
|
||||
_pathSetTolerance.InvokeAction(tolerance);
|
||||
return _pluginInterface.GetIpcSubscriber<Vector3, Vector3, bool, float, Task<List<Vector3>>>("vnavmesh.Nav.PathfindWithTolerance").InvokeFunc(localPlayerPosition, targetPosition, fly, tolerance);
|
||||
return _pluginInterface.GetIpcSubscriber<Vector3, Vector3, bool, float, CancellationToken, Task<List<Vector3>>>("vnavmesh.Nav.PathfindWithToleranceCancelable").InvokeFunc(localPlayerPosition, targetPosition, fly, tolerance, cancellationToken);
|
||||
}
|
||||
catch (IpcError exception)
|
||||
{
|
||||
|
|
@ -189,6 +229,10 @@ internal sealed class NavmeshIpc
|
|||
|
||||
public void MoveTo(List<Vector3> position, bool fly)
|
||||
{
|
||||
if (!IsNavmeshAvailable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Stop();
|
||||
try
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue