refactor(runtime): own teleport destination correlation
This commit is contained in:
parent
38b3773cb9
commit
6a063a27d4
23 changed files with 1209 additions and 487 deletions
|
|
@ -38,7 +38,7 @@ public sealed class LocalPlayerTeleportControllerTests
|
|||
public void DestinationBeforeStart_IsReplayedOnceAfterPresentationActivates()
|
||||
{
|
||||
var harness = new Harness();
|
||||
WorldSession.EntityPositionUpdate destination = Position(
|
||||
RuntimeTeleportDestination destination = Position(
|
||||
cellId: 0x20210001u,
|
||||
teleportSequence: 7,
|
||||
x: 12f,
|
||||
|
|
@ -231,6 +231,24 @@ public sealed class LocalPlayerTeleportControllerTests
|
|||
Assert.Equal(1, harness.Reveal.PortalMaterializationCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Place_RechecksExactRuntimeLifetimeBeforeMutatingPresentation()
|
||||
{
|
||||
var harness = new Harness();
|
||||
harness.Controller.OnTeleportStarted(81);
|
||||
harness.Controller.OfferDestination(
|
||||
Position(0x20210001u, 81, 4f, 5f, 6f),
|
||||
teleportTimestampAdvanced: true);
|
||||
long generation = harness.Reveal.Snapshot.Generation;
|
||||
Assert.True(harness.Transit.Cancel(generation));
|
||||
harness.Presentation.Enqueue(TeleportAnimEvent.Place);
|
||||
|
||||
harness.Controller.Tick(0.016f);
|
||||
|
||||
Assert.Equal(default, harness.Placement.Position);
|
||||
Assert.Equal(0, harness.Reveal.PortalMaterializationCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LoginComplete_EntersWorldThenSendsThenCompletesAndResets()
|
||||
{
|
||||
|
|
@ -565,29 +583,21 @@ public sealed class LocalPlayerTeleportControllerTests
|
|||
return int.MaxValue;
|
||||
}
|
||||
|
||||
private static WorldSession.EntityPositionUpdate Position(
|
||||
private static RuntimeTeleportDestination Position(
|
||||
uint cellId,
|
||||
ushort teleportSequence,
|
||||
float x,
|
||||
float y,
|
||||
float z) => new(
|
||||
0x50000001u,
|
||||
new CreateObject.ServerPosition(
|
||||
EntityGuid: 0x50000001u,
|
||||
InstanceSequence: 1,
|
||||
PositionSequence: 1,
|
||||
TeleportSequence: teleportSequence,
|
||||
ForcePositionSequence: 1,
|
||||
Position: new Position(
|
||||
cellId,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
1f,
|
||||
0f,
|
||||
0f,
|
||||
0f),
|
||||
null,
|
||||
null,
|
||||
true,
|
||||
1,
|
||||
1,
|
||||
teleportSequence,
|
||||
1);
|
||||
new Vector3(x, y, z),
|
||||
Quaternion.Identity));
|
||||
|
||||
private static WorldSession.EntitySpawn Spawn(uint guid, uint cell) => new(
|
||||
Guid: guid,
|
||||
|
|
@ -651,6 +661,7 @@ public sealed class LocalPlayerTeleportControllerTests
|
|||
public readonly FakePlacement Placement;
|
||||
public readonly FakeSession Session;
|
||||
public readonly FakePresentation Presentation;
|
||||
public readonly RuntimeWorldTransitState Transit;
|
||||
public readonly WorldRevealCoordinator Reveal;
|
||||
public readonly LocalPlayerTeleportController Controller;
|
||||
|
||||
|
|
@ -666,8 +677,9 @@ public sealed class LocalPlayerTeleportControllerTests
|
|||
Placement = new FakePlacement(order);
|
||||
Session = new FakeSession(order);
|
||||
Presentation = new FakePresentation(order);
|
||||
Transit = new RuntimeWorldTransitState(order.Add);
|
||||
Reveal = new WorldRevealCoordinator(
|
||||
new RuntimeWorldTransitState(order.Add),
|
||||
Transit,
|
||||
isRenderNeighborhoodReady: (_, _) => worldReady,
|
||||
isSpawnCellReady: _ => worldReady,
|
||||
isTerrainNeighborhoodReady: (_, _) => worldReady,
|
||||
|
|
@ -681,6 +693,7 @@ public sealed class LocalPlayerTeleportControllerTests
|
|||
Input,
|
||||
Mode,
|
||||
Streaming,
|
||||
Transit,
|
||||
Reveal,
|
||||
Placement,
|
||||
Session,
|
||||
|
|
@ -830,7 +843,7 @@ public sealed class LocalPlayerTeleportControllerTests
|
|||
public List<uint> Starts { get; } = [];
|
||||
public void OnTeleportStarted(uint sequence) => Starts.Add(sequence);
|
||||
public void OfferDestination(
|
||||
WorldSession.EntityPositionUpdate update,
|
||||
RuntimeTeleportDestination destination,
|
||||
bool teleportTimestampAdvanced)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue