diff --git a/src/AcDream.Core/Physics/CellTransit.cs b/src/AcDream.Core/Physics/CellTransit.cs index 900157b..bdacceb 100644 --- a/src/AcDream.Core/Physics/CellTransit.cs +++ b/src/AcDream.Core/Physics/CellTransit.cs @@ -494,6 +494,11 @@ public static class CellTransit } } + if (PhysicsDiagnostics.ProbeCellSetEnabled) + { + PhysicsDiagnostics.LogCellSetBuild(currentCellId, worldSphereCenter, candidates); + } + // Containment test: for each candidate, transform worldSphereCenter to // local and test PointInsideCellBsp. foreach (uint candId in candidates) diff --git a/src/AcDream.Core/Physics/PhysicsDiagnostics.cs b/src/AcDream.Core/Physics/PhysicsDiagnostics.cs index bb9008d..260ed07 100644 --- a/src/AcDream.Core/Physics/PhysicsDiagnostics.cs +++ b/src/AcDream.Core/Physics/PhysicsDiagnostics.cs @@ -69,6 +69,35 @@ public static class PhysicsDiagnostics public static bool ProbeBuildingEnabled { get; set; } = Environment.GetEnvironmentVariable("ACDREAM_PROBE_BUILDING") == "1"; + /// + /// A6.P5 (2026-05-25) — dump the cellSet that + /// BuildCellSetAndPickContaining produces. One line per call: + /// seed cell, sphere world XY, candidate count, and the full candidate + /// list (hex). Pair with [bsp-test] / [resolve] to see + /// whether the door's outdoor cell is reachable from the player's + /// current indoor cell via the portal-walk. + /// + public static bool ProbeCellSetEnabled { get; set; } + = Environment.GetEnvironmentVariable("ACDREAM_PROBE_CELLSET") == "1"; + + public static void LogCellSetBuild( + uint seedCellId, + System.Numerics.Vector3 sphereCenter, + System.Collections.Generic.IReadOnlyCollection cellSet) + { + if (!ProbeCellSetEnabled) return; + var ids = new System.Text.StringBuilder(); + bool first = true; + foreach (uint id in cellSet) + { + if (!first) ids.Append(','); + ids.Append(System.FormattableString.Invariant($"0x{id:X8}")); + first = false; + } + Console.WriteLine(System.FormattableString.Invariant( + $"[cellset-build] seed=0x{seedCellId:X8} sphere=({sphereCenter.X:F3},{sphereCenter.Y:F3},{sphereCenter.Z:F3}) count={cellSet.Count} ids={ids}")); + } + /// /// L.2d slice 1 (2026-05-13). Diagnostic side-channel: the /// that