Files
EscapistsReintroduced/docs/evidence/terrain-takeover-feature-2026-10-01/client-experiment-14/ERR_TerrainConstructorDrain.c.txt
T
jakub 6a667d8deb Capture current mission, AI, map and administration development
Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
2026-10-13 22:52:53 +02:00

27 lines
1.2 KiB
Plaintext

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());
}
}