fix(inventory): complete switches on wield response

Clear retail AutoWield on the matching authoritative WieldObject instead of waiting for unrelated rollback bookkeeping to drain. This prevents a completed switch from consuming the next weapon activation locally, including crossbows.

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-13 09:00:54 +02:00
parent ea5cf5b842
commit 3e84027885
9 changed files with 47 additions and 21 deletions

View file

@ -523,9 +523,15 @@ public sealed class ItemInteractionControllerTests
Assert.Single(h.Puts);
Assert.Single(h.Wields);
// Authoritative WieldObject + ConfirmMove completes the transaction.
// A separate reconciliation record for the same item must not delay
// retail's exact IR_WIELD completion boundary.
Assert.True(h.Objects.WieldItemOptimistic(
bow, Player, EquipMask.MissileWeapon));
// Authoritative WieldObject + ConfirmWield completes AutoWield even
// though the object table still has another rollback record.
h.Objects.MoveItem(bow, Player, -1, EquipMask.MissileWeapon);
h.Objects.ConfirmMove(bow);
h.Objects.ConfirmWield(bow);
h.Now += 200;
Assert.True(h.Controller.ActivateItem(sword));
Assert.Equal(