#ifdef WORKBENCH // Injected only into a frozen private fixture copy. No public telemetry requests. modded class ERR_GameMode { protected int m_ERRCommunityTestStage; protected float m_ERRCommunityTestWait; protected ref ERR_CommunityStatistics m_ERRCommunityTestResult; protected override void EOnInit(IEntity owner) { super.EOnInit(owner); if (Replication.IsServer() && !SCR_Global.IsEditMode()) GetGame().GetCallqueue().CallLater(ERR_CommunityTest, 500, true); } protected bool ERR_CommunityCheck(bool ok, string detail) { if (ok) { Print("ERR SMOKE PASS: community " + detail); return true; } Print("ERR SMOKE FAIL: community " + detail, LogLevel.ERROR); GetGame().GetCallqueue().Remove(ERR_CommunityTest); return false; } protected void ERR_CommunityTest() { if (!PreparationError().IsEmpty()) { ERR_CommunityCheck(false, PreparationError()); return; } if (GetWorld().GetWorldTime() < m_ERRCommunityTestWait) return; if (m_ERRCommunityTestStage == 0) { if (!Active()) return; SCR_PlayerController pc = SCR_PlayerController.Cast(GetGame().GetPlayerController()); if (!pc || !pc.GetControlledEntity()) return; if (!ERR_CommunityCheck(GetAutoReloadDelay() == 120, "results remain open for two minutes before automatic restart")) return; string account = UUID.GenV4(); string first; string second; if (!ERR_CommunityCheck(ERR_TelemetryCredentials.Resolve("https://fixture.invalid/api/mission-events", account, first), "private credential saved")) return; if (!ERR_CommunityCheck(ERR_TelemetryCredentials.Resolve("https://fixture.invalid/api/mission-events", account, second) && first == second && first.Length() == 72, "native credential serialization preserves installation secret")) return; ERR_CommunityStatistics result = new ERR_CommunityStatistics(); result.schemaVersion = 1; result.serverId = account; result.missionId = UUID.GenV4(); result.eventId = UUID.GenV4(); result.terrain = GetGame().GetWorldFile(); result.outcome = "TEST_OUTCOME"; result.server = new ERR_CommunityMapRecord(); result.server.wins = 2; result.server.losses = 1; result.server.completed = 3; result.server.partialMissions = 0; result.allServers = new ERR_CommunityMapRecord(); result.allServers.wins = 7; result.allServers.losses = 3; result.allServers.completed = 10; result.allServers.partialMissions = 1; JsonSaveContext saved = new JsonSaveContext(); saved.EnableTypeDiscriminator(false); saved.WriteValue("community", result); JsonLoadContext loaded = new JsonLoadContext(); if (!ERR_CommunityCheck(loaded.LoadFromString(saved.SaveToString()) && loaded.ReadValue("community", m_ERRCommunityTestResult) && m_ERRCommunityTestResult.Matches(result.serverId, result.missionId, result.eventId, result.terrain, result.outcome), "native JSON roundtrip and current map/result validation")) return; if (!ERR_CommunityCheck(!m_ERRCommunityTestResult.Matches(result.serverId, result.missionId, result.eventId, "another-map", result.outcome), "another map is rejected")) return; ERR_PublishCommunityStatistics("Waiting for community map records..."); // Native end-screen fixture: this does not prove an organic escape route. m_Phase = ERR_Phase.EXTRACTION; ERR_Phase terminal = ERR_Phase.DEFEAT; if (result.outcome == "victory") terminal = ERR_Phase.VICTORY; if (!ERR_CommunityCheck(Transition(terminal), "native TEST_OUTCOME screen requested")) return; m_ERRCommunityTestStage = 1; m_ERRCommunityTestWait = GetWorld().GetWorldTime() + 2000; return; } if (m_ERRCommunityTestStage == 1) { ERR_PublishCommunityStatistics(m_ERRCommunityTestResult.Summary()); m_ERRCommunityTestStage = 2; m_ERRCommunityTestWait = GetWorld().GetWorldTime() + 1000; return; } if (m_ERRCommunityTestStage == 2) { MenuBase menu = GetGame().GetMenuManager().GetTopMenu(); if (!menu) return; TextWidget text = TextWidget.Cast(menu.GetRootWidget().FindAnyWidget("RoundStatistics")); foreach (string widgetName : {"Base_ContentHolder", "ERR_RoundResults", "ResultFrame", "GameOver_State", "StatisticsScroll", "RoundStatistics"}) { Widget measured = menu.GetRootWidget().FindAnyWidget(widgetName); if (!measured) continue; float width, height, x, y; measured.GetScreenSize(width, height); measured.GetScreenPos(x, y); PrintFormat("ERR RESULT GEOMETRY: %1 x=%2 y=%3 width=%4 height=%5 visible=%6 opacity=%7", widgetName, x, y, width, height, measured.IsVisible(), measured.GetOpacity()); if (!ERR_CommunityCheck(width > 0 && height > 0, widgetName + " has positive rendered dimensions")) return; } if (!ERR_CommunityCheck(text && text.IsVisible() && text.GetText() == ERR_RoundSummary() && text.GetText().Contains("All reporting servers: 7 wins | 3 failures | 70% win rate"), "open TEST_OUTCOME screen refreshes after late community result")) return; Print("ERR STATS UI READY: community TEST_OUTCOME screen"); JsonSaveContext ready = new JsonSaveContext(); ready.WriteValue("ready", true); ready.SaveToFile("$profile:results-ready.json"); System.MakeScreenshot("$logs:community-TEST_OUTCOME"); m_ERRCommunityTestStage = 3; m_ERRCommunityTestWait = GetWorld().GetWorldTime() + 5000; return; } Print("ERR SMOKE COMPLETE: community TEST_OUTCOME native credentials, JSON validation and result screen refresh"); GetGame().GetCallqueue().Remove(ERR_CommunityTest); } } #endif