fix(teleport D): cell-march preserves seed landblock id when no resident LB (no more lbX=0 outbound)
BuildCellSetAndPickContaining discarded the bool from TryGetTerrainOrigin — when the current landblock's terrain hadn't been applied yet (priority-apply in flight after a teleport or dungeon exit), blockOrigin was silently set to (0,0,0). The AdjustToOutside/GetOutsideLcoord math treated world-frame sphere coordinates as block-local and marched the cell one landblock per tick in the direction of movement until lbX or lbY underflowed to 0x00. ACE rejected every subsequent move as a failed transition. Fix: honor the bool return. When terrain is unregistered for an OUTDOOR seed (low < 0x0100), return currentCellId verbatim — "no block-local frame → preserve". This mirrors the NO-LANDBLOCK verbatim contract in PhysicsEngine.Resolve and is correct: the cell stays last-known-correct until terrain registers. Indoor seeds are explicitly excluded (blockOrigin is never consumed by the indoor pick path; outdoorPickAllowed=false for indoor seeds). Reproduce + verify via CellMarchLandblockPreservationTests (two new FAILING-before tests: WestEdge and SouthEdge with empty cache, no anchor → lbX/lbY preserved). TeleportFarTownRunawayTests updated: no-anchor path now also preserves (pre-fix it marched south to 0x59; post-fix returns currentCell unchanged). CellTransitFindCellSetTests, Issue112MembershipTests, PhysicsEngineTests: added RegisterTerrain for the streaming-center block (in production it is always resident before outdoor resolves run; tests that used blockOrigin=(0,0,0) as an implicit fallback now register the block explicitly). All 1567 tests pass. Divergence AD-30 added to retail-divergence-register.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
aba882cec6
commit
02f4be72c0
7 changed files with 144 additions and 15 deletions
|
|
@ -17,9 +17,10 @@ namespace AcDream.Core.Tests.Physics;
|
|||
// re-derives the SAME (consistent) cell and never marches.
|
||||
//
|
||||
// These tests exercise CellTransit.FindCellSet directly with an EMPTY cache (so the
|
||||
// neighbour landblock is unstreamed → the legacy path's (0,0) fallback fires) and
|
||||
// compare the carried-anchor pick against the legacy pick. The cascade is direction-
|
||||
// agnostic, so both a south and an east edge crossing are covered.
|
||||
// neighbour landblock is unstreamed → TryGetTerrainOrigin returns false). With
|
||||
// #145 Slice 3 (CarriedBlockOrigin), the explicit anchor prevents the march. With
|
||||
// #145 D (2026-06-22, the TryGetTerrainOrigin-bool fix), the no-anchor path ALSO
|
||||
// preserves the seed — "no frame → preserve verbatim". Both are verified here.
|
||||
public class TeleportFarTownRunawayTests
|
||||
{
|
||||
private static int LbX(uint cellId) => (int)((cellId >> 24) & 0xFFu);
|
||||
|
|
@ -38,10 +39,10 @@ public class TeleportFarTownRunawayTests
|
|||
uint withAnchor = CellTransit.FindCellSet(cache, spheres, 1, currentCell, out _, anchor);
|
||||
Assert.Equal(0x5A, LbY(withAnchor)); // stays in 0xC95A — no march
|
||||
|
||||
// Legacy path (no anchor → TryGetTerrainOrigin returns (0,0) for the
|
||||
// unstreamed neighbour) marches the cell one landblock south.
|
||||
uint legacy = CellTransit.FindCellSet(cache, spheres, 1, currentCell, out _, null);
|
||||
Assert.True(LbY(legacy) < 0x5A, $"legacy should march south of 0x5A, got 0x{LbY(legacy):X2}");
|
||||
// #145 D (2026-06-22): no-anchor path also preserves when terrain is unregistered.
|
||||
// Pre-D this marched south to 0x59; post-D returns currentCell unchanged.
|
||||
uint noAnchor = CellTransit.FindCellSet(cache, spheres, 1, currentCell, out _, null);
|
||||
Assert.Equal(currentCell, noAnchor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -57,7 +58,8 @@ public class TeleportFarTownRunawayTests
|
|||
uint withAnchor = CellTransit.FindCellSet(cache, spheres, 1, currentCell, out _, anchor);
|
||||
Assert.Equal(0xCA, LbX(withAnchor)); // stays in 0xCA5B — no march
|
||||
|
||||
uint legacy = CellTransit.FindCellSet(cache, spheres, 1, currentCell, out _, null);
|
||||
Assert.True(LbX(legacy) > 0xCA, $"legacy should march east of 0xCA, got 0x{LbX(legacy):X2}");
|
||||
// #145 D: no-anchor path also preserves when terrain is unregistered.
|
||||
uint noAnchor = CellTransit.FindCellSet(cache, spheres, 1, currentCell, out _, null);
|
||||
Assert.Equal(currentCell, noAnchor);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue