コード例 #1
0
 public void AddDrone(PlayerDrone drone)
 {
     if (DroneOwners.Keys.Contains(drone.GetOwnerId()))
     {
         if (DroneOwners[drone.GetOwnerId()].DroneCount() < DronesPerPlayerSquad)
         {
             DroneOwners[drone.GetOwnerId()].AddDrone(drone);
             Util.GetInstance().Log("[PlayerDronemanager.AddDrone] squad existed: drone added!");
         }
     }
     else
     {
         var sq = new PlayerDroneSquad(drone.GetOwnerId());
         sq.SetOwner(drone.GetOwnerId());
         sq.AddDrone(drone);
         Util.GetInstance().Log("[PlayerDronemanager.AddDrone] squad created: drone added!");
         DroneOwners.Add(drone.GetOwnerId(), sq);
     }
 }
コード例 #2
0
 public void AddDrone(PlayerDrone drone)
 {
     if (DroneOwners.Keys.Contains(drone.GetOwnerId()))
     {
         if (DroneOwners[drone.GetOwnerId()].DroneCount() < DronesPerPlayerSquad)
         {
             DroneOwners[drone.GetOwnerId()].AddDrone(drone);
             Util.GetInstance().Log("[PlayerDronemanager.AddDrone] squad existed: drone added!");
         }
     }
     else
     {
         var sq = new PlayerDroneSquad(drone.GetOwnerId());
         sq.SetOwner(drone.GetOwnerId());
         sq.AddDrone(drone);
         Util.GetInstance().Log("[PlayerDronemanager.AddDrone] squad created: drone added!");
         DroneOwners.Add(drone.GetOwnerId(), sq);
     }
 }
コード例 #3
0
        private void SetUpDrone(IMyEntity entity)
        {
            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 = GetDroneType(T);

            if (droneType.DroneType != DroneTypes.NotADrone)
            {
                try
                {

                    switch (droneType.DroneType)
                    {
                        case DroneTypes.PlayerDrone:
                            {

                                PlayerDrone dro = new PlayerDrone(entity, droneType.Broadcasting);
                                Util.GetInstance().Log("[ConquestMod.SetUpDrone] Found New Player Drone. id=" + dro.GetOwnerId());
                                pManager.AddDrone(dro);

                                break;
                            }
                        case DroneTypes.MothershipDrone:
                            {
                                MothershipDrone dro = new MothershipDrone(entity, droneType.Broadcasting);
                                entity.DisplayName = "";
                                ((IMyCubeGrid)entity).Name = "";
                                ((IMyCubeGrid)entity).ChangeGridOwnership(cManager.GetMothershipID(), MyOwnershipShareModeEnum.Faction);
                                ((IMyCubeGrid)entity).UpdateOwnership(cManager.GetMothershipID(), true);
                                Util.GetInstance().Log("[ConquestMod.SetUpDrone] found new conquest drone");

                                cManager.AddMothership(dro);
                                break;
                            }
                        case DroneTypes.ConquestDrone:
                            {
                                ConquestDrone dro = new ConquestDrone(entity, droneType.Broadcasting);
                                entity.DisplayName = "";
                                ((IMyCubeGrid)entity).Name = "";
                                ((IMyCubeGrid)entity).ChangeGridOwnership(cManager.GetMothershipID(), MyOwnershipShareModeEnum.Faction);
                                ((IMyCubeGrid)entity).UpdateOwnership(cManager.GetMothershipID(), true);
                                Util.GetInstance().Log("[ConquestMod.SetUpDrone] found new conquest drone");

                                cManager.AddDrone(dro);
                                break;
                            }
                        default:
                            {
                                //Util.Notify("broken drone type");
                                break;
                            }

                    }
                }
                catch (Exception e)
                {
                    //MyAPIGateway.Entities.RemoveEntity(entity);
                    Util.GetInstance().LogError(e.ToString());
                }
            }
        }
コード例 #4
0
        private void SetUpDrone(IMyEntity entity)
        {
            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 = GetDroneType(T);


            if (droneType.DroneType != DroneTypes.NotADrone)
            {
                try
                {
                    switch (droneType.DroneType)
                    {
                    case DroneTypes.PlayerDrone:
                    {
                        PlayerDrone dro = new PlayerDrone(entity, droneType.Broadcasting);
                        Util.GetInstance().Log("[ConquestMod.SetUpDrone] Found New Player Drone. id=" + dro.GetOwnerId());
                        pManager.AddDrone(dro);

                        break;
                    }

                    case DroneTypes.MothershipDrone:
                    {
                        MothershipDrone dro = new MothershipDrone(entity, droneType.Broadcasting);
                        entity.DisplayName         = "";
                        ((IMyCubeGrid)entity).Name = "";
                        ((IMyCubeGrid)entity).ChangeGridOwnership(cManager.GetMothershipID(), MyOwnershipShareModeEnum.Faction);
                        ((IMyCubeGrid)entity).UpdateOwnership(cManager.GetMothershipID(), true);
                        Util.GetInstance().Log("[ConquestMod.SetUpDrone] found new conquest drone");

                        cManager.AddMothership(dro);
                        break;
                    }

                    case DroneTypes.ConquestDrone:
                    {
                        ConquestDrone dro = new ConquestDrone(entity, droneType.Broadcasting);
                        entity.DisplayName         = "";
                        ((IMyCubeGrid)entity).Name = "";
                        ((IMyCubeGrid)entity).ChangeGridOwnership(cManager.GetMothershipID(), MyOwnershipShareModeEnum.Faction);
                        ((IMyCubeGrid)entity).UpdateOwnership(cManager.GetMothershipID(), true);
                        Util.GetInstance().Log("[ConquestMod.SetUpDrone] found new conquest drone");

                        cManager.AddDrone(dro);
                        break;
                    }

                    default:
                    {
                        //Util.Notify("broken drone type");
                        break;
                    }
                    }
                }
                catch (Exception e)
                {
                    //MyAPIGateway.Entities.RemoveEntity(entity);
                    Util.GetInstance().LogError(e.ToString());
                }
            }
        }
コード例 #5
0
 public void AddDrone(PlayerDrone drone)
 {
     _drones.Add(drone);
 }
コード例 #6
0
 public void AddDrone(PlayerDrone drone)
 {
     _drones.Add(drone);
 }