#ifdef WORKBENCH modded class ERR_GameMode { IEntity m_RITestPlayer, m_RITestFolder; ERR_LocationComponent m_RITestClue; ERR_SiteRuntime m_RITestRadio; ref array m_RITestSites = {}; int m_RITestStage; float m_RITestWait, m_RITestDeadline; bool m_RITestStopped; override protected void EOnInit(IEntity owner) { super.EOnInit(owner); string kind; if (SCR_Global.IsEditMode() || !System.GetCLIParam("errSmokeOutcome", kind) || kind != "radio-intel") return; GetGame().GetCallqueue().CallLater(ERR_RITestTick, 100, true); } bool ERR_RITestCheck(bool condition, string label) { if (condition) { Print("ERR SMOKE PASS: radio-intel " + label); return true; } Print("ERR SMOKE FAIL: radio-intel " + label, LogLevel.ERROR); m_RITestStopped = true; GetGame().GetCallqueue().Remove(ERR_RITestTick); return false; } void ERR_RITestTick() { if (m_RITestStopped || !Active()) return; float now = GetWorld().GetWorldTime(); if (m_RITestDeadline > 0 && now > m_RITestDeadline) { ERR_RITestCheck(false, "deadline stage " + m_RITestStage); return; } if (now < m_RITestWait) return; if (m_RITestStage == 0) { m_RITestPlayer = GetGame().GetPlayerController().GetControlledEntity(); if (!m_RITestPlayer || !Players().CurrentActor(m_RITestPlayer)) return; DamageManagerComponent.Cast(m_RITestPlayer.FindComponent(DamageManagerComponent)).EnableDamageHandling(false); Settings().Set("intelRevealChancePercent", 100); m_RITestRadio = Sites().Find("everon-radio-1"); for (int i = 0; i < Sites().Count(); i++) { ERR_SiteRuntime site = Sites().At(i); if (site.Location.Kind() != ERR_LocationKind.PRISON && site.Location.Kind() != ERR_LocationKind.EXTRACTION && site.Location.Kind() != ERR_LocationKind.RADIO && !site.Definition.RevealOnEscape) m_RITestSites.Insert(site.Location); } if (!ERR_RITestCheck(m_RITestSites.Count() == 5 && !Discovery().RadioIntelAllowed(), "default five-site requirement locked in prepared world")) return; // A second real radio entity is the fixed document target, so observing the // original radio does not make the later automatic-document test a duplicate. IEntity clue = ERR_Actors.Spawn("{47D725F56A904ACE}Prefabs/ERR/RadioCamp.et", ERR_Actors.Ground(m_RITestPlayer.GetOrigin() + Vector(80,0,80))); Own(clue); m_RITestClue = ERR_LocationComponent.Cast(clue.FindComponent(ERR_LocationComponent)); if (!ERR_RITestCheck(m_RITestClue && m_RITestClue.Configure("fixture-radio", ERR_LocationKind.RADIO), "real extra radio target registered")) return; m_RITestFolder = ERR_Actors.Spawn(ERR_Resources.ObjectiveDocument(), m_RITestPlayer.GetOrigin()); ERR_DocumentComponent.Cast(m_RITestFolder.FindComponent(ERR_DocumentComponent)).SetTarget("fixture-radio"); InventoryStorageManagerComponent inventory = InventoryStorageManagerComponent.Cast(m_RITestPlayer.FindComponent(InventoryStorageManagerComponent)); if (!ERR_RITestCheck(inventory.TryInsertItem(m_RITestFolder), "fixed document inserted into real player inventory")) return; if (!ERR_RITestCheck(UnlockPrison(m_RITestPlayer), "ordinary prison escape remains available")) return; vector transform[4]; m_RITestPlayer.GetWorldTransform(transform); transform[3] = ERR_Actors.Ground(m_RITestRadio.Location.Position() + Vector(2,0,0)); ChimeraCharacter.Cast(m_RITestPlayer).Teleport(transform); m_RITestStage = 1; m_RITestWait = now + 2000; m_RITestDeadline = now + 15000; return; } if (m_RITestStage == 1) { if (!ERR_RITestCheck(!Discovery().IsSpent(m_RITestFolder) && m_RITestClue.Knowledge() == 0, "held fixed radio document stays unspent and undisclosed")) return; if (!ERR_RITestCheck(!Discovery().RadioIntelAllowed() && Sites().CanObserve(m_RITestPlayer, m_RITestRadio), "native line-of-sight physical radio discovery allowed before unlock")) return; Sites().Tick(now + 5000); if (!ERR_RITestCheck(m_RITestRadio.Location.Knowledge() == 2 && !Discovery().RadioIntelAllowed(), "actual site tick identifies physical radio without unlocking intel")) return; if (!ERR_RITestCheck(TuneRadio(m_RITestPlayer, m_RITestRadio.Location), "actual native radio defence starts while radio intel is locked")) return; for (int i = 0; i < 4; i++) m_RITestSites[i].Discover(0,100); if (!ERR_RITestCheck(!Discovery().RadioIntelAllowed(), "four distinct non-radio sites are insufficient")) return; m_RITestStage = 2; m_RITestWait = now + 2000; return; } if (m_RITestStage == 2) { if (!ERR_RITestCheck(!Discovery().IsSpent(m_RITestFolder) && m_RITestClue.Knowledge() == 0, "fixed clue still retained at four of five")) return; m_RITestSites[4].Discover(0,100); if (!ERR_RITestCheck(Discovery().RadioIntelAllowed(), "fifth distinct site unlocks radio intel")) return; m_RITestStage = 3; m_RITestWait = now + 2000; return; } if (m_RITestStage == 3) { if (!ERR_RITestCheck(Discovery().IsSpent(m_RITestFolder) && m_RITestClue.Knowledge() == 2 && m_RITestFolder != null, "held fixed document automatically reveals target after unlock and is retained")) return; Print("ERR SMOKE COMPLETE: radio-intel"); m_RITestStopped = true; GetGame().GetCallqueue().Remove(ERR_RITestTick); } } } #endif