using System;
namespace AcDream.App.Streaming;
///
/// TEMP diagnostic (#138-B avatar-vanish). Env-gated (ACDREAM_PROBE_ENT=1)
/// trace of the persistent player entity across teleport streaming churn:
/// whether it is present in the render draw-DATA (
/// flat view) and whether it survives the dynamics CULL
/// (RetailPViewRenderer.DrawDynamicsLast).
///
/// The two halves answer the decisive question: is the avatar
/// "missing for a moment" because it is absent from the draw set
/// (re-injected into the pending bucket while its landblock re-streams), or
/// because it is present but culled (in the dynamics list, dropped by
/// the outside-stage / viewcone gate)?
///
/// STRIP once #138-B is root-caused (throwaway, like the dense-town FPS
/// apparatus). Observation-only — emits no behavior change.
///
internal static class EntityVanishProbe
{
public static readonly bool Enabled =
Environment.GetEnvironmentVariable("ACDREAM_PROBE_ENT") == "1";
/// Player server guid, set once at world entry so the draw-side
/// [dyn] line can single out the avatar without plumbing the guid
/// through the render stack.
public static uint PlayerGuid;
public static void Log(string msg)
{
if (Enabled) Console.WriteLine(msg);
}
private static string _lastPlayerDyn = "";
/// Emit a [dyn] player line only when the outcome string
/// changes — a stationary, drawn avatar must not spam one line per frame
/// (that console+Tee I/O would itself depress FPS and bury the signal).
/// Fires on cell change or DRAWN↔CULLED transition.
public static void LogPlayerDynOnChange(string status)
{
if (!Enabled) return;
if (status == _lastPlayerDyn) return;
_lastPlayerDyn = status;
Console.WriteLine("[dyn] player " + status);
}
}