forked from aly/qstbak
qstcompanion v1.0.1
This commit is contained in:
parent
3e10cbbbf2
commit
44c67ab71b
79 changed files with 21148 additions and 0 deletions
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
|
||||
namespace QuestionableCompanion.Services;
|
||||
|
||||
public class VNavmeshIPC : IDisposable
|
||||
{
|
||||
private readonly ICallGateSubscriber<Vector3, bool, float, Vector3?> pointOnFloorSubscriber;
|
||||
|
||||
private readonly ICallGateSubscriber<Vector3, float, float, Vector3?> nearestPointSubscriber;
|
||||
|
||||
private readonly ICallGateSubscriber<bool> isReadySubscriber;
|
||||
|
||||
public VNavmeshIPC(IDalamudPluginInterface pluginInterface)
|
||||
{
|
||||
pointOnFloorSubscriber = pluginInterface.GetIpcSubscriber<Vector3, bool, float, Vector3?>("vnavmesh.Query.Mesh.PointOnFloor");
|
||||
nearestPointSubscriber = pluginInterface.GetIpcSubscriber<Vector3, float, float, Vector3?>("vnavmesh.Query.Mesh.NearestPoint");
|
||||
isReadySubscriber = pluginInterface.GetIpcSubscriber<bool>("vnavmesh.Nav.IsReady");
|
||||
}
|
||||
|
||||
public bool IsReady()
|
||||
{
|
||||
try
|
||||
{
|
||||
return isReadySubscriber.InvokeFunc();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3? FindPointOnFloor(Vector3 position, bool allowUnlandable = false, float searchRadius = 10f)
|
||||
{
|
||||
try
|
||||
{
|
||||
return pointOnFloorSubscriber.InvokeFunc(position, allowUnlandable, searchRadius);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3? FindNearestPoint(Vector3 position, float horizontalRadius = 10f, float verticalRadius = 5f)
|
||||
{
|
||||
try
|
||||
{
|
||||
return nearestPointSubscriber.InvokeFunc(position, horizontalRadius, verticalRadius);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue