Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
46 lines
2.2 KiB
C
46 lines
2.2 KiB
C
modded class ArmaReforgerScripted
|
|
{
|
|
protected bool m_ERRSawBootstrap;
|
|
protected bool m_ERRFinished;
|
|
protected int m_ERRInitialCount;
|
|
protected int m_ERRFailures;
|
|
protected void ERR_Check(bool pass, string label)
|
|
{
|
|
if (pass) Print("ERR PROGRESSIVE PASS: " + label);
|
|
else { m_ERRFailures++; Print("ERR PROGRESSIVE FAIL: " + label); }
|
|
}
|
|
override void OnUpdate(BaseWorld world, float timeslice)
|
|
{
|
|
super.OnUpdate(world, timeslice);
|
|
ERR_GameMode mode = ERR_GameMode.Get();
|
|
if (m_ERRFinished || !mode || !mode.Active() || !mode.Sites()) return;
|
|
if (!m_ERRSawBootstrap)
|
|
{
|
|
m_ERRSawBootstrap = true;
|
|
m_ERRInitialCount = mode.Sites().Count();
|
|
ERR_Check(m_ERRInitialCount == 2, "active mission with only prison and extraction ready");
|
|
ERR_Check(mode.WorldPreparing(), "background still pending after spawn admission");
|
|
ERR_Check(mode.Sites().Find("everon-prison-1") != null, "real prison retained");
|
|
// Simulate an early prison exit, exercising reveal catch-up on late sites.
|
|
ERR_Check(mode.Transition(ERR_Phase.RADIO_SEARCH), "early escape while world generation continues");
|
|
}
|
|
if (mode.WorldPreparing()) return;
|
|
ERR_Check(mode.Sites().Count() > m_ERRInitialCount, "late sites adopted into live mission");
|
|
array<ERR_LocationComponent> locations = {}; mode.Locations(locations);
|
|
ERR_Check(locations.Count() == mode.Sites().Count(), "only committed locations registered, no duplicates");
|
|
bool radio, revealed = true, registered = true;
|
|
for (int i = 0; i < mode.Sites().Count(); i++)
|
|
{
|
|
ERR_SiteRuntime site = mode.Sites().At(i);
|
|
if (site.Definition.Kind == ERR_LocationKind.RADIO) radio = true;
|
|
if (!site.Location || !site.Location.Prepared() || !mode.HasLocation(site.Location)) registered = false;
|
|
if (site.Definition.RevealOnEscape && site.Location.Knowledge() != 2) revealed = false;
|
|
}
|
|
ERR_Check(radio && registered, "required radio and late locations ready");
|
|
ERR_Check(revealed, "late reveal-on-escape sites caught up to current phase");
|
|
ERR_Check(mode.Active(), "mission remains active on an empty server");
|
|
m_ERRFinished = true;
|
|
PrintFormat("ERR PROGRESSIVE COMPLETE failures=%1 sites=%2", m_ERRFailures, mode.Sites().Count());
|
|
}
|
|
}
|