refactor(runtime): own interaction transactions

Move use throttling, appraisal identity, queued interactions, and exact post-arrival pickup state beneath RuntimeActionState. Keep App as the picker, movement, transport, and retained-presentation adapter while preserving retail send and UseDone ordering. Add reset, disposal, GUID-reuse, callback-reentrancy, and transport-failure coverage.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-26 11:13:09 +02:00
parent be73bccf5a
commit f5f7b4177f
31 changed files with 1365 additions and 432 deletions

View file

@ -8,6 +8,7 @@ using AcDream.Core.Net.Messages;
using AcDream.Core.Physics;
using AcDream.Core.Selection;
using AcDream.Core.World;
using AcDream.Runtime.Gameplay;
using AcDream.UI.Abstractions.Input;
namespace AcDream.App.Tests.Interaction;
@ -69,7 +70,7 @@ public sealed class SelectionInteractionControllerTests
}
}
private sealed class Transport : ISelectionInteractionTransport
private sealed class Transport : IRuntimeInteractionTransport
{
private uint _sequence;
public bool IsInWorld { get; set; } = true;
@ -160,7 +161,7 @@ public sealed class SelectionInteractionControllerTests
});
Items = new ItemInteractionController(
Objects,
new InventoryTransactionState(Objects),
new AcDream.Runtime.Gameplay.RuntimeInteractionTransactionState(new InventoryTransactionState(Objects)),
new InteractionState(),
() => Player,
sendUse: null,
@ -464,6 +465,21 @@ public sealed class SelectionInteractionControllerTests
Assert.Equal(new[] { Target }, stale.Transport.Uses);
}
[Fact]
public void HiddenTargetCancelsQueuedUseBeforeFrameDrain()
{
var h = new Harness();
h.Selection.Select(Target, SelectionChangeSource.World);
h.Controller.HandleInputAction(InputAction.UseSelected);
h.Controller.OnEntityHidden(Target);
h.Controller.DrainOutbound();
Assert.Null(h.Selection.SelectedObjectId);
Assert.Empty(h.Transport.Uses);
Assert.Equal(0, h.Items.BusyCount);
}
[Fact]
public void PickupInputWaitsForFrameDrainThenUsesPendingDestination()
{