using System; namespace AcDream.Core.Physics; /// /// L.2a slice 1 (2026-05-12) — runtime-toggleable physics probe flags. /// Initialized from env vars at process start; flippable at runtime via /// the DebugPanel mirror (or by direct assignment). Log call sites read /// these statics so a checkbox toggle takes effect on the next resolve /// without relaunching. /// /// /// L.2d slice 1 (2026-05-13) adds + /// the diagnostic side-channel. Future /// slices may fold the older ACDREAM_DUMP_* env vars into this /// class for unified runtime toggling. Until then, those older flags /// remain sticky-at-startup per their original implementation. /// /// public static class PhysicsDiagnostics { /// /// When true, emits /// one structured [resolve] line per call: input + target + /// output position/cell, grounded state, contact-plane status, /// collision-normal validity, walkable polygon status, moving entity /// id. Initial state from ACDREAM_PROBE_RESOLVE=1. /// public static bool ProbeResolveEnabled { get; set; } = Environment.GetEnvironmentVariable("ACDREAM_PROBE_RESOLVE") == "1"; /// /// When true, every change to PlayerMovementController.CellId /// emits one [cell-transit] line: old → new cell, current /// world position, reason tag (resolver / teleport). /// Initial state from ACDREAM_PROBE_CELL=1. /// public static bool ProbeCellEnabled { get; set; } = Environment.GetEnvironmentVariable("ACDREAM_PROBE_CELL") == "1"; /// /// L.2d slice 1 (2026-05-13). When true, every BSP-shadow-entry hit /// attributed by TransitionTypes.FindObjCollisions emits a /// multi-line [resolve-bldg] entry: which part (partIdx vs 0), /// physics-BSP root radius vs visual AABB radius, world-space entity /// origin, and the specific hit polygon's vertices in both /// object-local and world space. Designed to distinguish the three /// L.2d hypotheses (wrong BSP loaded / over-registered parts / /// BSPQuery flaw) from a single Holtburg-doorway capture. /// /// /// Also gates a one-time [entity-source] log line at every /// ShadowObjects.Register(...) call site in GameWindow /// — makes entityId=0xA9B479 in a probe line greppable to its /// source registration within the same log file. /// /// /// /// Initial state from ACDREAM_PROBE_BUILDING=1. Mirrorable /// via DebugVM.ProbeBuilding when ACDREAM_DEVTOOLS=1. /// /// /// /// Spec: docs/superpowers/specs/2026-05-13-l2d-cbuildingobj-collision-design.md. /// /// public static bool ProbeBuildingEnabled { get; set; } = Environment.GetEnvironmentVariable("ACDREAM_PROBE_BUILDING") == "1"; /// /// L.2d slice 1 (2026-05-13). Diagnostic side-channel: the /// that /// recorded for the most recent collision-normal write. /// clears this to /// before each shadow-entry test and reads it /// back after, so emitting the [resolve-bldg] probe line can /// reference the actual hit poly without plumbing an out-param /// through BSPQuery's recursive private methods. /// /// /// Written by only when /// is true, so this stays /// zero-cost in normal play. Cylinder collisions leave this /// — the probe line emits /// hitPoly: n/a (cylinder) in that case. /// /// /// /// Not threadsafe — physics runs on a single thread. If that /// changes, this needs [ThreadStatic] or rethink. Deviation /// from spec component 4 (which described an out-param); the /// side-channel keeps BSPQuery's signature stable and the diagnostic /// path off the production code surface. /// /// public static ResolvedPolygon? LastBspHitPoly { get; set; } /// /// B.6 slice 1 (2026-05-14) — baseline trace for the local-player /// server-initiated auto-walk path (issue #63). When true, the /// following events emit one-line [autowalk-*] logs: /// /// [autowalk-out] on every SendUse /// / SendPickUp the local player issues — these are the /// packets that may trigger ACE's server-side CreateMoveToChain /// when the target is out of WithinUseRadius. /// [autowalk-mt] on every inbound /// UpdateMotion for the local player — captures the /// MovementType + MoveToPath + speed/runRate ACE sends. /// [autowalk-up] on every inbound /// UpdatePosition for the local player — answers "what's /// ACE's broadcast cadence during auto-walk?" /// /// Initial state from ACDREAM_PROBE_AUTOWALK=1. /// /// /// Spec: docs/superpowers/specs/2026-05-14-phase-b6-design.md /// §"Required investigation". /// /// public static bool ProbeAutoWalkEnabled { get; set; } = Environment.GetEnvironmentVariable("ACDREAM_PROBE_AUTOWALK") == "1"; /// /// 2026-05-16. Logs one line per `IsUseableTarget` call that takes /// the null-useability fallback path (creature pass / BF_DOOR pass / /// BF_LIFESTONE pass / etc.). Used to measure how often ACE's seed /// DB ships entities without `_useability` set — settles whether /// the fallback is live code or theoretical defense. /// /// /// Retail has NO fallback; null/zero useability blocks Use entirely /// (acclient_2013_pseudo_c.txt:402923 ItemHolder::UseObject — /// IsUseable==0 falls through to "cannot be used" branch). Our /// fallback exists because ACE genuinely sends null for many seed /// weenies. The probe quantifies "many". /// /// /// Toggle via env var ACDREAM_PROBE_USEABILITY_FALLBACK=1 /// or DebugPanel checkbox. /// public static bool ProbeUseabilityFallbackEnabled { get; set; } = Environment.GetEnvironmentVariable("ACDREAM_PROBE_USEABILITY_FALLBACK") == "1"; }