fix(engine): snapshot PWD ints off-thread and report merge-stack results (API v68)

Main-thread position walk now captures stack size, max stack, container, wielder, location, capacities and material so off-thread reads stop returning unknown (finding #24). MergeStackInternal records every outcome; new GetMergeStackResult API slot exposes it to plugins.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
BlankenshipG 2026-10-04 18:17:31 -04:00
commit 6f9b9858fa
8 changed files with 394 additions and 70 deletions

View file

@ -638,6 +638,14 @@ internal struct RynthCoreAPI
/// Fills the state of the most recent VendorBuy/VendorSell request. Returns 1 if a
/// request has been made this session, 0 if not. Any thread. Requires API v67+.</summary>
public IntPtr GetVendorTradeStatusFn;
/// <summary>Function pointer: int GetMergeStackResult(uint sourceObjectId, uint targetObjectId, int* amount, int* ageMs)
/// Outcome of the latest MergeStackInternal(source, target) request: 0 none, 1 queued,
/// 2 sent (amount = units sent), 3 skipped because the target was already full,
/// 4 failed (invalid ids / AC rejected / threw), 5 dropped (main-thread queue full).
/// ageMs = how long ago the outcome was recorded. Either out pointer may be null.
/// Any thread. Requires API v68+. APPENDED-AT-END for ABI safety.</summary>
public IntPtr GetMergeStackResultFn;
}
// ─── Vendor trading ABI structs (v67) ───────────────────────────────────
@ -739,7 +747,7 @@ internal unsafe struct VendorTradeStatusNative
/// <summary>Current API version. Bump when adding fields to RynthCoreAPI.</summary>
internal static class PluginContractVersion
{
public const uint Current = 67;
public const uint Current = 68; // v68: GetMergeStackResult
}
internal static class ClientActionHookFlags
@ -1206,3 +1214,4 @@ internal unsafe delegate uint VendorSellCallbackDelegate(uint vendorId, uint* it
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate int GetVendorTradeStatusCallbackDelegate(VendorTradeStatusNative* status);
internal unsafe delegate int GetMergeStackResultCallbackDelegate(uint sourceObjectId, uint targetObjectId, int* amount, int* ageMs);