Files
EscapistsReintroduced/docs/evidence/telemetry-server-name-2026-11-01/native-probe.c
T
2026-11-01 19:29:54 +01:00

30 lines
1.1 KiB
C

#ifdef WORKBENCH
modded class ERR_GameMode
{
protected override void StartScenario() {}
protected override void EOnInit(IEntity owner)
{
super.EOnInit(owner);
if (!SCR_Global.IsEditMode()) GetGame().GetCallqueue().CallLater(ServerNameProbe, 8000, false);
}
void ServerNameProbe()
{
if (ERR_TelemetryServerName.Resolve(" Manual name ") != "Manual name") { Print("ERR SMOKE FAIL: server name override", LogLevel.ERROR); return; }
string expected;
ServerConfig config = ServerLobbyApi.GetServerConfig();
if (config) expected = config.GetName();
expected.TrimInPlace();
if (expected.IsEmpty())
{
ServerInfo info = GetGame().GetServerInfo();
if (info) expected = info.GetName();
expected.TrimInPlace();
}
if (expected.Length() > 120) expected = expected.Substring(0, 120);
if (ERR_TelemetryServerName.Resolve("") != expected) { Print("ERR SMOKE FAIL: native server metadata resolution", LogLevel.ERROR); return; }
PrintFormat("ERR SMOKE PASS: native server-name API and override; serverConfigPresent=%1 resolvedLength=%2", config != null, expected.Length());
Print("ERR SMOKE COMPLETE: server-name");
}
}
#endif