public RadarPowerModule(MyRadar Radar) : base(Radar)
 {
     if (!RadarBlock.TryGetComponent(out MyRadarPowerSink))
     {
         MyRadarPowerSink = new MyResourceSinkComponent();
         MyResourceSinkInfo info = new MyResourceSinkInfo();
         info.ResourceTypeId = Electricity;
         MyRadarPowerSink.AddType(ref info);
         RadarBlock.Components.Add(MyRadarPowerSink);
     }
 }
Beispiel #2
0
        void CalculateTotalPower()
        {
            try
            {
                TotalRadarPower = 0;
                List <IMyTerminalBlock> Radars = new List <IMyTerminalBlock>();
                Term.GetBlocksOfType <IMyTerminalBlock>(Radars, x => Controls.IsRadar(x));

                foreach (IMyTerminalBlock RadarBlock in Radars)
                {
                    MyRadar Radar = RadarBlock.GetComponent <MyRadar>();
                    if (Radar == null || !Radar.ActiveRadar || !Radar.IsWorking())
                    {
                        continue;
                    }
                    TotalRadarPower += Radar.PowerModule.EffectiveRadarPower;
                }
            }
            catch (Exception Scrap)
            {
                RadarCore.LogError(Grid.DisplayName + ".CalculateTotalPower", Scrap);
            }
        }
Beispiel #3
0
 public static float DistanceTo(this MyRadar Radar, RadarableGrid Target)
 {
     return(Radar.Position.DistanceTo(Target.Position));
 }
Beispiel #4
0
 public static float DistanceTo(this MyRadar Radar, IMyEntity Target)
 {
     return(Radar.Position.DistanceTo(Target.GetPosition()));
 }
Beispiel #5
0
 public static float DistanceTo(this MyRadar Radar, Vector3D To)
 {
     return(Radar.Position.DistanceTo(To));
 }
 public RadarDetectorModule(MyRadar Radar) : base(Radar)
 {
 }
Beispiel #7
0
 public RadarMarkerModule(MyRadar Radar) : base(Radar)
 {
 }
Beispiel #8
0
 public RadarPersistenceModule(MyRadar Radar) : base(Radar)
 {
 }
Beispiel #9
0
 public RadarModuleBase(MyRadar Radar)
 {
     this.Radar = Radar;
 }
Beispiel #10
0
 public GridScanModule(MyRadar Radar) : base(Radar)
 {
     LastScan = DateTime.Now - TimeSpan.FromSeconds(1);
 }