示例#1
0
        private void SetupMiddleDrones()
        {
            var origin = new Vector3D(5, 5, 5);

            if (ship == null || !ship.IsAlive())
            {
                var location = MyAPIGateway.Entities.FindFreePlace(origin, 2000);
                if (location != null)
                {
                    ship = _shipSpawner.SpawnShip(ConquestDrones.SmallOne, (Vector3D)location);
                    ship.SetOwner(001);
                    SetUpDrone(ship.Ship);
                }
            }


            //if (ship4 == null || !ship4.IsAlive())
            //{
            //    var location = MyAPIGateway.Entities.FindFreePlace(origin, 2000);
            //    if (location != null)
            //    {
            //        ship4 = _shipSpawner.SpawnShip(ConquestDrones.MediumTwo, (Vector3D)location);
            //        ship4.SetOwner(001);
            //        SetUpDrone(ship4.Ship);
            //    }
            //}

            //if (ship3 == null || !ship3.IsAlive())
            //{
            //        var location = MyAPIGateway.Entities.FindFreePlace(origin, 2000);
            //    if (location != null)
            //    {
            //        ship3 = _shipSpawner.SpawnShip(ConquestDrones.MediumTwo, (Vector3D)location);
            //        ship3.SetOwner(001);
            //        SetUpDrone(ship3.Ship);
            //    }
            //}

            //if (ship2 == null || !ship2.IsAlive())
            //{
            //            var location = MyAPIGateway.Entities.FindFreePlace(origin, 2000);
            //    if (location != null)
            //    {
            //        ship2 = _shipSpawner.SpawnShip(ConquestDrones.MediumTwo, (Vector3D)location);
            //        ship2.SetOwner(001);
            //        SetUpDrone(ship2.Ship);
            //    }
            //}
        }
示例#2
0
        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());
                }
            }
        }
示例#3
0
 public void AddSpacePirate(SpacePirateShip drone)
 {
     if (assets.Keys.Contains(drone.GetOwnerId()))
     {
         assets[drone.GetOwnerId()].MiningDrones.Add(drone);
         Util.GetInstance().Log("[AddSpacePirate] squad existed: drone added!", logPath);
     }
     else
     {
         assets.Add(drone.GetOwnerId(), new PlayerAssets(drone.GetOwnerId())
         {
             MiningDrones = new HashSet <SpacePirateShip>()
             {
                 drone
             }
         });
         Util.GetInstance().Log("[AddSpacePirate] squad created: drone added!", logPath);
     }
 }