Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
41 lines
1.5 KiB
C
41 lines
1.5 KiB
C
modded class ERR_ScenarioComponent
|
|
{
|
|
bool ERR_FixtureCancelPending()
|
|
{
|
|
if (!m_Finished || !m_PendingSite || m_Sites.Count() < 3) return false;
|
|
StopBackground();
|
|
return true;
|
|
}
|
|
}
|
|
modded class ArmaReforgerScripted
|
|
{
|
|
protected bool m_ERRCancelled;
|
|
protected bool m_ERRFinished;
|
|
protected int m_ERRCount;
|
|
protected float m_ERRWait;
|
|
override void OnUpdate(BaseWorld world, float timeslice)
|
|
{
|
|
super.OnUpdate(world, timeslice);
|
|
ERR_GameMode mode = ERR_GameMode.Get();
|
|
if (m_ERRFinished || !mode || !mode.Active()) return;
|
|
ERR_ScenarioComponent scenario = ERR_ScenarioComponent.Cast(mode.FindComponent(ERR_ScenarioComponent));
|
|
if (!m_ERRCancelled)
|
|
{
|
|
if (!scenario || !scenario.ERR_FixtureCancelPending()) return;
|
|
m_ERRCancelled = true;
|
|
m_ERRCount = mode.Sites().Count();
|
|
PrintFormat("ERR PROGRESSIVE PASS: cancelled unfinished late site; committed sites=%1", m_ERRCount);
|
|
return;
|
|
}
|
|
m_ERRWait += timeslice;
|
|
if (m_ERRWait < 4) return;
|
|
array<ERR_LocationComponent> locations = {}; mode.Locations(locations);
|
|
bool pass = !mode.WorldPreparing() && mode.Sites().Count() == m_ERRCount && locations.Count() == m_ERRCount;
|
|
ERR_SiteRuntime prison = mode.Sites().Find("everon-prison-1");
|
|
pass = pass && prison && prison.Location && mode.HasLocation(prison.Location);
|
|
m_ERRFinished = true;
|
|
if (pass) Print("ERR PROGRESSIVE COMPLETE failures=0; cancelled callbacks and partial location removed, committed prison/sites survive");
|
|
else Print("ERR PROGRESSIVE COMPLETE failures=1; cancellation failed");
|
|
}
|
|
}
|