From 4eb1d57f8d462345064bef9787c3d39c787e6f61 Mon Sep 17 00:00:00 2001 From: Andrew Gilewsky Date: Mon, 4 Mar 2024 13:24:02 +0000 Subject: [PATCH] IPC func/action disambiguation - setters now have no return type. --- vnavmesh/IPCProvider.cs | 60 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/vnavmesh/IPCProvider.cs b/vnavmesh/IPCProvider.cs index b021328..37bbf09 100644 --- a/vnavmesh/IPCProvider.cs +++ b/vnavmesh/IPCProvider.cs @@ -11,33 +11,33 @@ class IPCProvider : IDisposable public IPCProvider(NavmeshManager navmeshManager, FollowPath followPath, AsyncMoveRequest move, MainWindow mainWindow) { - Register("Nav.IsReady", () => navmeshManager.Navmesh != null); - Register("Nav.BuildProgress", () => navmeshManager.LoadTaskProgress); - Register("Nav.Reload", () => navmeshManager.Reload(true)); - Register("Nav.Rebuild", () => navmeshManager.Reload(false)); - Register("Nav.Pathfind", (Vector3 from, Vector3 to, bool fly) => navmeshManager.QueryPath(from, to, fly)); - Register("Nav.IsAutoLoad", () => navmeshManager.AutoLoad); - Register("Nav.SetAutoLoad", (bool v) => navmeshManager.AutoLoad = v); + RegisterFunc("Nav.IsReady", () => navmeshManager.Navmesh != null); + RegisterFunc("Nav.BuildProgress", () => navmeshManager.LoadTaskProgress); + RegisterFunc("Nav.Reload", () => navmeshManager.Reload(true)); + RegisterFunc("Nav.Rebuild", () => navmeshManager.Reload(false)); + RegisterFunc("Nav.Pathfind", (Vector3 from, Vector3 to, bool fly) => navmeshManager.QueryPath(from, to, fly)); + RegisterFunc("Nav.IsAutoLoad", () => navmeshManager.AutoLoad); + RegisterAction("Nav.SetAutoLoad", (bool v) => navmeshManager.AutoLoad = v); - Register("Query.Mesh.NearestPoint", (Vector3 p, float halfExtentXZ, float halfExtentY) => navmeshManager.Query?.FindNearestPointOnMesh(p, halfExtentXZ, halfExtentY)); - Register("Query.Mesh.PointOnFloor", (Vector3 p, float halfExtentXZ) => navmeshManager.Query?.FindPointOnFloor(p, halfExtentXZ)); + RegisterFunc("Query.Mesh.NearestPoint", (Vector3 p, float halfExtentXZ, float halfExtentY) => navmeshManager.Query?.FindNearestPointOnMesh(p, halfExtentXZ, halfExtentY)); + RegisterFunc("Query.Mesh.PointOnFloor", (Vector3 p, float halfExtentXZ) => navmeshManager.Query?.FindPointOnFloor(p, halfExtentXZ)); - Register("Path.MoveTo", (List waypoints, bool fly) => followPath.Move(waypoints, !fly)); - Register("Path.Stop", followPath.Stop); - Register("Path.IsRunning", () => followPath.Waypoints.Count > 0); - Register("Path.NumWaypoints", () => followPath.Waypoints.Count); - Register("Path.GetMovementAllowed", () => followPath.MovementAllowed); - Register("Path.SetMovementAllowed", (bool v) => followPath.MovementAllowed = v); - Register("Path.GetAlignCamera", () => followPath.AlignCamera); - Register("Path.SetAlignCamera", (bool v) => followPath.AlignCamera = v); - Register("Path.GetTolerance", () => followPath.Tolerance); - Register("Path.SetTolerance", (float v) => followPath.Tolerance = v); + RegisterAction("Path.MoveTo", (List waypoints, bool fly) => followPath.Move(waypoints, !fly)); + RegisterAction("Path.Stop", followPath.Stop); + RegisterFunc("Path.IsRunning", () => followPath.Waypoints.Count > 0); + RegisterFunc("Path.NumWaypoints", () => followPath.Waypoints.Count); + RegisterFunc("Path.GetMovementAllowed", () => followPath.MovementAllowed); + RegisterAction("Path.SetMovementAllowed", (bool v) => followPath.MovementAllowed = v); + RegisterFunc("Path.GetAlignCamera", () => followPath.AlignCamera); + RegisterAction("Path.SetAlignCamera", (bool v) => followPath.AlignCamera = v); + RegisterFunc("Path.GetTolerance", () => followPath.Tolerance); + RegisterAction("Path.SetTolerance", (float v) => followPath.Tolerance = v); - Register("SimpleMove.PathfindAndMoveTo", (Vector3 dest, bool fly) => move.MoveTo(dest, fly)); - Register("SimpleMove.PathfindInProgress", () => move.TaskInProgress); + RegisterFunc("SimpleMove.PathfindAndMoveTo", (Vector3 dest, bool fly) => move.MoveTo(dest, fly)); + RegisterFunc("SimpleMove.PathfindInProgress", () => move.TaskInProgress); - Register("Window.IsOpen", () => mainWindow.IsOpen); - Register("Window.SetOpen", (bool v) => mainWindow.IsOpen = v); + RegisterFunc("Window.IsOpen", () => mainWindow.IsOpen); + RegisterAction("Window.SetOpen", (bool v) => mainWindow.IsOpen = v); } public void Dispose() @@ -46,49 +46,49 @@ public void Dispose() a(); } - private void Register(string name, Func func) + private void RegisterFunc(string name, Func func) { var p = Service.PluginInterface.GetIpcProvider("vnavmesh." + name); p.RegisterFunc(func); _disposeActions.Add(p.UnregisterFunc); } - private void Register(string name, Func func) + private void RegisterFunc(string name, Func func) { var p = Service.PluginInterface.GetIpcProvider("vnavmesh." + name); p.RegisterFunc(func); _disposeActions.Add(p.UnregisterFunc); } - private void Register(string name, Func func) + private void RegisterFunc(string name, Func func) { var p = Service.PluginInterface.GetIpcProvider("vnavmesh." + name); p.RegisterFunc(func); _disposeActions.Add(p.UnregisterFunc); } - private void Register(string name, Func func) + private void RegisterFunc(string name, Func func) { var p = Service.PluginInterface.GetIpcProvider("vnavmesh." + name); p.RegisterFunc(func); _disposeActions.Add(p.UnregisterFunc); } - private void Register(string name, Action func) + private void RegisterAction(string name, Action func) { var p = Service.PluginInterface.GetIpcProvider("vnavmesh." + name); p.RegisterAction(func); _disposeActions.Add(p.UnregisterAction); } - private void Register(string name, Action func) + private void RegisterAction(string name, Action func) { var p = Service.PluginInterface.GetIpcProvider("vnavmesh." + name); p.RegisterAction(func); _disposeActions.Add(p.UnregisterAction); } - private void Register(string name, Action func) + private void RegisterAction(string name, Action func) { var p = Service.PluginInterface.GetIpcProvider("vnavmesh." + name); p.RegisterAction(func);