Server.Mobiles.IntelliSpawner.Defrag C# (CSharp) Méthode

Defrag() public méthode

public Defrag ( ) : void
Résultat void
        public void Defrag()
        {
            bool updateProperties = false;

            foreach (var spawnable in new List<ISpawnable>(m_Spawned))
            {
                var item = spawnable as Item;
                var baseCreature = spawnable as BaseCreature;
                var mobile = spawnable as Mobile;

                bool toRemove = false;

                toRemove |= item != null && (item.Deleted || item.Parent != null);
                toRemove |= baseCreature != null && (baseCreature.Controlled || baseCreature.IsStabled);
                toRemove |= mobile != null && mobile.Deleted;

                updateProperties |= toRemove;

                if (toRemove)
                    m_Spawned.Remove(spawnable);
            }

            if (updateProperties)
                InvalidateProperties();
        }