private IReadOnlyList <MyTuple <MyDefinitionId, Vector3I, Vector3D, float, IReadOnlyDictionary <string, int> > > ProjectedGridBlocks_Getter(IMyTerminalBlock Block)
        {
            var DefaultRetval = new List <MyTuple <MyDefinitionId, Vector3I, Vector3D, float, IReadOnlyDictionary <string, int> > >(0);

            ProjectorKernel projectorKernel;

            if (!Block.TryGetComponent(out projectorKernel))
            {
                return(null);
            }

            IMyCubeGrid grid = projectorKernel.Projector.ProjectedGrid;

            if (grid == null)
            {
                return(DefaultRetval);
            }

            GridKernel gridKernel;

            if (!grid.TryGetComponent(out gridKernel))
            {
                return(DefaultRetval);
            }

            return(gridKernel.BlockDataCachingModule.BlockDataCache);
        }
Ejemplo n.º 2
0
 public static T LCDReturn <T>(IMyTerminalBlock LCDBlock, Func <HudLcdDisplayer, T> Getter, T Default = default(T))
 {
     try
     {
         HudLcdDisplayer LCD;
         if (!LCDBlock.TryGetComponent(out LCD))
         {
             return(Default);
         }
         return(Getter(LCD));
     }
     catch { return(Default); }
 }
Ejemplo n.º 3
0
 public static void LCDAction(IMyTerminalBlock LCDBlock, Action <HudLcdDisplayer> Action)
 {
     try
     {
         HudLcdDisplayer LCD;
         if (!LCDBlock.TryGetComponent(out LCD))
         {
             return;
         }
         Action(LCD);
     }
     catch { }
 }
Ejemplo n.º 4
0
 public static T RadarReturn <T>(IMyTerminalBlock RadarBlock, Func <MyRadar, T> Getter, T Default = default(T))
 {
     try
     {
         MyRadar Radar;
         if (!RadarBlock.TryGetComponent(out Radar))
         {
             return(Default);
         }
         return(Getter(Radar));
     }
     catch (Exception Scrap)
     {
         RadarCore.LogError("RadarReturn", Scrap);
         return(Default);
     }
 }
Ejemplo n.º 5
0
 public static void RadarAction(IMyTerminalBlock RadarBlock, Action <MyRadar> Action)
 {
     try
     {
         MyRadar Radar;
         if (!RadarBlock.TryGetComponent(out Radar))
         {
             return;
         }
         Action(Radar);
     }
     catch (Exception Scrap)
     {
         RadarCore.LogError("RadarAction", Scrap);
         return;
     }
 }
Ejemplo n.º 6
0
 public static T BlockReturn <T>(IMyTerminalBlock Block, Func <BlockLogic, T> Getter, T Default = default(T))
 {
     try
     {
         BlockLogic Logic;
         if (!Block.TryGetComponent(out Logic))
         {
             return(Default);
         }
         return(Getter(Logic));
     }
     catch (Exception Scrap)
     {
         LogError("BlockReturn", Scrap);
         return(Default);
     }
 }
Ejemplo n.º 7
0
 public static void BlockAction(IMyTerminalBlock Block, Action <BlockLogic> Action)
 {
     try
     {
         BlockLogic Logic;
         if (!Block.TryGetComponent(out Logic))
         {
             return;
         }
         Action(Logic);
     }
     catch (Exception Scrap)
     {
         LogError("BlockAction", Scrap);
         return;
     }
 }
Ejemplo n.º 8
0
 public static void DrillAction(IMyTerminalBlock Block, Action <LaserDrill> Action)
 {
     try
     {
         LaserDrill Logic;
         if (!Block.TryGetComponent(out Logic))
         {
             return;
         }
         Action(Logic);
     }
     catch (Exception Scrap)
     {
         SessionCore.LogError("BlockAction", Scrap);
         return;
     }
 }
Ejemplo n.º 9
0
 public static T BlockReturn <T>(IMyTerminalBlock Block, Func <LaserToolBase, T> Getter, T Default = default(T))
 {
     try
     {
         LaserToolBase Logic;
         if (!Block.TryGetComponent(out Logic))
         {
             return(Default);
         }
         return(Getter(Logic));
     }
     catch (Exception Scrap)
     {
         SessionCore.LogError("BlockReturn", Scrap);
         return(Default);
     }
 }
        private IReadOnlyList <ListOfBlocks> LastOperatedProjectedGridBlocks_Getter(IMyTerminalBlock Block)
        {
            var Retval = new List <ListOfBlocks>(0);

            LaserToolKernel LaserKernel;

            if (!Block.TryGetComponent(out LaserKernel))
            {
                return(null);
            }

            foreach (IMyCubeGrid grid in LaserKernel.Responder.LastOperatedGrids)
            {
                GridKernel gridKernel;
                if (grid.TryGetComponent(out gridKernel))
                {
                    Retval.Add(gridKernel.BlockDataCachingModule.BlockDataCache);
                }
            }

            return(Retval);
        }