Fix BroadcastFeed chyron freeze past 32 lines and isolate Smoke.cs crater rebake

This commit is contained in:
Meta Vens 2026-12-04 14:28:09 +01:00
commit 3bd66c3b64
4 changed files with 45 additions and 13 deletions

View file

@ -90,17 +90,29 @@ public partial class Smoke : Node
Check(displacement > 3f, $"Expected player displacement > 3m after 60 frames, got {displacement:F2}m");
Check(!float.IsNaN(player.X) && !float.IsNaN(player.Y) && !float.IsNaN(player.Z), "Player position became NaN");
// Pause physics during the isolated crater check so AI contender track stamps in other tiles do not race it.
_main.SetScriptedInput(null);
_main.SetPhysicsProcess(false);
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
bool isHeadless = DisplayServer.GetName() == "headless";
int rebakesBefore = _main.Terrain.DirtyRebakes;
float cpuBefore = _main.Session.State.Terrain.SampleHeight(-48f, -48f);
bool hasGpuBefore = _main.Terrain.TrySampleBakedHeight(-48f, -48f, out float gpuBefore);
if (hasGpuBefore)
float gpuBefore = 0f;
if (!isHeadless)
{
Check(MathF.Abs(gpuBefore - cpuBefore) <= 0.25f,
$"Expected baked GPU height ({gpuBefore:F2}m) to match CPU height ({cpuBefore:F2}m) before crater");
bool hasGpuBefore = _main.Terrain.TrySampleBakedHeight(-48f, -48f, out gpuBefore);
Check(hasGpuBefore, "Expected GPU HeightViewport readback to succeed before crater");
if (hasGpuBefore)
{
Check(MathF.Abs(gpuBefore - cpuBefore) <= 0.25f,
$"Expected baked GPU height ({gpuBefore:F2}m) to match CPU height ({cpuBefore:F2}m) before crater");
}
}
_main.Session.State.Terrain.StampCrater(-48f, -48f, radius: 5f, depth: 1.4f);
await ToSignal(GetTree(), SceneTree.SignalName.PhysicsFrame);
_main.Terrain.Sync(_main.Session.State.Terrain);
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
float cpuAfter = _main.Session.State.Terrain.SampleHeight(-48f, -48f);
@ -109,18 +121,20 @@ public partial class Smoke : Node
Check(_main.Terrain.DirtyRebakes == rebakesBefore + 1,
$"Expected 1 dirty tile rebake from isolated crater stamp, got {_main.Terrain.DirtyRebakes - rebakesBefore}");
if (_main.Terrain.TrySampleBakedHeight(-48f, -48f, out float gpuAfter))
if (!isHeadless)
{
Check(MathF.Abs(gpuAfter - cpuAfter) <= 0.25f,
$"Expected baked GPU height ({gpuAfter:F2}m) to match CPU height ({cpuAfter:F2}m) after crater");
if (hasGpuBefore)
bool hasGpuAfter = _main.Terrain.TrySampleBakedHeight(-48f, -48f, out float gpuAfter);
Check(hasGpuAfter, "Expected GPU HeightViewport readback to succeed after crater");
if (hasGpuAfter)
{
Check(MathF.Abs(gpuAfter - cpuAfter) <= 0.25f,
$"Expected baked GPU height ({gpuAfter:F2}m) to match CPU height ({cpuAfter:F2}m) after crater");
Check(gpuAfter < gpuBefore - 0.8f,
$"Expected baked GPU height to drop after crater (before {gpuBefore:F2}m, after {gpuAfter:F2}m)");
}
}
_main.SetScriptedInput(null);
_main.SetPhysicsProcess(true);
}
private void Check(bool condition, string message)