Exemplo n.º 1
0
        /// <summary> Removes this object from the static World collection. </summary>
        public void Delete()
        {
            if (!this.isCreated)
            {
                throw new ArgumentException("World is not in the collection!");
            }

            pBeforeDelete();

            this.isCreated = false;

            worldsByID.Remove(this);
            worlds.Remove(ref this.collID);
        }
Exemplo n.º 2
0
        public virtual void Remove(Item item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("Item is null!");
            }
            else if (item.Container != this.Owner)
            {
                throw new ArgumentException("Item is in a different container!");
            }

            item.Container = null;
            idColl.Remove(item);
            items.Remove(ref item.collID);

            pAfterRemove(item);
        }
Exemplo n.º 3
0
        internal void RemoveVob(BaseVob vob)
        {
            if (vob == null)
            {
                throw new ArgumentNullException("Vob is null!");
            }

            if (vob.World != this)
            {
                throw new ArgumentException("Vob is not in this world!");
            }

            pBeforeRemoveVob(vob);

            vobsByID.Remove(vob); // sets the vob ID to -1 on the server!!!
            vobs.Remove(ref vob.collID);

            pAfterRemoveVob(vob);
        }
Exemplo n.º 4
0
        /// <summary> Removes this Instance from the static Instance collection. </summary>
        public virtual void Delete()
        {
            if (!this.isCreated)
            {
                throw new ArgumentException("Instance is not in the collection!");
            }

            pBeforeDelete();

            this.isCreated = false;

            idColl.Remove(this);
            instances.Remove(this, ref this.collID, ref this.collTypeID);

            if (!this.IsStatic)
            {
                dynInstances.Remove(this, ref this.dynID, ref this.dynTypeID);
            }
        }
Exemplo n.º 5
0
        /// <summary> Removes this object from the static Model collection. </summary>
        public void Delete()
        {
            if (!this.isCreated)
            {
                throw new ArgumentException("Model is not in the collection!");
            }

            pBeforeDelete();

            this.isCreated = false;

            idColl.Remove(this);
            models.Remove(ref this.collID);

            if (!this.IsStatic)
            {
                dynModels.Remove(ref this.dynID);
            }
        }
Exemplo n.º 6
0
        internal void Delete()
        {
            if (!this.isCreated)
            {
                throw new Exception("Client is not in the collection!");
            }

            if (this.character != null)
            {
                if (this.character.IsSpawned && !loading)
                {
                    this.character.World.RemoveClient(this);
                    this.Character.Cell.RemoveClient(this);
                }
                this.character.client = null;
            }
            else if (this.isSpectating)
            {
                if (!loading) // still loading
                {
                    this.specWorld.RemoveClient(this);
                    this.specWorld.RemoveSpectatorFromCells(this);
                }
                this.specWorld = null;
            }

            visibleVobs.ForEach(vob => vob.RemoveVisibleClient(this));
            visibleVobs.Clear();

            this.isCreated = false;

            int id = this.ID; // preserve the id

            idColl.Remove(this);
            clients.Remove(ref this.collID);

            this.ScriptObject.OnDisconnection(id);

            this.character = null;

            this.systemAddress.Dispose();
            this.guid.Dispose();
        }
Exemplo n.º 7
0
        public void RemoveOverlay(Overlay overlay)
        {
            if (overlay == null)
            {
                throw new ArgumentNullException("Overlay is null!");
            }

            if (overlay.Model != this)
            {
                throw new Exception("Overlay is not from this Model!");
            }

            CanChangeNow();

            overlay.SetModel(null);

            ovIDs.Remove(overlay);
            overlays.Remove(ref overlay.collID);
            dynOvs.Remove(ref overlay.dynID);

            pRemoveOverlay(overlay);
        }
Exemplo n.º 8
0
        public void RemoveAniJob(AniJob job)
        {
            if (job == null)
            {
                throw new ArgumentNullException("AniJob is null!");
            }

            if (job.ModelInstance != this)
            {
                throw new Exception("AniJob is not from this Model!");
            }

            CanChangeNow();

            job.SetModel(null);

            aniIDs.Remove(job);
            aniJobs.Remove(ref job.collID);
            dynJobs.Remove(ref job.dynID);

            pRemoveAniJob(job);
        }