public BossEncounter()
 {
     SpawnGroup         = new ImprovedSpawnGroup();
     SpawnGroupName     = "";
     Type               = "";
     Position           = new Vector3D(0, 0, 0);
     PlayersInEncounter = new List <long>();
     Timer              = Settings.BossEncounters.SignalActiveTimer;
     SpawnAttempts      = 0;
     PlayerGPSHashes    = new Dictionary <long, int>();
 }
 public void UseExistingSettings(BossEncounter newData)
 {
     this.SpawnGroupName     = newData.SpawnGroupName;
     this.SpawnGroup         = SpawnGroupManager.GetSpawnGroupByName(this.SpawnGroupName);
     this.Type               = newData.Type;
     this.Position           = newData.Position;
     this.PlayersInEncounter = newData.PlayersInEncounter;
     this.Timer              = newData.Timer;
     this.SpawnAttempts      = newData.SpawnAttempts;
     this.PlayerGPSHashes    = newData.PlayerGPSHashes;
 }
Example #3
0
        public ActiveNPC()
        {
            SpawnGroupName = "";
            Name           = "";
            GridName       = "";
            InitialFaction = "";

            StartCoords   = Vector3D.Zero;
            EndCoords     = Vector3D.Zero;
            CurrentCoords = Vector3D.Zero;

            AutoPilotSpeed = 0;

            SpawnType             = "Other";
            CleanupIgnore         = false;
            CleanupTime           = 0;
            KeenBehaviorCheck     = false;
            KeenAiName            = "";
            KeenAiTriggerDistance = 0;
            FullyNPCOwned         = true;
            FlagForDespawn        = false;
            FixTurrets            = false;

            StartupScanValid = false;

            SpawnGroup                   = new ImprovedSpawnGroup();
            CubeGrid                     = null;
            Planet                       = null;
            RemoteControl                = null;
            HydrogenTanks                = new List <IMyGasTank>();
            GasGenerators                = new List <IMyGasGenerator>();
            ForceStaticGrid              = false;
            DisabledBlocks               = false;
            ReplacedWeapons              = false;
            AddedCrew                    = false;
            VoxelCut                     = false;
            CheckedBlockCount            = false;
            ReplenishedSystems           = true;
            StoreBlocksInit              = false;
            ModStorageRetrieveFail       = false;
            faction                      = null;
            EconomyStationCheck          = false;
            NonPhysicalAmmoCheck         = false;
            EmptyInventoryCheck          = false;
            DefenseShieldActivationCheck = false;
        }
        public bool CreateGpsForPlayers()
        {
            this.SpawnGroup = SpawnGroupManager.GetSpawnGroupByName(this.SpawnGroupName);

            if (this.SpawnGroup == null)
            {
                return(false);
            }

            var playerList = new List <IMyPlayer>();

            MyAPIGateway.Players.GetPlayers(playerList);
            var bossGps = MyAPIGateway.Session.GPS.Create(this.SpawnGroup.BossCustomGPSLabel, "", this.Position, true);



            foreach (var player in playerList)
            {
                if (player.IsBot == true)
                {
                    continue;
                }

                if (this.PlayersInEncounter.Contains(player.IdentityId) == false)
                {
                    continue;
                }

                MyAPIGateway.Session.GPS.AddGps(player.IdentityId, bossGps);
                MyVisualScriptLogicProvider.SetGPSColor(this.SpawnGroup.BossCustomGPSLabel, new Color(255, 0, 255), player.IdentityId);

                if (PlayerGPSHashes.ContainsKey(player.IdentityId) == true)
                {
                    PlayerGPSHashes[player.IdentityId] = bossGps.Hash;
                }
                else
                {
                    PlayerGPSHashes.Add(player.IdentityId, bossGps.Hash);
                }
            }

            return(true);
        }
Example #5
0
        public ActiveNPC(string dataStorage)
        {
            try {
                var byteData = Convert.FromBase64String(dataStorage);
                var npcData  = MyAPIGateway.Utilities.SerializeFromBinary <ActiveNPC>(byteData);

                if (npcData != null)
                {
                    this.SpawnGroupName    = npcData.SpawnGroupName;
                    this.Name              = npcData.Name;
                    this.GridName          = npcData.GridName;
                    this.InitialFaction    = npcData.InitialFaction;
                    this.StartCoords       = npcData.StartCoords;
                    this.EndCoords         = npcData.EndCoords;
                    this.CurrentCoords     = npcData.CurrentCoords;
                    this.AutoPilotSpeed    = npcData.AutoPilotSpeed;
                    this.CleanupIgnore     = npcData.CleanupIgnore;
                    this.CleanupTime       = npcData.CleanupTime;
                    this.KeenBehaviorCheck = npcData.KeenBehaviorCheck;
                    this.SpawnType         = npcData.SpawnType;
                    this.SpawnGroup        = new ImprovedSpawnGroup();

                    foreach (var spawnGroup in SpawnGroupManager.SpawnGroups)
                    {
                        if (spawnGroup.SpawnGroupName == this.SpawnGroupName)
                        {
                            this.SpawnGroup = spawnGroup;
                            break;
                        }
                    }

                    this.HydrogenTanks = new List <IMyGasTank>();
                    this.GasGenerators = new List <IMyGasGenerator>();
                    this.faction       = MyAPIGateway.Session.Factions.TryGetFactionByTag(npcData.InitialFaction);
                }
            } catch (Exception exc) {
                this.ModStorageRetrieveFail = true;
                Logger.AddMsg("Failed To Load ActiveNPC Data from ModStorageComponent");
            }
        }