class ERR_LagFixture { static vector Centre; static vector Observer; static bool Ready; static int WorkCount; static int WorkMax; static int WorkSum; static int Admitted; static int Unsafe; static bool Place(IEntity entity) { Centre = entity.GetOrigin(); Observer = ERR_Actors.Ground(Centre + "690 0 0"); Ready = true; return false; } static bool Town(IEntity entity) { MapDescriptorComponent d = MapDescriptorComponent.Cast(entity.FindComponent(MapDescriptorComponent)); return d && d.GetBaseType() == EMapDescriptorType.MDT_NAME_CITY; } } modded class ERR_TownGarrisons { override protected void Players(out array positions) { positions.Clear(); if (ERR_LagFixture.Ready) positions.Insert(ERR_LagFixture.Observer); } override protected void Work(float now) { int start=System.GetTickCount(); super.Work(now); int elapsed=System.GetTickCount()-start; ERR_LagFixture.WorkCount++; ERR_LagFixture.WorkMax=Math.Max(ERR_LagFixture.WorkMax,elapsed); ERR_LagFixture.WorkSum+=elapsed; } override protected void Admitted(ERR_TownGarrison town) { super.Admitted(town); ERR_LagFixture.Admitted++; array agents={};town.Group.GetAgents(agents); foreach(AIAgent a:agents) if(vector.DistanceXZ(a.GetControlledEntity().GetOrigin(),ERR_LagFixture.Observer)=m_LagNext){m_LagNext=now+1000;hq.Tick(now);hq.Journal().Flush();} ERR_PlaneFlight flight=hq.PlaneRecon().Current(); if(flight&&flight.Airborne())m_LagAirborne=true; if(now>=m_LagPrint){m_LagPrint=now+10000;PrintFormat("ERR PLANE GUARD samples=%1 max=%2 admitted=%3 unsafe=%4 status=%5",ERR_LagFixture.WorkCount,ERR_LagFixture.WorkMax,ERR_LagFixture.Admitted,ERR_LagFixture.Unsafe,hq.PlaneRecon().Status());} if(now-m_LagStart>150000) { m_LagDone=true;PrintFormat("ERR PLANE COMPLETE guards=%1 unsafe=%2 slices=%3 max_ms=%4 sum_ms=%5 plane_airborne=%6",ERR_LagFixture.Admitted,ERR_LagFixture.Unsafe,ERR_LagFixture.WorkCount,ERR_LagFixture.WorkMax,ERR_LagFixture.WorkSum,m_LagAirborne); } } } // Component fixture: do not generate unrelated optional mission sites. The // production guard discovery/placement, physics, roster and plane remain active. modded class ERR_ScenarioComponent { override protected void BackgroundStep() {} }