
modded class ArmaReforgerScripted
{
 protected float m_ERRManagerNext;
 override void OnUpdate(BaseWorld world, float timeslice)
 {
  super.OnUpdate(world, timeslice);
  m_ERRManagerNext -= timeslice;
  if (m_ERRManagerNext > 0) return;
  m_ERRManagerNext = 5;
  ERR_GameMode mode = ERR_GameMode.Get();
  if (!mode || !mode.ERR_TerrainTakenOver()) return;
  ChimeraWorld chimera = ChimeraWorld.CastFrom(GetWorld());
  PrintFormat("ERR NATIVE POINTERS: faction=%1 loadouts=%2 perception=%3 chat=%4 radio=%5", GetFactionManager(), GetLoadoutManager(), GetPerceptionManager(), GetChat(), chimera.GetRadioManager());
  SCR_AdditionalGameModeSettingsComponent settings = SCR_AdditionalGameModeSettingsComponent.GetInstance();
  SCR_PerceivedFactionManagerComponent perceived = SCR_PerceivedFactionManagerComponent.GetInstance();
  SCR_PlayerListedAdminManagerComponent admins = SCR_PlayerListedAdminManagerComponent.GetInstance();
  SCR_IdentityManagerComponent identity = SCR_IdentityManagerComponent.GetInstance();
  SCR_EntityCatalogManagerComponent catalog = SCR_EntityCatalogManagerComponent.GetInstance();
  PrintFormat("ERR FACTION CACHE PROOF: catalog=%1 identity=%2", catalog && catalog.ERR_ProbeFactionCurrent(), identity && identity.ERR_ProbeFactionCurrent());
  SCR_ArsenalManagerComponent arsenal;
  SCR_ArsenalManagerComponent.GetArsenalManager(arsenal);
  SCR_GroupsManagerComponent groups = SCR_GroupsManagerComponent.GetInstance();
  SCR_SupportStationManagerComponent support = SCR_SupportStationManagerComponent.GetInstance();
  SCR_MapMarkerManagerComponent markers = SCR_MapMarkerManagerComponent.GetInstance();
  SCR_TaskFinishHistoryManagerComponent history = SCR_TaskFinishHistoryManagerComponent.GetInstance();
  SCR_TaskManagerUIComponent taskUI = SCR_TaskManagerUIComponent.GetInstance();
  SCR_TextsTaskManagerComponent texts = SCR_TextsTaskManagerComponent.GetInstance();
  SCR_RespawnSystemComponent respawn = SCR_RespawnSystemComponent.GetInstance();
  PrintFormat("ERR EXTRA MANAGERS: arsenal=%1 groups=%2 support=%3 markers=%4 history=%5 taskUI=%6 texts=%7 respawn=%8", arsenal && arsenal.GetOwner() == mode, groups && groups.GetOwner() == mode, support && support.GetOwner() == mode, markers && markers.GetOwner() == mode, history && history.GetOwner() == mode, taskUI && taskUI.GetOwner() == mode, texts && texts.GetOwner() == mode, respawn && respawn.GetOwner() == mode);
  PrintFormat("ERR MANAGER PROOF: settings=%1 perceived=%2 admins=%3 identity=%4 catalog=%5 factions=%6 loadouts=%7 perception=%8 chat=%9", settings && settings.GetOwner() == mode, perceived && perceived.GetOwner() == mode, admins && admins.GetOwner() == mode, identity && identity.GetOwner() == mode, catalog && catalog.GetOwner() == mode, GetFactionManager() != null, GetLoadoutManager() != null, GetPerceptionManager() != null, GetChat() != null);
 }
}

modded class SCR_EntityCatalogManagerComponent
{
 bool ERR_ProbeFactionCurrent() { return m_FactionManager && m_FactionManager == GetGame().GetFactionManager(); }
}
modded class SCR_IdentityManagerComponent
{
 bool ERR_ProbeFactionCurrent() { return m_FactionManager && m_FactionManager == GetGame().GetFactionManager(); }
}
class ERR_PairRestartProof
{
 static bool Requested;
}
modded class ArmaReforgerScripted
{
 protected float m_ERRRestartDelay = 80;
 override void OnUpdate(BaseWorld world, float timeslice)
 {
  super.OnUpdate(world, timeslice);
  ERR_GameMode mode = ERR_GameMode.Get();
  if (!Replication.IsServer() || !mode || !mode.Active() || GetPlayerManager().GetPlayerCount() < 1 || ERR_PairRestartProof.Requested) return;
  m_ERRRestartDelay -= timeslice;
  if (m_ERRRestartDelay > 0) return;
  ERR_PairRestartProof.Requested = true;
  PrintFormat("ERR CONNECTED RESTART: players=%1 accepted=%2", GetPlayerManager().GetPlayerCount(), GameStateTransitions.RequestScenarioRestart());
 }
 override protected void OnBeforeWorldCleanup()
 {
  super.OnBeforeWorldCleanup();
  PrintFormat("ERR PAIR CLEANUP: server=%1 clientFlag=%2 stage=%3 worldClear=%4 oldModeClear=%5 elapsed=%6 admissions=%7 airports=%8 slots=%9", Replication.IsServer(), GetGame().ERR_IsClientTerrainTakeover(), m_ERRTerrainStage, m_ERRTerrainWorld == null, m_ERRTerrainOriginal == null, m_ERRTerrainElapsed, m_ERRTerrainAdmissions.Count(), m_ERRTerrainAirfields.Count(), m_ERRTerrainMarkerSlots.Count());
 }
}
