feat(app): project canonical runtime placements
This commit is contained in:
parent
ef43667872
commit
74c9b155bd
5 changed files with 1395 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.Numerics;
|
||||
using AcDream.Core.Physics;
|
||||
using AcDream.Runtime.Physics;
|
||||
using AcDream.Runtime.World;
|
||||
|
||||
namespace AcDream.Runtime.Tests.World;
|
||||
|
|
@ -9,6 +10,77 @@ public sealed class RuntimeWorldTransitStateTests
|
|||
private const uint OutdoorCell = 0x11340021u;
|
||||
private const uint OtherCell = 0x3032001Cu;
|
||||
|
||||
[Fact]
|
||||
public void PlacementAuthority_RequiresCurrentPortalHostSequenceAndReveal()
|
||||
{
|
||||
var state = new RuntimeWorldTransitState();
|
||||
long generation = BeginPortal(state, OutdoorCell, sequence: 7);
|
||||
RuntimeWorldHostProjectionToken host =
|
||||
RegisterHost(state, generation, OutdoorCell);
|
||||
RuntimePortalPlacementAuthority authority = new(
|
||||
Present: true,
|
||||
RevealGeneration: generation,
|
||||
TeleportSequence: 7,
|
||||
Projection: host);
|
||||
|
||||
Assert.True(state.IsCurrentPlacementAuthority(
|
||||
authority,
|
||||
OutdoorCell));
|
||||
Assert.True(state.IsCurrentPlacementAuthority(default, OutdoorCell));
|
||||
Assert.False(state.IsCurrentPlacementAuthority(
|
||||
authority with { TeleportSequence = 8 },
|
||||
OutdoorCell));
|
||||
Assert.False(state.IsCurrentPlacementAuthority(
|
||||
authority,
|
||||
OtherCell));
|
||||
|
||||
Assert.True(state.BeginHostProjectionSupersession(host));
|
||||
Assert.False(state.IsCurrentPlacementAuthority(
|
||||
authority,
|
||||
OutdoorCell));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PlacementAuthority_RejectsCancelledAndCompletedReveals()
|
||||
{
|
||||
var cancelled = new RuntimeWorldTransitState();
|
||||
long cancelledGeneration = BeginPortal(cancelled, OutdoorCell);
|
||||
RuntimeWorldHostProjectionToken cancelledHost =
|
||||
RegisterHost(cancelled, cancelledGeneration, OutdoorCell);
|
||||
RuntimePortalPlacementAuthority cancelledAuthority = new(
|
||||
true,
|
||||
cancelledGeneration,
|
||||
1,
|
||||
cancelledHost);
|
||||
Assert.True(cancelled.Cancel(cancelledGeneration));
|
||||
Assert.False(cancelled.IsCurrentPlacementAuthority(
|
||||
cancelledAuthority,
|
||||
OutdoorCell));
|
||||
|
||||
var completed = new RuntimeWorldTransitState();
|
||||
long completedGeneration = BeginPortal(completed, OutdoorCell);
|
||||
RuntimeWorldHostProjectionToken completedHost =
|
||||
RegisterHost(completed, completedGeneration, OutdoorCell);
|
||||
RuntimePortalPlacementAuthority completedAuthority = new(
|
||||
true,
|
||||
completedGeneration,
|
||||
1,
|
||||
completedHost);
|
||||
Assert.True(completed.AcknowledgeDestinationReadiness(
|
||||
Ready(completedGeneration, OutdoorCell)));
|
||||
Assert.True(completed.AcknowledgePortalMaterialized(
|
||||
completedGeneration,
|
||||
1,
|
||||
OutdoorCell));
|
||||
Assert.True(completed.AcknowledgeWorldViewportVisible(
|
||||
completedGeneration));
|
||||
Assert.True(completed.Complete(completedGeneration));
|
||||
|
||||
Assert.False(completed.IsCurrentPlacementAuthority(
|
||||
completedAuthority,
|
||||
OutdoorCell));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BeginReveal_OwnsGenerationDestinationAndSimulationGate()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue