feat(runtime): expose dormant placement receipts
This commit is contained in:
parent
4c02ac4259
commit
270f5154b9
9 changed files with 223 additions and 4 deletions
|
|
@ -103,6 +103,52 @@ public sealed class RuntimeSetPositionStateTests
|
|||
Assert.Equal(1, ownership.PreparedMoverCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PublicPlacementChannelObservesRetriesAndAcknowledgesExactToken()
|
||||
{
|
||||
PhysicsEngine engine = FlatEngine(SourceLandblock, 0f);
|
||||
using var lifetime = new RuntimeEntityObjectLifetime(engine);
|
||||
var generation = new RuntimeGenerationToken(7UL);
|
||||
lifetime.BindEventContext(() => generation, static () => 11UL);
|
||||
RuntimeEntityRecord record = CreateRecord(lifetime, 0x70001012u, 1);
|
||||
_ = AttachBody(lifetime, record, SourceCell);
|
||||
var observer = new PlacementObserver();
|
||||
using IDisposable subscription = lifetime.Placements.Subscribe(observer);
|
||||
|
||||
RuntimeSetPositionOutcome outcome = lifetime.Physics.SetPosition.Apply(
|
||||
record,
|
||||
record.PositionAuthorityVersion,
|
||||
Command(Request(SourceCell, new Vector3(14f, 19f, 7f))));
|
||||
|
||||
Assert.Single(observer.Deltas);
|
||||
Assert.True(lifetime.Placements.TryPeek(generation, out var pending));
|
||||
Assert.Equal(outcome.Projection, pending.Token);
|
||||
Assert.True(lifetime.Placements.RetryPending(generation));
|
||||
Assert.Equal(2, observer.Deltas.Count);
|
||||
Assert.Equal(
|
||||
observer.Deltas[0].Placement,
|
||||
observer.Deltas[1].Placement);
|
||||
|
||||
RuntimePlacementProjectionToken stale = outcome.Projection with
|
||||
{
|
||||
Revision = outcome.Projection.Revision + 1UL,
|
||||
};
|
||||
Assert.False(lifetime.Placements.Acknowledge(generation, stale));
|
||||
Assert.False(lifetime.Placements.RetryPending(
|
||||
new RuntimeGenerationToken(8UL)));
|
||||
Assert.False(lifetime.Placements.TryPeek(
|
||||
new RuntimeGenerationToken(8UL),
|
||||
out _));
|
||||
Assert.True(lifetime.Placements.Acknowledge(
|
||||
generation,
|
||||
outcome.Projection));
|
||||
Assert.Equal(0, lifetime.Placements.PendingCount);
|
||||
Assert.False(lifetime.Placements.TryPeek(generation, out _));
|
||||
Assert.False(lifetime.Placements.Acknowledge(
|
||||
generation,
|
||||
outcome.Projection));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InWorldSetPositionPreservesObjectClockEpochPendingTimeAndActiveState()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue