Пример #1
0
        void UpdateRelays()
        {
            IMyCubeGrid OwnGrid = AntennaBlock.GetTopMostParent() as IMyCubeGrid;

            RelayedReceivers.Clear();
            RelayedGridsIngame.Clear();
            RelayedChars.Clear();
            if (Antenna == null)
            {
                RadarCore.LogError(AntennaBlock.DisplayName + ".Update10()", new Exception("Antenna == null"));
            }
            if (Antenna.BroadcastersInRange == null)
            {
                RadarCore.LogError(AntennaBlock.DisplayName + ".Update10()", new Exception("BroadcastersInRange == null"));
            }
            if (Antenna.BroadcastersInRange == null)
            {
                return;
            }
            foreach (var Receiver in Antenna.BroadcastersInRange.Select(x => x.Entity.GetComponent <MyDataReceiver>()))
            {
                TryAddRelay(Receiver);
                if (Receiver?.BroadcastersInRange == null)
                {
                    continue;
                }
                foreach (var RelayedReceiver in Receiver.BroadcastersInRange.Select(x => x.Entity.GetComponent <MyDataReceiver>()))
                {
                    TryAddRelay(RelayedReceiver);
                }
            }
        }
Пример #2
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);
        }