Add missile launcher and missile controller projects
[SEScripts.git] / BaseMiner / Program.cs
index bb89dc5..0275435 100644 (file)
@@ -58,10 +58,25 @@ namespace IngameScript
             var output = this.Me.GetSurface(0);
             this.output = new Output(output, CONSOLE_NB_LINES);
 
-            this.output.Print("Base mining system starting...");
+            this.output.Print("Base system starting...");
+
+            this.InitMiningSystem();
+            
+            this.minerConnector = this.GridTerminalSystem.GetBlockWithName("[Base] Connector Miner") as IMyShipConnector;
+            if (this.minerConnector == null)
+                this.output.Print($"Error: miner connector not found");
+
+            this.Runtime.UpdateFrequency = UpdateFrequency.Update100;
+
+            this.output.Print("Base system has started");
+        }
+
+        void InitMiningSystem()
+        {
+            this.output.Print("Mining system initializing...");
 
             this.GridTerminalSystem.GetBlocksOfType(
-                this.drills, 
+                this.drills,
                 (IMyShipDrill drill) => drill.CustomName.StartsWith(GRID_PREFIX)
             );
 
@@ -86,14 +101,8 @@ namespace IngameScript
             );
 
             this.output.Print($"Nb of rotating lights: {this.rotatingLights.Count}");
-            
-            this.minerConnector = this.GridTerminalSystem.GetBlockWithName("[Base] Connector Miner") as IMyShipConnector;
-            if (this.minerConnector == null)
-                this.output.Print($"Error: miner connector not found");
-
-            this.Runtime.UpdateFrequency = UpdateFrequency.Update100;
 
-            this.output.Print("base Mining system has started");
+            this.output.Print("Mining system initialized");
         }
 
         public void Save()