コード例 #1
0
ファイル: Ship.cs プロジェクト: ESearcy/NavyAiConquest
        public Ship(IMyCubeGrid ent, long id, String fleetName)
        {
            this.fleetname     = fleetName;
            _cubeGrid          = ent;
            GridTerminalSystem = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(_cubeGrid);

            SetOwner(id);
            List <Sandbox.ModAPI.IMyTerminalBlock> remoteControls = new List <Sandbox.ModAPI.IMyTerminalBlock>();

            GridTerminalSystem.GetBlocksOfType <IMyRemoteControl>(remoteControls);
            GridTerminalSystem.GetBlocksOfType <IMyCubeBlock>(AllBlocks);
            ShipControls = remoteControls.FirstOrDefault() != null?remoteControls.First() as Sandbox.Game.Entities.IMyControllableEntity : null;

            _ownerId = id;

            if (ShipControls == null)
            {
                return;
            }

            DetectReactors();
            LocateShipComponets();
            ResetHealthMax();
            SetupRescanDelay();
            FindAntennasAndBeacons();
            ConfigureAntennas();
        }
コード例 #2
0
ファイル: DroneNavigation.cs プロジェクト: ESearcy/SE_MOD
        public DroneNavigation(IMyCubeGrid ship, IMyControllableEntity shipControls,
                               List <IMyEntity> nearbyFloatingObjects)
        {
            //stuff passed from sip
            _shipControls          = shipControls;
            Ship                   = ship;
            GridTerminalSystem     = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(ship);
            _nearbyFloatingObjects = nearbyFloatingObjects;

            var value = (ship.LocalAABB.Max - ship.LocalAABB.Center).Length();

            if (ship.Physics.Mass > 100000)
            {
                FollowRange = 600 + value;
            }
            else
            {
                FollowRange = 400 + value;
            }

            ShipOrientation();
            FindGyros();

            _initialized = true;
        }
コード例 #3
0
        public static MyCubeGrid GetLootboxGrid(Vector3 position, KothConfig config)
        {
            if (MyAPIGateway.Entities.GetEntityById(config.LootboxGridEntityId) != null)
            {
                if (MyAPIGateway.Entities.GetEntityById(config.LootboxGridEntityId) is MyCubeGrid grid)
                {
                    return(grid);
                }
            }
            BoundingSphereD sphere = new BoundingSphereD(position, config.CaptureRadiusInMetre + 5000);

            foreach (MyCubeGrid grid in MyAPIGateway.Entities.GetEntitiesInSphere(ref sphere).OfType <MyCubeGrid>())
            {
                IMyFaction fac = FacUtils.GetPlayersFaction(FacUtils.GetOwner(grid));
                if (fac != null && fac.Tag.Equals(config.KothBuildingOwner))
                {
                    Sandbox.ModAPI.IMyGridTerminalSystem gridTerminalSys = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(grid);

                    Sandbox.ModAPI.IMyTerminalBlock block = gridTerminalSys.GetBlockWithName(config.LootBoxTerminalName);
                    if (block != null)
                    {
                        return(grid);
                    }
                }
            }
            return(null);
        }
コード例 #4
0
        public void LocateTargetHardpoints()
        {
            IMyCubeGrid grid = Ship;

            var centerPosition = Ship.GetPosition();

            _keyPoints.Clear();
            //get position, get lenier velocity in each direction
            //add them like 10 times and add that to current coord
            if (grid != null)
            {
                Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal =
                    Sandbox.ModAPI.MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(grid);

                gridTerminal.GetBlocksOfType <Sandbox.ModAPI.IMyTerminalBlock>(terminalBlocks);
                terminalBlocks = terminalBlocks.Where(x => x.IsFunctional).ToList();


                if (terminalBlocks.Count > 0)
                {
                    weapons  = terminalBlocks.Where(x => x is Sandbox.ModAPI.IMyUserControllableGun || x is IMyLargeTurretBase || x is IMySmallMissileLauncherReload).ToList();
                    ShipSize = terminalBlocks.Max(x => (x.GetPosition() - Ship.GetPosition()).Length()) * 2;

                    //now that we have a list of reactors and guns lets primary one.
                    //try to find a working gun, if none are found then find a reactor to attack
                    if (weapons.Count > 0)
                    {
                        _keyPoints.AddRange(weapons);
                    }

                    _keyPoints.AddRange(terminalBlocks);
                }
            }
        }
コード例 #5
0
        public SpacePirateShip(IMyCubeGrid grid) : base(grid)
        {
            _gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(grid);
            //tgControl = new ThrusterGyroControls(grid, ShipControls as IMyRemoteControl);
            //_navigation = new DroneNavigation(grid, ShipControls, _nearbyStuff);

            BootUp(grid, ShipControls);
        }
コード例 #6
0
        //protected event Action Alert;

        protected BotBase(IMyCubeGrid grid)
        {
            if (grid == null)
            {
                return;
            }
            Grid     = grid;
            Term     = grid.GetTerminalSystem();
            Antennae = new List <IMyRadioAntenna>();
        }
コード例 #7
0
        public NavigationControls(IMyEntity entity, VRage.Game.ModAPI.Interfaces.IMyControllableEntity cont)
        {
            _remoteControl = cont;
            _grid          = entity as IMyCubeGrid;
            _ship          = entity;

            if (_grid != null)
            {
                _gridTerminalSystem = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(_grid);
            }

            ShipOrientation();
            RefreshGyros();
            RefreshThrusters();
            Logger.Debug("Navigation Controls Online: " + IsOperational());
        }
コード例 #8
0
        public ThrusterGyroControls(IMyEntity entity, VRage.Game.ModAPI.Interfaces.IMyControllableEntity cont)
        {
            _remoteControl = cont;
            _grid          = entity as IMyCubeGrid;
            _ship          = entity;

            if (_grid != null)
            {
                _gridTerminalSystem = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(_grid);
            }

            ShipOrientation();
            RefreshGyros();
            RefreshThrusters();
            Util.GetInstance().Log("inside", _logPath);
        }
コード例 #9
0
ファイル: DroneManager.cs プロジェクト: ESearcy/SE_MOD
        private void SetUpDrone(IMyEntity entity)
        {
            Sandbox.ModAPI.IMyGridTerminalSystem          gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid((IMyCubeGrid)entity);
            List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> T            = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>();

            gridTerminal.GetBlocksOfType <IMyTerminalBlock>(T);

            var droneType = IsDrone(T);

            if (droneType != 0)
            {
                try
                {
                    switch (droneType)
                    {
                    case DroneTypes.SpacePirateShip:
                    {
                        SpacePirateShip drone = new SpacePirateShip((IMyCubeGrid)entity);
                        Util.GetInstance().Log("[SetUpDrone] Found New Pirate Ship. id=" + drone.GetOwnerId(), logPath);
                        AddSpacePirate(drone);
                        break;
                    }

                    case DroneTypes.PlayerDrone:
                    {
                        //SpacePirateShip dro = new SpacePirateShip((IMyCubeGrid)entity);
                        //Util.GetInstance().Log("[MiningDrones.SetUpDrone] Found New Pirate Ship. id=" + dro.GetOwnerId(), "createDrone.txt");
                        //AddDrone(dro);
                        break;
                    }

                    case DroneTypes.NotADrone:
                    {
                        break;
                    }
                    }
                }
                catch (Exception e)
                {
                    //MyAPIGateway.Entities.RemoveEntity(entity);
                    Util.GetInstance().LogError(e.ToString());
                }
            }
        }
コード例 #10
0
 public static void SpawnCores(MyCubeGrid grid, KothConfig config)
 {
     if (grid != null)
     {
         Sandbox.ModAPI.IMyGridTerminalSystem gridTerminalSys = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(grid);
         MyDefinitionId rewardItem             = getRewardItem(config);
         Sandbox.ModAPI.IMyTerminalBlock block = gridTerminalSys.GetBlockWithName(config.LootBoxTerminalName);
         if (block != null && rewardItem != null)
         {
             Log.Info("Should spawn item");
             MyItemType itemType = new MyInventoryItemFilter(rewardItem.TypeId + "/" + rewardItem.SubtypeName).ItemType;
             block.GetInventory().AddItems((MyFixedPoint)config.RewardAmount, (MyObjectBuilder_PhysicalObject)MyObjectBuilderSerializer.CreateNewObject(rewardItem));
         }
         else
         {
             Log.Info("Cant spawn item");
         }
         return;
     }
 }
コード例 #11
0
ファイル: Drone.cs プロジェクト: ESearcy/SE_MOD
        public Drone(IMyEntity ent)
        {
            var ship = (IMyCubeGrid)ent;

            Ship = ship;
            var lstSlimBlock = new List <IMySlimBlock>();

            GridTerminalSystem = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(ship);

            //If it has any type of cockipt
            ship.GetBlocks(lstSlimBlock, (x) => x.FatBlock is Sandbox.ModAPI.IMyRemoteControl);
            FindWeapons();
            SetupActions();

            //If no cockpit the ship is either no ship or is broken.
            if (lstSlimBlock.Count != 0)
            {
                //Make the controls be the cockpit
                ShipControls = lstSlimBlock[0].FatBlock as IMyControllableEntity;

                #region Activate Beacons && Antennas


                //Maximise radius on antennas and beacons.
                lstSlimBlock.Clear();
                ship.GetBlocks(lstSlimBlock, (x) => x.FatBlock is Sandbox.ModAPI.IMyRadioAntenna);
                foreach (var block in lstSlimBlock)
                {
                    Sandbox.ModAPI.IMyRadioAntenna antenna =
                        (Sandbox.ModAPI.IMyRadioAntenna)block.FatBlock;
                    if (antenna != null)
                    {
                        //antenna.GetActionWithName("SetCustomName").Apply(antenna, new ListReader<TerminalActionParameter>(new List<TerminalActionParameter>() { TerminalActionParameter.Get("Combat Drone " + _manualGats.Count) }));
                        antenna.SetValueFloat("Radius", 10000);//antenna.GetMaximum<float>("Radius"));
                        _blockOn.Apply(antenna);
                    }
                }

                lstSlimBlock = new List <IMySlimBlock>();
                ship.GetBlocks(lstSlimBlock, (x) => x.FatBlock is Sandbox.ModAPI.IMyBeacon);
                foreach (var block in lstSlimBlock)
                {
                    Sandbox.ModAPI.IMyBeacon beacon = (Sandbox.ModAPI.IMyBeacon)block.FatBlock;
                    if (beacon != null)
                    {
                        beacon.SetValueFloat("Radius", 10000);//beacon.GetMaximum<float>("Radius"));
                        _blockOn.Apply(beacon);
                    }
                }

                #endregion

                //SetWeaponPower(true);
                //AmmoManager.ReloadReactors(_allReactors);
                //AmmoManager.ReloadGuns(_manualGats);
                ship.GetBlocks(lstSlimBlock, x => x is IMyEntity);


                List <IMyTerminalBlock> allTerminalBlocks = new List <IMyTerminalBlock>();
                GridTerminalSystem.GetBlocksOfType <IMyCubeBlock>(allTerminalBlocks);
                HealthBlockBase = allTerminalBlocks.Count;


                if (ShipControls != null)
                {
                    navigation = new ThrusterGyroControls(ship, ShipControls);
                    _ownerId   = ((Sandbox.ModAPI.IMyTerminalBlock)ShipControls).OwnerId;
                    tc         = new TargetingControls(Ship, _ownerId);
                }
            }

            Ship.OnBlockAdded += RecalcMaxHp;
            myNumber           = numDrones;
            numDrones++;
        }
コード例 #12
0
ファイル: DroneCommandCenter.cs プロジェクト: ESearcy/SE_MOD
        public DroneCommandCenter(IMyCubeGrid entity)
        {
            MyEntity = entity;
            Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal =
                MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(entity);

            List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>();

            gridTerminal.SearchBlocksOfName(onoff, blocks);
            if (blocks.Count > 0)
            {
                onoffBlock = blocks.FirstOrDefault();
                Util.GetInstance().Log("OnOff Controls Found", "CommandCenterBootUp.txt");
            }
            blocks.Clear();
            gridTerminal.SearchBlocksOfName(mode, blocks);
            if (blocks.Count > 0)
            {
                modeBlock = blocks.FirstOrDefault();
                Util.GetInstance().Log("ModeBlock Controls Found", "CommandCenterBootUp.txt");
            }
            blocks.Clear();
            gridTerminal.SearchBlocksOfName(mining, blocks);
            if (blocks.Count > 0)
            {
                miningBlock = blocks.FirstOrDefault();
                Util.GetInstance().Log("MiningBlock Controls Found", "CommandCenterBootUp.txt");
            }
            blocks.Clear();
            gridTerminal.SearchBlocksOfName(broadcasting, blocks);
            if (blocks.Count > 0)
            {
                broadcastingBlock = blocks.FirstOrDefault();
                Util.GetInstance().Log("Broadcasting Controls Found", "CommandCenterBootUp.txt");
            }
            blocks.Clear();
            gridTerminal.SearchBlocksOfName(agressive, blocks);
            if (blocks.Count > 0)
            {
                agressiveBlock = blocks.FirstOrDefault();
                Util.GetInstance().Log("Agression Controls Found", "CommandCenterBootUp.txt");
            }
            blocks.Clear();
            gridTerminal.SearchBlocksOfName(formation, blocks);
            if (blocks.Count > 0)
            {
                formationBlock = blocks.FirstOrDefault();
                Util.GetInstance().Log("Formation Controls Found", "CommandCenterBootUp.txt");
            }

            var lstSlimBlock = new List <IMySlimBlock>();
            var myCubeGrid   = MyEntity as IMyCubeGrid;

            if (myCubeGrid != null)
            {
                myCubeGrid.GetBlocks(lstSlimBlock, (x) => x.FatBlock is Sandbox.ModAPI.IMyShipController);
            }

            var ShipControls = lstSlimBlock[0].FatBlock as IMyControllableEntity;

            PlayerId = ((Sandbox.ModAPI.IMyTerminalBlock)ShipControls).OwnerId;
        }
コード例 #13
0
ファイル: DroneCommandCenter.cs プロジェクト: ESearcy/SE_MOD
        public void Update()
        {
            if (broadcastingBlock != null)
            {
                var temp = BroadcastingEnabled;

                BroadcastingEnabled = broadcastingBlock.IsWorking;

                if (temp != BroadcastingEnabled)
                {
                    PlayAudioForBroadcastingChanged();
                }
            }
            else
            {
                Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal =
                    MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid);

                List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>();
                gridTerminal.SearchBlocksOfName(broadcasting, blocks);
                if (blocks.Count > 0)
                {
                    broadcastingBlock = blocks.FirstOrDefault();
                }
            }

            if (miningBlock != null)
            {
                var temp = MiningDronesEnabled;

                MiningDronesEnabled = miningBlock.IsWorking;

                if (temp != MiningDronesEnabled)
                {
                    PlayAudioForMiningChanged();
                }
            }
            else
            {
                Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal =
                    MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid);

                List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>();
                gridTerminal.SearchBlocksOfName(mining, blocks);
                if (blocks.Count > 0)
                {
                    miningBlock = blocks.FirstOrDefault();
                }
            }

            if (formationBlock != null)
            {
                var temp = DroneMode.ToString();

                DroneMode = formationBlock.IsWorking ? DroneModes.Fighter : DroneMode = DroneModes.AtRange;

                if (temp != DroneMode.ToString())
                {
                    PlayAudioForDroneModeChanged();
                }
            }
            else
            {
                Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal =
                    MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid);

                List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>();
                gridTerminal.SearchBlocksOfName(formation, blocks);
                if (blocks.Count > 0)
                {
                    formationBlock = blocks.FirstOrDefault();
                }
            }

            if (agressiveBlock != null)
            {
                var temp = Stance;

                Stance = agressiveBlock.IsWorking?Standing.Hostile:Stance = Standing.Passive;

                if (temp != Stance)
                {
                    PlayAudioForStanceChanged();
                }
            }
            else
            {
                Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal =
                    MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid);

                List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>();
                gridTerminal.SearchBlocksOfName(agressive, blocks);
                if (blocks.Count > 0)
                {
                    agressiveBlock = blocks.FirstOrDefault();
                }
            }

            if (modeBlock != null)
            {
                var temp = StandingOrder;
                if (modeBlock.IsWorking)
                {
                    StandingOrder = ActionTypes.Guard;
                }
                else
                {
                    StandingOrder = ActionTypes.Sentry;
                }

                if (temp != StandingOrder)
                {
                    PlayAudioForStandingOrderChanged();
                }
            }
            else
            {
                Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal =
                    MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid);

                List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>();
                gridTerminal.SearchBlocksOfName(mode, blocks);
                if (blocks.Count > 0)
                {
                    modeBlock = blocks.FirstOrDefault();
                }
            }

            if (onoffBlock != null)
            {
                var temp = DronesOnline;
                if (onoffBlock.IsWorking)
                {
                    DronesOnline = true;
                }
                else
                {
                    DronesOnline = false;
                }

                if (temp != DronesOnline)
                {
                    PlayAudioForDronesOnlineChanged();
                }
            }
            else
            {
                Sandbox.ModAPI.IMyGridTerminalSystem gridTerminal =
                    MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(MyEntity as IMyCubeGrid);

                List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> blocks = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>();
                gridTerminal.SearchBlocksOfName(onoff, blocks);
                if (blocks.Count > 0)
                {
                    onoffBlock = blocks.FirstOrDefault();
                }
            }
        }
コード例 #14
0
ファイル: Driver.cs プロジェクト: ESearcy/NavyAiConquest
        private void SetUpDrone(IMyEntity entity)
        {
            Logger.Debug("SetUpDrone");
            Sandbox.ModAPI.IMyGridTerminalSystem          gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid((IMyCubeGrid)entity);
            List <Sandbox.ModAPI.Ingame.IMyTerminalBlock> T            = new List <Sandbox.ModAPI.Ingame.IMyTerminalBlock>();

            gridTerminal.GetBlocksOfType <IMyTerminalBlock>(T);

            var droneType = IsDrone(T);

            Logger.Debug("Setting up " + droneType);
            try
            {
                Logger.Debug("Found Drone of type: " + droneType);

                switch (droneType)
                {
                case ShipTypes.NavyFighter:
                {
                    Ship ship = new Ship((IMyCubeGrid)entity, navy.PlayerId, navy.LogPath);
                    Logger.Debug("[SetUpDrone] Found New Pirate Ship. id=" + ship.GetOwnerId());

                    navy.AddFighterToFleet(ship, droneType);
                    // AddDiscoveredShip(ship);
                    break;
                }

                case ShipTypes.AIDrone:
                {
                    Ship ship = new Ship((IMyCubeGrid)entity, drones.PlayerId, drones.LogPath);
                    Logger.Debug("[SetUpDrone] Found New Pirate Ship. id=" + ship.GetOwnerId());
                    drones.AddFighterToFleet(ship, droneType);
                    //AddDiscoveredShip(ship);
                    break;
                }

                case ShipTypes.NavyFrigate:
                {
                    Ship ship = new Ship((IMyCubeGrid)entity, navy.PlayerId, navy.LogPath);
                    Logger.Debug("[SetUpDrone] Found New Pirate Ship. id=" + ship.GetOwnerId());

                    navy.AddShipToFleet(ship, droneType);
                    // AddDiscoveredShip(ship);
                    break;
                }

                case ShipTypes.AILeadShip:
                {
                    Ship ship = new Ship((IMyCubeGrid)entity, drones.PlayerId, drones.LogPath);
                    Logger.Debug("[SetUpDrone] Found New Pirate Ship. id=" + ship.GetOwnerId());
                    drones.AddShipToFleet(ship, droneType);
                    //AddDiscoveredShip(ship);
                    break;
                }
                }
            }
            catch (Exception e)
            {
                Logger.LogException(e);
            }
        }
コード例 #15
0
        private void DeleteReverse(SettingsBlockEnforcementItem blockEnforcementSetting, int remove, IMyCubeGrid grid)
        {
            int count = 0;
            IMyGridTerminalSystem gridTerminal = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(grid);

            List <Sandbox.ModAPI.IMyTerminalBlock> blocksToRemove = new List <Sandbox.ModAPI.IMyTerminalBlock>( );
            List <IMyTerminalBlock> blockstoProcess = new List <IMyTerminalBlock>();

            gridTerminal.GetBlocksOfType <IMyTerminalBlock>(blockstoProcess);
            for (int r = blockstoProcess.Count - 1; r >= 0; r--)
            {
                Sandbox.ModAPI.IMyTerminalBlock block = (Sandbox.ModAPI.IMyTerminalBlock)blockstoProcess[r];
                switch (blockEnforcementSetting.Mode)
                {
                case SettingsBlockEnforcementItem.EnforcementMode.BlockSubtypeId:
                    if (!string.IsNullOrEmpty(block.BlockDefinition.SubtypeId) && block.BlockDefinition.SubtypeId.Contains(blockEnforcementSetting.BlockSubtypeId))
                    {
                        blocksToRemove.Add(block);
                        count++;
                    }
                    break;

                case SettingsBlockEnforcementItem.EnforcementMode.BlockTypeId:
                    if (block.BlockDefinition.TypeIdString.Contains(blockEnforcementSetting.BlockTypeId))
                    {
                        blocksToRemove.Add(block);
                        count++;
                    }
                    break;
                }

                if (count == remove)
                {
                    break;
                }
            }

            /*
             * List<MyObjectBuilder_CubeBlock> blocksToRemove = new List<MyObjectBuilder_CubeBlock>();
             * for (int r = gridBuilder.CubeBlocks.Count - 1; r >= 0; r--)
             * {
             *      MyObjectBuilder_CubeBlock block = gridBuilder.CubeBlocks[r];
             *      if (block.GetId().ToString().Contains(id))
             *      {
             *              blocksToRemove.Add(block);
             *              count++;
             *      }
             *
             *      if (count == remove)
             *              break;
             * }
             */

            if (blocksToRemove.Count < 1)
            {
                return;
            }

            List <Vector3I> razeList = new List <Vector3I>( );

            foreach (Sandbox.ModAPI.IMyTerminalBlock block in blocksToRemove)
            {
                razeList.Add(block.Min);
            }

            Wrapper.GameAction(() =>
            {
                grid.RazeBlocks(razeList);
            });
        }