From 8a9b15e6a9b58adf24c0981f117cf96d4711c1ef Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 14 May 2026 07:10:23 +0200 Subject: [PATCH] refactor(B.4c): share IsDoorName predicate + durable comment + use UM locals Code-quality review of the [door-cycle] diagnostic flagged three items: - Important: open-coded doorInfo.Name == "Door" duplicated IsDoorSpawn's predicate. Introduces IsDoorName(string?) as the shared core both IsDoorSpawn and the diagnostic call. - Minor: the diagnostic's comment said "Phase B.4c" which rots after archival; rewrite to use the durable [door-cycle] grep target instead. - Minor: the diagnostic re-read update.MotionState.Stance / ForwardCommand instead of the stance/command locals every other diagnostic in the method uses. Switched to the locals for pattern consistency. No behavior change. Build green; tests 1046/8 baseline unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/AcDream.App/Rendering/GameWindow.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/AcDream.App/Rendering/GameWindow.cs b/src/AcDream.App/Rendering/GameWindow.cs index 28de8fd..9fc7279 100644 --- a/src/AcDream.App/Rendering/GameWindow.cs +++ b/src/AcDream.App/Rendering/GameWindow.cs @@ -2128,12 +2128,16 @@ public sealed class GameWindow : IDisposable } /// - /// Phase B.4c — door detection by server-sent name. Doors fail the - /// generic multi-frame-idle gate at line 2692 (no idle cycle), so we - /// register them via a sibling branch with a state-seeded sequencer. + /// Door detection by server-sent name. Doors fail the generic + /// multi-frame-idle gate at line 2692 (no idle cycle), so we register + /// them via a sibling branch with a state-seeded sequencer. Shared + /// with the [door-cycle] UM dispatch diagnostic — both sites must + /// agree on the name predicate. /// + private static bool IsDoorName(string? name) => name == "Door"; + private static bool IsDoorSpawn(AcDream.Core.Net.WorldSession.EntitySpawn spawn) - => spawn.Name == "Door"; + => IsDoorName(spawn.Name); private void OnLiveEntitySpawnedLocked(AcDream.Core.Net.WorldSession.EntitySpawn spawn) { @@ -3149,13 +3153,13 @@ public sealed class GameWindow : IDisposable $"| seq now style=0x{seqStyle:X8} motion=0x{seqMotion:X8}"); } - // Phase B.4c — durable per-Door UM dispatch trail for visual-test grep. + // Per-Door UM dispatch trail; grep [door-cycle] in launch.log to verify door animation. if (AcDream.Core.Physics.PhysicsDiagnostics.ProbeBuildingEnabled && _liveEntityInfoByGuid.TryGetValue(update.Guid, out var doorInfo) - && doorInfo.Name == "Door") + && IsDoorName(doorInfo.Name)) { Console.WriteLine(System.FormattableString.Invariant( - $"[door-cycle] guid=0x{update.Guid:X8} stance=0x{update.MotionState.Stance:X4} cmd=0x{(update.MotionState.ForwardCommand ?? 0u):X4}")); + $"[door-cycle] guid=0x{update.Guid:X8} stance=0x{stance:X4} cmd=0x{(command ?? 0u):X4}")); } // Wire server-echoed RunRate first — used for the player's own