modded class ERR_GameMode
{
 void ERR_GameMode(IEntitySource src, IEntity parent)
 {
  if (!GetGame() || Replication.IsServer()) return;
  PrintFormat("ERR CONSTRUCTOR: prior=%1 this=%2 same=%3", GetGame().GetGameMode(), this, GetGame().GetGameMode() == this);
  GetGame().ERR_ClientConstructorDrain(this);
 }
}
modded class ArmaReforgerScripted
{
 void ERR_ClientConstructorDrain(ERR_GameMode incoming)
 {
  SCR_BaseGameMode mode = SCR_BaseGameMode.Cast(GetGameMode());
  if (!mode || mode == incoming || ERR_GameMode.Cast(mode)) return;
  Print("ERR CONSTRUCTOR: drain original managers now");
  mode.OnGameEnd();
  if (m_DataCollectorComponent && m_DataCollectorComponent.GetOwner() == mode) m_DataCollectorComponent = null;
  SCR_EntityCatalogManagerComponent.ERR_ReleaseTerrainCatalog(mode);
  array<IEntity> managers = {mode, GetLoadoutManager(), GetFactionManager(), GetPerceptionManager(), GetChat()};
  ChimeraWorld chimera = ChimeraWorld.CastFrom(GetWorld());
  if (chimera) managers.Insert(chimera.GetRadioManager());
  foreach (IEntity manager : managers) if (manager) delete manager;
  PrintFormat("ERR CONSTRUCTOR: drained native mode=%1 factions=%2 loadouts=%3", GetGameMode(), GetFactionManager(), GetLoadoutManager());
 }
}
