public void Main(string argument, UpdateType updateSource) { if (!initialized) { launchScheduler.Main(); return; } if ((updateSource & UpdateType.Update100) != 0) { missiles.FetchMissiles(); statusWriter.UpdateStatus(); entityTrackingModule.TimeoutEntities(TimeSpan.FromSeconds(5)); } entityTrackingModule?.Poll(); statusWriter.Main(); launchScheduler.Main(); commsHandler.HandleMain(argument, (updateSource & UpdateType.Antenna) != 0); }
public void Main(string argument, UpdateType updateSource) { mainScheduler.Main(); if (!initialized) { return; } IgnoreEventAfterOnce = false; statusWriter.Main(); #pragma warning disable CS0162 if (DEBUG) { int tempCount = Runtime.CurrentInstructionCount; if ((updateSource & UpdateType.Update10) != 0) { targetTracker.Poll(); } tempCount = Runtime.CurrentInstructionCount - tempCount; averageTargetTrackerInstructionCount = tempCount * 0.01 + averageTargetTrackerInstructionCount * 0.99; tempCount = Runtime.CurrentInstructionCount; if ((updateSource & UpdateType.Update100) != 0) { if (mainScheduler.QueueCount < 1) { mainScheduler.AddTask(CheckTurrets()); } } tempCount = Runtime.CurrentInstructionCount - tempCount; averageCheckTurretsInstructionCount = tempCount * 0.01 + averageCheckTurretsInstructionCount * 0.99; tempCount = Runtime.CurrentInstructionCount; gridCannonTargeting.Tick(); missileCannonTargeting.Tick(); tempCount = Runtime.CurrentInstructionCount - tempCount; averageGridTargetingInstructionCount = tempCount * 0.01 + averageGridTargetingInstructionCount * 0.99; tempCount = Runtime.CurrentInstructionCount; TickTurrets(); tempCount = Runtime.CurrentInstructionCount - tempCount; averageTurretGroupInstructionCount = tempCount * 0.01 + averageTurretGroupInstructionCount * 0.99; ingameTime.Tick(Runtime.TimeSinceLastRun); Echo($"turretCount: {rotorTurretGroups.Count + gatlingTurretGroups.Count + missileTurretGroups.Count}"); averageTotalInstructionCount = Runtime.CurrentInstructionCount * 0.01 + averageTotalInstructionCount * 0.99; Echo($"\nComplexity:\nTotal: {averageTotalInstructionCount: #.##}\n" + $"TargetTracker: {averageTargetTrackerInstructionCount: #.##}\n" + $"CheckTurrets: {averageCheckTurretsInstructionCount: #.##}\n" + $"GridTargeting: {averageGridTargetingInstructionCount: #.##}\n" + $"TurretGroup: {averageTurretGroupInstructionCount: #.##}"); averageRuntime = averageRuntime * 0.99 + Runtime.LastRunTimeMs * 0.01; Echo($"\nlastRuntime: {Runtime.LastRunTimeMs: #.##}\n" + $"\averageRunTime: {averageRuntime: #.##}\n"); return; } if ((updateSource & UpdateType.Update10) != 0) { targetTracker.Poll(); } if ((updateSource & UpdateType.Update100) != 0) { if (mainScheduler.QueueCount < 1) { mainScheduler.AddTask(CheckTurrets()); } } gridCannonTargeting.Tick(); missileCannonTargeting.Tick(); TickTurrets(); ingameTime.Tick(Runtime.TimeSinceLastRun); #pragma warning restore }