示例#1
0
        void ResetDrill(Drill.DrillEvent e)
        {
            var blocks = new List <IMyTerminalBlock>();

            GridTerminalSystem.GetBlocksOfType <IMyShipController>(blocks, NoPassenger);
            if (blocks.Count == 0)
            {
                throw new Exception("No ship controller (cockpit, etc.) available.");
            }

            drill = new Drill(blocks[0] as IMyShipController);

            EventHandler.Clear();
            EventHandler.Add(Reset, ResetDrill);
            EventHandler.Add(Start, drill.Handle);
            EventHandler.Add(Stop, drill.Handle);
            EventHandler.Add(Found, drill.Handle);
            EventHandler.Add(Lost, drill.Handle);
            EventHandler.Add(Debug, HandleDebug);
            EventHandler.Add(Full, drill.Handle);

            blocks = new List <IMyTerminalBlock>();
            GridTerminalSystem.GetBlocksOfType <IMyGyro>(blocks, SameGridLikeReferenceBlock);
            drill.AddGyroskopes(blocks);
            blocks = new List <IMyTerminalBlock>();
            GridTerminalSystem.GetBlocksOfType <IMyThrust>(blocks, SameGridLikeReferenceBlock);
            drill.AddThrusters(blocks);
            blocks = new List <IMyTerminalBlock>();
            GridTerminalSystem.GetBlocksOfType <IMySensorBlock>(blocks, SameGridLikeReferenceBlock);
            drill.AddSensors(blocks);
            blocks = new List <IMyTerminalBlock>();
            GridTerminalSystem.GetBlocksOfType <IMyShipDrill>(blocks, SameGridLikeReferenceBlock);
            drill.AddDrills(blocks);
            drill.Handle(Drill.DrillEvent.DrillInitialized);
        }
示例#2
0
 void HandleDebug(Drill.DrillEvent e)
 {
     DebugActive = !DebugActive;
     Output("Toggle debug mode to '" + DebugActive + "'", true);
 }