Exemple #1
0
        public virtual bool AcceptsSpawnsFrom(Region region)
        {
            if (!AllowSpawn())
            {
                return(false);
            }

            if (region == this)
            {
                return(true);
            }

            if (m_Parent != null)
            {
                return(m_Parent.AcceptsSpawnsFrom(region));
            }

            return(false);
        }
        public override void OnRegionChange( Region Old, Region New )
        {
            base.OnRegionChange( Old, New );

            if ( this.Controlled )
            {
                SpawnEntry se = this.Spawner as SpawnEntry;

                if ( se != null && !se.UnlinkOnTaming && ( New == null || !New.AcceptsSpawnsFrom( se.Region ) ) )
                {
                    this.Spawner.Remove( this );
                    this.Spawner = null;
                }
            }
        }
        public override void OnRegionChange( Region Old, Region New )
        {
            base.OnRegionChange( Old, New );

            if ( this.Controlled )
            {
                ISpawner se = this.Spawner;
            /*
                Region reg = null;
                if ( se is SpawnEntry )
                    reg = ((SpawnEntry)se).Region;
                else if ( se is Item )
                    reg = Region.Find( ((Item)se).Location, ((Item)se).Map );

                if ( se != null && !se.UnlinkOnTaming && ( New == null || !New.AcceptsSpawnsFrom( reg ) ) )
                {
                    this.Spawner.Remove( this );
                    this.Spawner = null;
                }
            */

                if ( se != null && !se.UnlinkOnTaming && ( New == null || !New.AcceptsSpawnsFrom( se.Region ) ) )
                {
                    this.Spawner.Remove( this );
                    this.Spawner = null;
                }
            }
        }