feat(slice2): TeleportArrivalRules.Decide — outdoor holds until landblock loaded (#145 §3.4)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-21 20:12:37 +02:00
parent ad8c24ef8b
commit b47b21570a
2 changed files with 48 additions and 34 deletions

View file

@ -4,49 +4,63 @@ using Xunit;
namespace AcDream.App.Tests.World;
/// <summary>
/// The teleport-arrival readiness decision (#145/#138).
/// <list type="bullet">
/// <item>Unhydratable claim → place immediately via the caller's safety-net (Impossible).</item>
/// <item>Indoor (sealed dungeon / building interior) → hold until the EnvCell floor hydrates.</item>
/// <item>Outdoor → place IMMEDIATELY on the server-authoritative position. Holding is futile —
/// streaming does not progress while the player is held in PortalSpace, so the
/// destination can't stream in during a hold. The stale source landblock is dropped at
/// recenter (GameWindow.OnLivePositionUpdated), so the resolve falls through to the
/// server cell (Resolve NO-LANDBLOCK verbatim) until the destination streams in.</item>
/// </list>
/// Full truth-table for TeleportArrivalRules.Decide after the §3.4 readiness-gate change.
/// </summary>
public class TeleportArrivalRulesTests
{
[Fact]
public void Unhydratable_IsImpossible()
public void Unhydratable_IsImpossible_Outdoor()
{
Assert.Equal(ArrivalReadiness.Impossible,
TeleportArrivalRules.Decide(claimUnhydratable: true, indoor: false, indoorCellReady: false));
// …even for an indoor claim.
TeleportArrivalRules.Decide(
claimUnhydratable: true, indoor: false,
indoorCellReady: false, outdoorReady: false));
}
[Fact]
public void Unhydratable_IsImpossible_Indoor()
{
Assert.Equal(ArrivalReadiness.Impossible,
TeleportArrivalRules.Decide(claimUnhydratable: true, indoor: true, indoorCellReady: false));
TeleportArrivalRules.Decide(
claimUnhydratable: true, indoor: true,
indoorCellReady: true, outdoorReady: false));
}
[Fact]
public void Indoor_CellReady_IsReady()
{
Assert.Equal(ArrivalReadiness.Ready,
TeleportArrivalRules.Decide(claimUnhydratable: false, indoor: true, indoorCellReady: true));
TeleportArrivalRules.Decide(
claimUnhydratable: false, indoor: true,
indoorCellReady: true, outdoorReady: false));
}
[Fact]
public void Indoor_CellNotReady_HoldsNotReady()
public void Indoor_CellNotReady_IsNotReady()
{
Assert.Equal(ArrivalReadiness.NotReady,
TeleportArrivalRules.Decide(claimUnhydratable: false, indoor: true, indoorCellReady: false));
TeleportArrivalRules.Decide(
claimUnhydratable: false, indoor: true,
indoorCellReady: false, outdoorReady: false));
}
[Fact]
public void Outdoor_PlacesImmediately()
public void Outdoor_LandblockLoaded_IsReady()
{
// #145: never hold an outdoor arrival — place at once on the server position. The
// indoorCellReady flag is irrelevant for an outdoor destination.
Assert.Equal(ArrivalReadiness.Ready,
TeleportArrivalRules.Decide(claimUnhydratable: false, indoor: false, indoorCellReady: false));
TeleportArrivalRules.Decide(
claimUnhydratable: false, indoor: false,
indoorCellReady: false, outdoorReady: true));
}
[Fact]
public void Outdoor_LandblockNotLoaded_IsNotReady()
{
// §3.4: the #145 residual — outdoor arrival on a not-yet-streamed landblock
// must hold. Previously returned Ready immediately.
Assert.Equal(ArrivalReadiness.NotReady,
TeleportArrivalRules.Decide(
claimUnhydratable: false, indoor: false,
indoorCellReady: false, outdoorReady: false));
}
}