// ============================================================================ // RynthSuite - Plugins/Shared/RynthNavPathApi.cs // The "RynthNav.Path" interface: RynthNav's landscape navmesh offered to other // plugins through the host's GetPluginInterface (API v68). RynthAi uses it to // plan a way back to its route when it gets stuck outdoors. Compiled into both // plugins (linked source), so the layout can't drift between them. // // Rules (same as RynthAi.Script): // - Append-only: new functions go at the end, and Version goes up. A caller // checks StructSize before using a field past the ones it knows. // - Call only from the plugin pump thread (OnTick and the events it drains). // RynthNav touches its navmesh only on that thread. // - Resolve the table again every time it is needed; never keep the pointer // across ticks. RynthNav may not be loaded, or may be reloaded. // - Every function returns safely (no exception crosses the boundary). // // World units: x = east (landblockX * 192 + local x), // y = north (landblockY * 192 + local y), // z = height (the pose z). // ============================================================================ using System.Runtime.InteropServices; namespace RynthCore.Plugin.Shared; [StructLayout(LayoutKind.Sequential)] public unsafe struct RynthNavPathApiV1 { public const string PluginName = "RynthNav"; public const string InterfaceName = "RynthNav.Path"; public const uint InterfaceVersion = 1; /// FindPath: a full path was found. public const int ResultOk = 1; /// FindPath: both ends are on the navmesh but the goal can't be reached (or only part of the way). public const int ResultNoPath = 0; /// FindPath: no navmesh at one of the ends (tile not baked, indoors, or no pose yet). public const int ResultNoMesh = -1; public uint Version; // InterfaceVersion of the table RynthNav filled public uint StructSize; // sizeof(RynthNavPathApiV1) as RynthNav built it /// /// Walkable path from (sx, sy, sz) to (gx, gy, gz) on the landscape navmesh. /// Writes the path corners as x,y,z triples into points (room for /// maxPoints corners, so 3 * maxPoints doubles), start first and goal last, /// and the corner count into *count. Returns ResultOk, ResultNoPath or ResultNoMesh. /// public delegate* unmanaged[Cdecl] FindPath; }