Example #1
0
 public override void UpdateOnceBeforeFrame()
 {
     if (!Inited)
     {
         Initialize();
     }
     RadarCore.SaveRegister(Save);
     LCD.OnMarkForClose += LCD_OnMarkForClose;
     NeedsUpdate        |= MyEntityUpdateEnum.EACH_10TH_FRAME;
     ShowTextOnHud       = new AutoSet <bool>(Entity, "ShowTextOnHud", false);
     CoordX              = new AutoSet <float>(Entity, "CoordX", 0, x => x <= 1 && x >= -1);
     CoordY              = new AutoSet <float>(Entity, "CoordY", 0, x => x <= 1 && x >= -1);
     DisplaySize         = new AutoSet <float>(Entity, "Size", 0, x => x <= 1 && x >= 0);
     Load();
 }
Example #2
0
        //Debug.Enabled = true;
        public override void Init(MyObjectBuilder_EntityBase objectBuilder)
        {
            NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
            base.Init(objectBuilder);
            RadarBlock = Entity as IMyUpgradeModule;

            ScanModule        = new GridScanModule(this);
            MarkerModule      = new RadarMarkerModule(this);
            DetectorModule    = new RadarDetectorModule(this);
            PersistenceModule = new RadarPersistenceModule(this);
            PowerModule       = new RadarPowerModule(this);
            RadarCore.SaveRegister(PersistenceModule.Save);

            /*if (!RadarBlock.HasComponent<MyModStorageComponent>())
             * {
             *  RadarBlock.Storage = new MyModStorageComponent();
             *  RadarBlock.Components.Add(RadarBlock.Storage);
             *  RadarCore.DebugWrite($"{RadarBlock.CustomName}.Init()", "Block doesn't have a Storage component!", IsExcessive: false);
             * }*/
        }
Example #3
0
        public override void UpdateOnceBeforeFrame()
        {
            if (AntennaBlock.CubeGrid.Physics == null)
            {
                NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
                return;
            }

            NeedsUpdate |= MyEntityUpdateEnum.EACH_10TH_FRAME;
            if (AntennaBlock is IMyRadioAntenna && !InitedRadioAntennaControls)
            {
                InitRadioAntennaControls();
            }
            if (AntennaBlock is IMyLaserAntenna && !InitedLaserAntennaControls)
            {
                InitLaserAntennaControls();
            }
            SyncAllowReceive = new AutoSet <bool>(Entity, "Receive", true);
            Load();
            AntennaBlock.AppendingCustomInfo += AntennaBlock_AppendingCustomInfo;
            AntennaBlock.OnMarkForClose      += AntennaBlock_OnMarkForClose;
            AntennaGrid = AntennaBlock.GetTopMostParent() as IMyCubeGrid;
            RadarCore.SaveRegister(Save);
        }