Capture current mission, AI, map and administration development
Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
// Private diagnostic injected only into the frozen test addon.
|
||||
modded class SCR_BaseItemSupportStationComponent
|
||||
{
|
||||
protected int m_ERRFixtureAdds;
|
||||
protected int m_ERRFixtureRemoves;
|
||||
protected int m_ERRFixtureResourceCalls;
|
||||
protected override void AddRemoveOnDamageStateChanged(IEntity owner, bool subscribe)
|
||||
{
|
||||
super.AddRemoveOnDamageStateChanged(owner, subscribe);
|
||||
if (subscribe) m_ERRFixtureAdds++;
|
||||
else m_ERRFixtureRemoves++;
|
||||
}
|
||||
protected override void TEMP_OnInteractorReplicated()
|
||||
{
|
||||
m_ERRFixtureResourceCalls++;
|
||||
super.TEMP_OnInteractorReplicated();
|
||||
}
|
||||
void ERR_FixtureCatalogLoss() { m_EntityCatalogManager = null; }
|
||||
void ERR_FixtureResourceEvent()
|
||||
{
|
||||
SCR_ResourceComponent resource = GetResourceComponent();
|
||||
if (resource) resource.TEMP_GetOnInteractorReplicated().Invoke();
|
||||
}
|
||||
bool ERR_FixtureReady() { return m_EntityCatalogManager != null && m_ERRFixtureAdds == 1; }
|
||||
int ERR_FixtureRemoves() { return m_ERRFixtureRemoves; }
|
||||
int ERR_FixtureCalls() { return m_ERRFixtureResourceCalls; }
|
||||
}
|
||||
modded class ArmaReforgerScripted
|
||||
{
|
||||
protected int m_ERRFixtureStage;
|
||||
protected float m_ERRFixtureWait;
|
||||
protected IEntity m_ERRFixtureKit;
|
||||
protected SCR_BaseItemSupportStationComponent m_ERRFixtureStation;
|
||||
protected int m_ERRFixtureFailures;
|
||||
protected void ERR_FixtureCheck(bool pass, string label)
|
||||
{
|
||||
if (!pass) m_ERRFixtureFailures++;
|
||||
if (pass) Print("ERR CATALOG DIAG PASS: " + label);
|
||||
else Print("ERR CATALOG DIAG FAIL: " + label);
|
||||
}
|
||||
protected IEntity ERR_FixtureSpawnKit()
|
||||
{
|
||||
EntitySpawnParams params = new EntitySpawnParams(); params.TransformMode = ETransformMode.WORLD;
|
||||
params.Transform[3] = "6000 200 7000";
|
||||
return SpawnEntityPrefab(Resource.Load("{AE578EEA4244D41F}Prefabs/Items/Equipment/Kits/MedicalKit_01/MedicalKit_01_US.et"), GetWorld(), params);
|
||||
}
|
||||
override void OnUpdate(BaseWorld world, float timeslice)
|
||||
{
|
||||
super.OnUpdate(world, timeslice);
|
||||
if (m_ERRFixtureStage == 3 || !ERR_GameMode.Get() || !ERR_GameMode.Get().Active()) return;
|
||||
m_ERRFixtureWait += timeslice;
|
||||
if (m_ERRFixtureWait < 2) return;
|
||||
m_ERRFixtureWait = 0;
|
||||
if (m_ERRFixtureStage == 0)
|
||||
{
|
||||
IEntity transientKit = ERR_FixtureSpawnKit();
|
||||
ERR_FixtureCheck(transientKit != null, "real transient kit spawned before delayed initialization");
|
||||
if (transientKit) SCR_EntityHelper.DeleteEntityAndChildren(transientKit);
|
||||
m_ERRFixtureKit = ERR_FixtureSpawnKit();
|
||||
if (m_ERRFixtureKit) m_ERRFixtureStation = SCR_BaseItemSupportStationComponent.Cast(m_ERRFixtureKit.FindComponent(SCR_BaseItemSupportStationComponent));
|
||||
ERR_FixtureCheck(m_ERRFixtureStation != null, "real item support station spawned");
|
||||
m_ERRFixtureStage = 1;
|
||||
return;
|
||||
}
|
||||
if (m_ERRFixtureStage == 1)
|
||||
{
|
||||
if (m_ERRFixtureStation)
|
||||
{
|
||||
ERR_FixtureCheck(m_ERRFixtureStation.ERR_FixtureReady(), "native catalog and damage subscription initialized");
|
||||
int beforeCalls = m_ERRFixtureStation.ERR_FixtureCalls();
|
||||
m_ERRFixtureStation.ERR_FixtureResourceEvent();
|
||||
int calls = m_ERRFixtureStation.ERR_FixtureCalls();
|
||||
ERR_FixtureCheck(calls == beforeCalls + 1, "real resource callback subscribed before cleanup");
|
||||
SCR_EntityCatalogManagerComponent globalCatalog = SCR_EntityCatalogManagerComponent.GetInstance();
|
||||
m_ERRFixtureStation.ERR_FixtureCatalogLoss();
|
||||
m_ERRFixtureStation.OnDelete(m_ERRFixtureKit);
|
||||
m_ERRFixtureStation.OnDelete(m_ERRFixtureKit);
|
||||
ERR_FixtureCheck(m_ERRFixtureStation.ERR_FixtureRemoves() == 1, "catalog loss cleanup detaches damage once across duplicate delete callbacks");
|
||||
m_ERRFixtureStation.ERR_FixtureResourceEvent();
|
||||
ERR_FixtureCheck(m_ERRFixtureStation.ERR_FixtureCalls() == calls, "native resource callback detached even on non-range kit");
|
||||
ERR_FixtureCheck(globalCatalog && globalCatalog == SCR_EntityCatalogManagerComponent.GetInstance(), "global catalog unchanged by kit-local fault injection");
|
||||
}
|
||||
if (m_ERRFixtureKit) SCR_EntityHelper.DeleteEntityAndChildren(m_ERRFixtureKit);
|
||||
m_ERRFixtureKit = null; m_ERRFixtureStation = null;
|
||||
m_ERRFixtureStage = 2;
|
||||
return;
|
||||
}
|
||||
m_ERRFixtureStage = 3;
|
||||
PrintFormat("ERR CATALOG DIAG COMPLETE failures=%1", m_ERRFixtureFailures);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user