Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
67 lines
3.5 KiB
Plaintext
67 lines
3.5 KiB
Plaintext
modded class ERR_HQ
|
|
{
|
|
void ERR_SearchFixtureReports(ERR_HQReport first, ERR_HQReport second = null)
|
|
{
|
|
m_Contacts.Clear();
|
|
if (first) m_Contacts.Insert(first);
|
|
if (second) m_Contacts.Insert(second);
|
|
}
|
|
}
|
|
modded class ERR_ReconFlightComponent
|
|
{
|
|
protected bool ERR_SearchCheck(bool ok, string label)
|
|
{
|
|
if (ok) Print("ERR SEARCH PASS: " + label);
|
|
else Print("ERR SEARCH FAIL: " + label, LogLevel.ERROR);
|
|
return ok;
|
|
}
|
|
bool ERR_SearchFixture(Vehicle aircraft, IEntity target)
|
|
{
|
|
m_Aircraft = aircraft;
|
|
float now = 1000000;
|
|
vector newestPosition = "3000 50 5000";
|
|
vector olderPosition = "5000 50 5000";
|
|
aircraft.SetOrigin(newestPosition + Vector(1446, 100, 0));
|
|
ERR_HQReport newest = new ERR_HQReport(); newest.Target = target; newest.Position = newestPosition; newest.ObservedAt = now - 1000; newest.MessageId = 101;
|
|
ERR_HQReport older = new ERR_HQReport(); older.Target = target; older.Position = olderPosition; older.ObservedAt = now - 5000; older.MessageId = 102;
|
|
ERR_HQ.Get().ERR_SearchFixtureReports(newest, older);
|
|
Search(now);
|
|
if (!ERR_SearchCheck(m_Center == newestPosition && m_HQSearch.Active, "newest observation wins over array insertion order")) return false;
|
|
Search(now + 90000);
|
|
if (!ERR_SearchCheck(m_Center == newestPosition && m_HQSearch.Active && m_HQSearch.SearchedMs == 0, "60-second expiry and 90-second sector timer cannot abort distant approach")) return false;
|
|
Search(now + 270000);
|
|
if (!ERR_SearchCheck(m_Center == newestPosition && m_HQSearch.Active, "cached scalar destination survives several minutes without fresh support report")) return false;
|
|
aircraft.SetOrigin(newestPosition + Vector(300, 100, 0));
|
|
for (int i = 1; i <= 119; i++) Search(now + 270000 + i * 1000);
|
|
if (!ERR_SearchCheck(m_Center == newestPosition && m_HQSearch.Active && m_HQSearch.SearchedMs == 119000, "two-minute local search starts only after reaching area")) return false;
|
|
Search(now + 390000);
|
|
if (!ERR_SearchCheck(!m_HQSearch.Active && m_Reason == "searching island sector", "exhausted HQ area returns to random sector search")) return false;
|
|
newest.ObservedAt = now + 395000; newest.Position = "4000 50 5000";
|
|
Search(now + 395000);
|
|
if (!ERR_SearchCheck(m_Center == newest.Position && m_HQSearch.Active, "new report interrupts random sector within five seconds")) return false;
|
|
m_HQSearch.Cancel(now + 396000);
|
|
Search(now + 400000);
|
|
if (!ERR_SearchCheck(!m_HQSearch.Active, "older HQ report cannot override more recent direct crew sighting")) return false;
|
|
ERR_HQ.Get().ERR_SearchFixtureReports(null);
|
|
return true;
|
|
}
|
|
}
|
|
modded class ArmaReforgerScripted
|
|
{
|
|
protected bool m_ERRSearchDone;
|
|
override void OnUpdate(BaseWorld world, float timeslice)
|
|
{
|
|
super.OnUpdate(world, timeslice);
|
|
if (m_ERRSearchDone || !world || !Replication.IsServer()) return;
|
|
ERR_GameMode mode = ERR_GameMode.Get();
|
|
if (!mode || !mode.Active() || !ERR_HQ.Get()) return;
|
|
m_ERRSearchDone = true;
|
|
EntitySpawnParams params = new EntitySpawnParams(); params.TransformMode = ETransformMode.WORLD; params.Transform[3] = "4400 150 5000";
|
|
Vehicle aircraft = Vehicle.Cast(SpawnEntityPrefab(Resource.Load("{C31F210ABE078192}Prefabs/ERR/ReconHelicopter.et"), world, params));
|
|
if (!aircraft) { Print("ERR SEARCH FAIL: fixture aircraft spawn", LogLevel.ERROR); return; }
|
|
ERR_ReconFlightComponent flight = ERR_ReconFlightComponent.Cast(aircraft.FindComponent(ERR_ReconFlightComponent));
|
|
if (!flight || !flight.ERR_SearchFixture(aircraft, mode)) return;
|
|
Print("ERR SEARCH COMPLETE: native production search integration");
|
|
}
|
|
}
|