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

@ -47,10 +47,13 @@ internal static class LootJumpTests
r.Add("jump loot: a jump pickup answered only after a bend-down's time still waits for its Return before the corpse is released", SlowAnswerKeepsReturnWait);
r.Add("jump loot: a bend-down answer inside an earlier jump's flight ends it: the next item is queued behind that Return, with no jump", SlowAnswerEndsAirWindow);
r.Add("jump loot: a jump send's answer at 150 ms is confirmed then, and the next corpse opened then, not at 500 ms", JumpAnswerConfirmedOnArrival);
r.Add("jump loot: a jump send merged into a pack stack keeps the floor (the client's request slot stays held for a merged-away object)", JumpMergeKeepsAnswerFloor);
r.Add("jump loot: the no-bend-down window after an in-air send that rode an earlier jump is anchored to that jump", AirWindowAnchoredToTheInAirJump);
r.Add("jump loot: a jump send merged into a pack stack (object still in the client, unowned; stack grown) is confirmed on arrival, before the 500 ms floor", JumpMergeConfirmedOnArrival);
r.Add("jump loot: a jump send of a stack whose object is gone from the client with no stack grown is confirmed on arrival too", JumpGoneConfirmedOnArrival);
r.Add("jump loot: a send with no jump that merged still waits PickupAnswerMinMs", NoJumpMergeKeepsAnswerFloor);
r.Add("jump loot: a send the client's held request slot refused (chat line) is sent again within 250 ms, is not one of the 3 tries, and does not wait the answer window", SlotRefusedResentQuickly);
r.Add("jump loot: a slot refusal heard long after the send, or a player's words, is not ours (no resend)", LateSlotRefusalIgnored);
r.Add("jump loot: a non-stack object that vanishes is no merge answer: the floor stays", NonStackVanishKeepsFloor);
r.Add("jump loot: a refusal line 100 ms after the send, then the server answer at 200 ms, is a single move", ForeignRefusalThenAnswerSingleMove);
r.Add("jump loot: slot resends go on past 7.5 s (9 s of refusals, still resending, no try used)", SlotResendsStillGoingAt9s);
r.Add("jump loot: after 11.5 s of slot refusals the ordinary answer wait takes over", SlotResendCapHandsOver);
@ -369,27 +372,6 @@ internal static class LootJumpTests
Check.True(FakeHost.Logs.Any(l => l.Contains("no bend-down or Return to wait for")), "classed as a pickup with no bend-down");
});
private static void JumpMergeKeepsAnswerFloor() => Clocked(() =>
{
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true, packStack: true);
Check.Eq(FakeHost.ExternalMoves[0].Id, GemA, "the corpse gem goes");
long sent = _now;
TickFor(tick, AnswerAtMs - TickMs);
// ACE StackableMerge: the corpse item is removed (gone from the client) and the pack stack grows.
FakeHost.Containers.Remove(GemA);
FakeHost.Names.Remove(GemA);
FakeHost.Positions.Remove(GemA);
FakeHost.Ints[(PackStack, KeyStack)] = 4;
// The client's one-request slot is emptied only by an answer about that same object, and a
// merged-away object is gone (RynthCore ClientActionGates): the slot can stay held, and a move
// sent now would be dropped by the client. The floor is kept.
long confirmedAfter = ConfirmAfter(tick, GemA, sent);
Check.True(confirmedAfter >= RynthAiPlugin.PickupAnswerMinMs, $"a merge keeps the floor: confirmed {confirmedAfter} ms after the send");
// (By the floor the gem is gone from the client, which names no stack: either merge wording.)
Check.True(FakeHost.Logs.Any(l => l.Contains("pickup confirmed") && l.Contains("merged into")), "as a merge into the pack stack: "
+ (FakeHost.Logs.LastOrDefault(l => l.Contains("pickup confirmed")) ?? "(none)"));
});
// The no-bend-down window after a pickup is anchored to the JUMP (it ends JumpLandMaxMs after
// it), not to the send that confirmed: a second send that rode the first jump, in the air, must
// not stretch it.
@ -416,6 +398,72 @@ internal static class LootJumpTests
$"the window ends JumpLandMaxMs after the jump: {until - jumpAt} ms from it (the second send was {secondAt - jumpAt} ms in)");
});
private static void JumpMergeConfirmedOnArrival() => Clocked(() =>
{
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true, packStack: true);
Check.Eq(FakeHost.ExternalMoves[0].Id, GemA, "the corpse gem goes");
long sent = _now;
TickFor(tick, AnswerAtMs - TickMs);
// The object is still in the client, unowned (container 0: the unowned-stack test alone says
// "merged"), and the same-name pack stack has grown. Only the grown stack is positive
// evidence here, so this pins `mergedInto != 0` (and that the grown-stack check runs when
// the unowned-stack test has already matched).
FakeHost.Containers[GemA] = 0;
FakeHost.Ints[(PackStack, KeyStack)] = 4;
long confirmedAfter = ConfirmAfter(tick, GemA, sent);
Check.True(confirmedAfter >= 0 && confirmedAfter <= AnswerAtMs + TickMs,
$"a merge on a jump send is confirmed on the tick it shows ({AnswerAtMs} ms), not at the floor: {confirmedAfter} ms after the send");
Check.True(FakeHost.Logs.Any(l => l.Contains("pickup confirmed") && l.Contains("merged into the stack 0x" + PackStack.ToString("X8"))),
"as a merge into the grown pack stack: " + (FakeHost.Logs.LastOrDefault(l => l.Contains("pickup confirmed")) ?? "(none)"));
Check.True(Field<long>("_lastEarlyMergeConfirmAt") != 0, "noted as a floor-less merge confirm (the slot-refusal log reads it)");
});
// The object gone from the client is the evidence on its own for a STACK (ACE's
// InventoryRemoveObject), with no same-name stack grown.
private static void JumpGoneConfirmedOnArrival() => Clocked(() =>
{
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true, packStack: true);
long sent = _now;
TickFor(tick, AnswerAtMs - TickMs);
FakeHost.Containers.Remove(GemA);
FakeHost.Names.Remove(GemA);
FakeHost.Positions.Remove(GemA); // the pack stack stays at 3
long confirmedAfter = ConfirmAfter(tick, GemA, sent);
Check.True(confirmedAfter >= 0 && confirmedAfter <= AnswerAtMs + TickMs,
$"gone from the client is enough on a jump send: confirmed {confirmedAfter} ms after the send");
});
// A single object (not a stack) that vanishes (the corpse decayed, someone else looted it) is no
// merge and no answer: the floor stays.
private static void NonStackVanishKeepsFloor() => Clocked(() =>
{
var tick = LootUntilFirstMove(jumpEnabled: true, secondGem: false, stamina: 100u, serverGates: true);
long sent = _now;
TickFor(tick, AnswerAtMs - TickMs);
FakeHost.Containers.Remove(GemA);
FakeHost.Names.Remove(GemA);
FakeHost.Positions.Remove(GemA);
long confirmedAfter = ConfirmAfter(tick, GemA, sent);
Check.True(confirmedAfter >= RynthAiPlugin.PickupAnswerMinMs,
$"a vanished non-stack keeps the floor ({RynthAiPlugin.PickupAnswerMinMs} ms): confirmed {confirmedAfter} ms after the send");
});
// The same merge on a send with no jump: ACE plays the pickup motion first, so the floor stays.
private static void NoJumpMergeKeepsAnswerFloor() => Clocked(() =>
{
var tick = LootUntilFirstMove(jumpEnabled: false, secondGem: false, stamina: 100u, serverGates: true, packStack: true);
Check.Eq(FakeHost.TapJumps, 0, "no jump went out");
long sent = _now;
TickFor(tick, AnswerAtMs - TickMs);
FakeHost.Containers.Remove(GemA);
FakeHost.Names.Remove(GemA);
FakeHost.Positions.Remove(GemA);
FakeHost.Ints[(PackStack, KeyStack)] = 4;
long confirmedAfter = ConfirmAfter(tick, GemA, sent);
Check.True(confirmedAfter >= RynthAiPlugin.PickupAnswerMinMs,
$"a merge with no jump keeps the floor ({RynthAiPlugin.PickupAnswerMinMs} ms): confirmed {confirmedAfter} ms after the send");
});
private const string SlotChat = "You can only move or use one item at a time";
// The client's one request slot is held: it prints its refusal locally and sends nothing, so the