Пример #1
0
        public void RemoveObject(VMEntity obj)
        {
            var             guid = obj.Object.OBJ.GUID;
            List <VMEntity> list = null;

            ObjectsByGUID.TryGetValue(guid, out list);
            if (list != null)
            {
                VM.DeleteFromObjList(list, obj);
                if (list.Count == 0)
                {
                    ObjectsByGUID.Remove(guid);
                }
            }
            RemoveCategory(obj, obj.GetValue(VMStackObjectVariable.Category));
            if (obj.SemiGlobal != null)
            {
                if (obj.SemiGlobal.Iff.Filename != null) //sanity check
                {
                    RemoveSemiGlobal(obj, obj.SemiGlobal.Iff.Filename.ToLowerInvariant());
                }
            }


            if (obj is VMAvatar)
            {
                Avatars.Remove(obj);
                AvatarsByPersist.Remove(obj.PersistID);
            }
            else if (obj.PersistID > 0 && obj.MultitileGroup.Objects.Count == 1)
            {
                MultitileByPersist.Remove(obj.PersistID);
                if (obj.Thread != null)
                {
                    var vm = obj.Thread.Context.VM;
                    if (vm.PlatformState.LimitExceeded)
                    {
                        VMBuildableAreaInfo.UpdateOverbudgetObjects(vm);
                    }
                }
            }

            if (obj.TreeTable != null && obj.TreeTable.AutoInteractions.Length > 0)
            {
                WithAutonomy.Remove(obj);
            }
        }