RynthAi jump loot: answer merged stacks on arrival

A jump send that merged into a pack stack still waited the 500 ms
PickupAnswerMinMs floor, kept for fear that a merged-away object leaves
the client's request slot held. In client logs from one server the
merged stacks were off the corpse 157-234 ms after the send but confirmed
only at 500-516 ms, and the next send, made 1 ms after the confirm, was
answered normally, so the slot was free.

A jump send's merge is now answered on arrival when it is positively
seen: a same-name pack stack grown (checked whenever the item is not in
a pack), or the object of a STACK gone from the client. An unowned stack
still in the client, and a non-stack object that vanishes, keep the
floor, as does every send with no jump. The rare held slot is caught by
the slot-refusal resend; its log line now says whether a floor-less
merge confirm came just before it.

Only jump sends take this path, so it needs Jump When Looting
(LootJumpEnabled, default off).

Host tests: a jump merge into a grown stack and a jump stack gone from
the client are confirmed before the floor; a no-jump merge and a vanished
non-stack keep it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-11-07 09:36:35 -08:00
commit 1fc4d68cfc
2 changed files with 106 additions and 28 deletions

View file

@ -245,6 +245,7 @@ public sealed partial class RynthAiPlugin
private long _currentLootItemSlotWindowMs = SlotRefusalAttributionMs; // how late after the current send its refusal line may arrive
private long _currentLootItemFirstSlotRefusalAt; // when the current item's first slot refusal was seen (0 = none)
private bool _currentLootItemSlotGaveUp; // the resends ran out of time: the ordinary answer wait has the item
private long _lastEarlyMergeConfirmAt; // when a jump send's merge was confirmed before PickupAnswerMinMs (0 = none)
private int _slotRefusalCollisions; // refusals of a send by the held slot, this session
// [LootEval] lines: one per item per open (a matched item was re-printed before every pickup).
private readonly Dictionary<int, string> _lootEvalLogged = new();
@ -2349,8 +2350,13 @@ public sealed partial class RynthAiPlugin
_currentLootItemSlotRefusedAt = now;
if (_currentLootItemFirstSlotRefusalAt == 0) _currentLootItemFirstSlotRefusalAt = now;
_slotRefusalCollisions++;
long sinceMerge = _lastEarlyMergeConfirmAt == 0 ? -1 : now - _lastEarlyMergeConfirmAt;
LootDiag($"[RynthAi] {LootTag}: the client's one request slot refused the move of 0x{(uint)_currentLootItemId:X8}: the line arrived {after} ms after the send (window {_currentLootItemSlotWindowMs} ms) " +
$"(refusal #{_slotRefusalCollisions} this session); sending it again in {SlotRefusalRetryMs} ms, not counted as a try.");
$"(refusal #{_slotRefusalCollisions} this session; " +
(sinceMerge >= 0 && sinceMerge < 3000
? $"the last confirm, {sinceMerge} ms ago, was a merge taken before the {PickupAnswerMinMs} ms floor"
: "no floor-less merge confirm just before") +
$"); sending it again in {SlotRefusalRetryMs} ms, not counted as a try.");
}
if (now - _currentLootItemMoveRequestedAt < SlotRefusalRetryMs)
@ -2729,18 +2735,42 @@ public sealed partial class RynthAiPlugin
// Merged into a stack in the pack (it never shows up in the inventory): gone from the
// client, unowned and a stack when sent (ours, 064a07a), or a same-name stack in the
// pack has grown since the send (PR #16) - whichever shows first.
// The grown-stack check always runs when the item is not in a pack (it used to be skipped
// when the unowned-stack test had already said "merged"): it is the evidence a jump send
// is confirmed early on.
int mergedInto = 0;
bool grown = !inPack && MergedIntoInventoryStack(out mergedInto);
bool mergedAway = !inPack
&& (currentItem == null || ObjectGoneFromClient(_currentLootItemId) || (currentContainer == 0 && _currentLootItemStackable)
|| MergedIntoInventoryStack(out mergedInto));
|| grown);
bool landed = inPack || mergedAway;
// The floor is ACE's motion time; a jump send skips it only for the item seen in a pack,
// the server's answer about that object, which also frees the client's one request slot
// (a merged-away object can leave the slot held, so a merge keeps the floor).
// The floor is ACE's motion time; a jump send skips it for the server-only answers: the
// item seen in a pack, or a merge with positive evidence that the whole merge was
// applied - a pack stack seen grown, or the object of a stack gone from the client (ACE's
// InventoryRemoveObject for it). An unowned stack with the object still in the client
// (mergedAway only through `currentContainer == 0 && stackable`) stays weak: the corpse
// item has been taken off but nothing yet says the pack stack took it, and an item
// moved some other way looks the same, so that keeps the floor.
// The client's one request slot: a merged-away object CAN leave it held (the server's
// answer finds no object to clear it for: RynthCore ClientActionGates), and then the next
// send is refused locally. That used to be the reason for keeping the floor on every
// merge; in client logs from one server merged stacks were off the corpse 157-234 ms
// after the send and the next send, made 1 ms after the confirm, was answered normally,
// so the slot was free. The rare held slot is caught instead: the refusal is heard in chat
// and the send repeated at once (PollSlotRefusal), never costing a try.
bool jumpAnswer = _currentLootItemJumped && inPack;
bool believable = jumpAnswer || now - _currentLootItemMoveRequestedAt >= PickupAnswerMinMs;
// Only a stack can merge away: a non-stack object that vanishes (the corpse decayed,
// someone else looted it) is not an answer and waits the floor.
bool mergeEvidence = !inPack
&& (mergedInto != 0
|| (_currentLootItemStackable && (currentItem == null || ObjectGoneFromClient(_currentLootItemId))));
bool jumpMergeAnswer = _currentLootItemJumped && mergeEvidence;
bool belowFloor = now - _currentLootItemMoveRequestedAt < PickupAnswerMinMs;
bool believable = jumpAnswer || jumpMergeAnswer || !belowFloor;
long since = now - _currentLootItemLeftAt;
bool answered = landed && believable;
if (answered && jumpMergeAnswer && belowFloor)
_lastEarlyMergeConfirmAt = now; // a send made right after this one is the one a held slot would refuse (PollSlotRefusal)
if (!answered && since < PickupArriveMaxMs)
return;
ConfirmCurrentLootItem(