// Opt-in engine fixture: physical radios and production delivery routes only. #ifdef WORKBENCH modded class ERR_HQ { vector ERR_ProbeResponseOrigin() { if (m_Units.IsEmpty() || !m_Units[0].Group) return vector.Zero; return m_Units[0].Group.GetOrigin() + "0 0 20"; } bool ERR_ProbeDeliveredResponse() { foreach (ERR_HQUnit unit : m_Units) if (unit.Assignment && unit.Waypoint && unit.Group != unit.Assignment.Source) return true; return false; } bool ERR_ProbeUniqueAssignments() { array waypoints = {}; foreach (ERR_HQUnit unit : m_Units) { if (!unit.Waypoint) continue; if (!unit.Assignment || waypoints.Contains(unit.Waypoint)) return false; waypoints.Insert(unit.Waypoint); } return m_Units.Count() == 3 && waypoints.Count() > 0 && Assigned() <= m_Mode.Settings().Get("supportSquadLimit"); } string ERR_ProbePerception() { int targets, sightings, radios; foreach (ERR_HQUnit unit : m_Units) { if (unit.Radio) radios++; if (!unit.Utility) continue; array samples = {}; ERR_HQObservation.Gather(unit.Utility, GetGame().GetWorld().GetWorldTime(), samples); sightings += samples.Count(); if (unit.Utility.m_Perception) targets += unit.Utility.m_Perception.m_aTargets.Count(); } return string.Format("%1; radios=%2 targets=%3 fresh visual samples=%4", Status(), radios, targets, sightings); } ERR_HQRoute ERR_ProbeRoute(IEntity carrier = null, bool downlink = false) { if (carrier) return m_Network.Route(carrier, downlink); foreach (ERR_HQUnit unit : m_Units) if (unit.Radio) return m_Network.Route(unit.Radio, downlink); return null; } bool ERR_ProbeSquadsReady() { if (m_Units.Count() != 3) return false; foreach (ERR_HQUnit unit : m_Units) { if (!unit.Group || ERR_HQRadio.Capability(unit.Radio) != 2) return false; array agents = {}; unit.Group.GetAgents(agents); if (agents.Count() != 6) return false; } return true; } } class ERR_NativeRadioProbe { protected ref ERR_HQRoute m_Route; protected IEntity m_Carrier; protected int m_Step; int Tick(ERR_HQ hq, float now) { if (!hq) return -1; if (m_Step == 0) { if (!hq.ERR_ProbeSquadsReady()) return 0; Print("ERR SMOKE PASS: three physical six-person squads each have a manpack operator"); m_Route = hq.ERR_ProbeRoute(); if (!m_Route || m_Route.Nodes.IsEmpty()) return -1; m_Carrier = m_Route.Nodes[0].Carrier; m_Route.MessageId = hq.Journal().Message(); m_Step = 1; } int result = m_Route.Advance(now, hq.Journal()); if (result == 0) return 0; if (m_Step == 3) { if (result >= 0) return -1; Print("ERR SMOKE PASS: removing receiving manpack interrupts an in-flight HQ order"); return 1; } if (result < 0) return -1; if (m_Step == 1) Print("ERR SMOKE PASS: physical manpack uplink delivers to HQ"); if (m_Step == 2) Print("ERR SMOKE PASS: HQ downlink delivers to a physical receiver"); m_Route = hq.ERR_ProbeRoute(m_Carrier, true); if (!m_Route || m_Route.Nodes.IsEmpty()) return -1; m_Route.MessageId = hq.Journal().Message(); m_Step++; if (m_Step == 3) { // Start HQ transmission, then remove the actual receiving equipment. if (m_Route.Advance(now, hq.Journal()) != 0) return -1; IEntity receiver = m_Route.Nodes[0].Carrier; InventoryStorageManagerComponent inventory = InventoryStorageManagerComponent.Cast(receiver.FindComponent(InventoryStorageManagerComponent)); if (!inventory) return -1; array items = {}; inventory.GetItems(items); foreach (IEntity item : items) if (item && item.FindComponent(BaseRadioComponent)) SCR_EntityHelper.DeleteEntityAndChildren(item); } return 0; } } #endif