/*
         * IsBradleyAlive
         *
         * Check if Bradley is currently alive
         */
        bool IsBradleyAlive()
        {
            BradleySpawner singleton = BradleySpawner.singleton;

            if (singleton != null && (bool)singleton.spawned)
            {
                return(true);
            }

            foreach (HelicopterDebris debris in BaseNetworkable.serverEntities.OfType <HelicopterDebris>())
            {
                string prefab_name = debris?.ShortPrefabName ?? string.Empty;
                if (prefab_name.Contains("bradley"))
                {
                    return(true);
                }
            }

            foreach (LockedByEntCrate crate in BaseNetworkable.serverEntities.OfType <LockedByEntCrate>())
            {
                string prefab_name = crate?.ShortPrefabName ?? string.Empty;
                if (prefab_name.Contains("bradley"))
                {
                    return(true);
                }
            }

            return(false);
        }
        private void ResetBradley()
        {
            BradleySpawner singleton = BradleySpawner.singleton;

            if (singleton == null)
            {
                Puts("No Bradley Spawner!");
            }
            else
            {
                if ((bool)singleton.spawned)
                {
                    singleton.spawned.Kill(BaseNetworkable.DestroyMode.None);
                }

                singleton.spawned = null;
                singleton.DoRespawn();
            }
        }
Exemplo n.º 3
0
        public static void quickrespawn(ConsoleSystem.Arg arg)
        {
            if (!arg.Player())
            {
                return;
            }
            BradleySpawner bradleySpawner = BradleySpawner.singleton;

            if (bradleySpawner == null)
            {
                Debug.LogWarning("No Spawner");
                return;
            }
            if (bradleySpawner.spawned)
            {
                bradleySpawner.spawned.Kill(BaseNetworkable.DestroyMode.None);
            }
            bradleySpawner.spawned = null;
            bradleySpawner.DoRespawn();
        }
Exemplo n.º 4
0
        public static void quickrespawn(Arg arg)
        {
            if (!ArgEx.Player(arg))
            {
                return;
            }
            BradleySpawner singleton = BradleySpawner.singleton;

            if (singleton == null)
            {
                Debug.LogWarning("No Spawner");
                return;
            }
            if ((bool)singleton.spawned)
            {
                singleton.spawned.Kill();
            }
            singleton.spawned = null;
            singleton.DoRespawn();
        }
        /*
         * DoRespawn
         *
         * Respawn Bradley
         */
        bool DoRespawn(IPlayer player)
        {
            BradleySpawner singleton = BradleySpawner.singleton;

            if (singleton == null)
            {
                Puts("No Bradley spawner found!");
                return(false);
            }

            if (!Bradley.enabled)
            {
                Puts("Bradley has been disabled! Enable it if you want this plugin to work.");
                return(false);
            }

            if ((bool)singleton.spawned)
            {
                singleton.spawned.Kill(BaseNetworkable.DestroyMode.None);
            }

            singleton.spawned = null;
            singleton.DoRespawn();

            if (this.config_data.Options.LockBradleyOnRespawn && !player.HasPermission("respawnbradley.nolock"))
            {
                if (LootDefender != null)
                {
                    // Telling LootDefender Bradley took max amount of damage, this should hopefully always lock it whatever Damage Lock Threshold has been configured to
                    HitInfo hit_info = new HitInfo(player.Object as BaseEntity, singleton.spawned as BaseEntity, DamageType.Generic, singleton.spawned.MaxHealth(), new Vector3());
                    LootDefender.Call("OnEntityTakeDamage", singleton.spawned, hit_info);
                }
                else
                {
                    Puts("Unable to lock Bradley without LootDefender plugin!");
                }
            }

            return(true);
        }
Exemplo n.º 6
0
        public static void quickrespawn(ConsoleSystem.Arg arg)
        {
            if (!Object.op_Implicit((Object)arg.Player()))
            {
                return;
            }
            BradleySpawner singleton = BradleySpawner.singleton;

            if (Object.op_Equality((Object)singleton, (Object)null))
            {
                Debug.LogWarning((object)"No Spawner");
            }
            else
            {
                if (Object.op_Implicit((Object)singleton.spawned))
                {
                    singleton.spawned.Kill(BaseNetworkable.DestroyMode.None);
                }
                singleton.spawned = (BradleyAPC)null;
                singleton.DoRespawn();
            }
        }
Exemplo n.º 7
0
 public void Start()
 {
     BradleySpawner.singleton = this;
     this.Invoke("DelayedStart", 3f);
 }
Exemplo n.º 8
0
 public void Start()
 {
     singleton = this;
     Invoke("DelayedStart", 3f);
 }