Esempio n. 1
0
        protected override void Perform(SimDescription obj, object parent, FieldInfo field)
        {
            //if (obj.IsValidDescription) return;

            if (mSims == null)
            {
                mSims = SimListing.AllSims <SimDescription>(null, true);
            }

            // All residents, ancestors, and urnstone sims are considered valid
            if (mSims.ContainsKey(obj.SimDescriptionId))
            {
                return;
            }

            GameObjectReference reference = ObjectLookup.GetReference(new ReferenceWrapper(obj));

            if (!DereferenceManager.Perform(obj, reference, false, false))
            {
                return;
            }

            DereferenceManager.Perform(obj, reference, true, false);

            string fullName = obj.FullName;

            if (!string.IsNullOrEmpty(fullName))
            {
                fullName = fullName.Trim();
            }

            if (!string.IsNullOrEmpty(fullName))
            {
                bool found = false;
                foreach (List <SimDescription> list in mSims.Values)
                {
                    foreach (SimDescription sim in list)
                    {
                        if (sim.FullName == fullName)
                        {
                            found = true;
                            break;
                        }
                    }
                }

                if (!found)
                {
                    if (reference.Count > 0)
                    {
                        ErrorTrap.LogCorrection("SimDescription Removed: " + fullName);
                    }
                    else
                    {
                        ErrorTrap.DebugLogCorrection("Zero Reference SimDescription Removed: " + fullName);
                    }
                }
            }
        }
Esempio n. 2
0
        protected override void Perform(MapTag obj, object parent, FieldInfo field)
        {
            if (!mMapTags.ContainsKey(obj))
            {
                obj.OnRemovedFromManager();

                ErrorTrap.DebugLogCorrection("Bogus Map Tag Dropped: " + obj.GetType());
            }
        }
Esempio n. 3
0
            protected override void OnPerform()
            {
                if (!object.ReferenceEquals(mSim.CurrentInteraction, mInstance))
                {
                    return;
                }

                ErrorTrap.DebugLogCorrection("Follow Route Action Reset: " + mSim.FullName);

                new ResetSimTask(mSim);
            }
Esempio n. 4
0
        protected override void PreProcess(FollowRouteAction obj, object parent, FieldInfo field)
        {
            IScriptProxy proxy = Simulator.GetProxy(obj.mRoutingObjectId);

            if (proxy == null)
            {
                return;
            }

            Sim sim = proxy.Target as Sim;

            if (sim == null)
            {
                return;
            }

            SimRoutingComponent component = sim.RoutingComponent as SimRoutingComponent;

            if (component == null)
            {
                return;
            }

            if (component.mRouteActions.Contains(obj))
            {
                return;
            }

            if (sSims == null)
            {
                sSims = new Dictionary <Sim, InteractionInstance>();
            }

            if (!sSims.ContainsKey(sim))
            {
                sSims.Add(sim, sim.CurrentInteraction);

                ErrorTrap.DebugLogCorrection("Potential Follow Route Action Reset: " + sim.FullName);
            }
        }
Esempio n. 5
0
        protected override void Perform(GameObject obj, object referenceParent, FieldInfo field)
        {
            if (obj is Ocean)
            {
                if (LotManager.sOceanObject == obj)
                {
                    return;
                }
            }
            else if (obj is Terrain)
            {
                if (Terrain.sTerrain == obj)
                {
                    return;
                }
            }

            if (DereferenceManager.HasBeenDestroyed(obj))
            {
                if (obj is Sim)
                {
                    LotManager.sActorList.Remove(obj as Sim);

                    DereferenceManager.Perform(obj, ObjectLookup.GetReference(new ReferenceWrapper(obj)), true, false);
                }
                else
                {
                    GameObjectReference refObj = ObjectLookup.GetReference(new ReferenceWrapper(obj));
                    if (DereferenceManager.Perform(obj, refObj, false, false))
                    {
                        DereferenceManager.Perform(obj, refObj, true, false);

                        ErrorTrap.LogCorrection("Destroyed Object Found: " + obj.GetType());
                    }
                }
                return;
            }

            if (kShowFullReferencing)
            {
                DereferenceManager.Perform(obj, ObjectLookup.GetReference(new ReferenceWrapper(obj)), false, true);
            }

            if (obj.InWorld)
            {
                return;
            }

            if (obj.InInventory)
            {
                if (Inventories.ParentInventory(obj) == null)
                {
                    if ((obj.Parent != null) || (Consignment.ContainsKey(obj)))
                    {
                        obj.SetFlags(GameObject.FlagField.InInventory, false);

                        ErrorTrap.LogCorrection("Invalid Inventory Object Unflagged: " + obj.GetType());
                    }
                    else
                    {
                        ErrorTrap.LogCorrection("Invalid Inventory Object Found: " + obj.GetType());
                        ErrorTrap.AddToBeDeleted(obj, true);
                    }
                }

                return;
            }
            else
            {
                if (SharedInventories.ContainsKey(obj.ObjectId))
                {
                    obj.SetFlags(GameObject.FlagField.InInventory, true);

                    ErrorTrap.LogCorrection("Inventory Object Flagged: " + obj.GetType());
                    return;
                }
            }

            if (EventItems.ContainsKey(obj.ObjectId))
            {
                return;
            }

            bool hasParent = false;

            IGameObject parent = obj.Parent;

            while (parent != null)
            {
                hasParent = true;

                if (DereferenceManager.HasBeenDestroyed(parent))
                {
                    ErrorTrap.LogCorrection("Destroyed Parent Object Found: " + parent.GetType());
                    ErrorTrap.AddToBeDeleted(obj, true);

                    hasParent = false;
                    break;
                }

                parent = parent.Parent;
            }

            if (!hasParent)
            {
                ReferenceWrapper refObj = new ReferenceWrapper(obj);

                GameObjectReference reference = ObjectLookup.GetReference(refObj);
                if ((reference != null) && (reference.HasReferences))
                {
                    if (DereferenceManager.Perform(obj, ObjectLookup.GetReference(refObj), false, false))
                    {
                        IScriptProxy proxy = Simulator.GetProxy(obj.ObjectId);
                        if (proxy != null)
                        {
                            IScriptLogic logic = proxy.Target;
                            if (object.ReferenceEquals(logic, obj))
                            {
                                bool log = !sSilentDestroy.ContainsKey(obj.GetType());

                                if (log)
                                {
                                    ErrorTrap.LogCorrection("Out of World Object Found 2: " + obj.GetType());
                                }
                                else
                                {
                                    ErrorTrap.DebugLogCorrection("Out of World Object Found 3: " + obj.GetType());
                                }

                                ErrorTrap.AddToBeDeleted(obj, log);
                            }
                            else
                            {
                                ErrorTrap.DebugLogCorrection("Out of World Object Found 4: " + obj.GetType());
                                ErrorTrap.DebugLogCorrection("Out of World Object Found 5: " + logic.GetType());
                            }
                        }
                        else
                        {
                            DereferenceManager.Perform(obj, ObjectLookup.GetReference(refObj), true, false);
                        }
                    }
                }
                else
                {
                    ErrorTrap.LogCorrection("Out of World Object Found 1: " + obj.GetType());
                    ErrorTrap.AddToBeDeleted(obj, true);
                }
            }
        }
Esempio n. 6
0
 protected void DebugLogCorrection(string text)
 {
     ErrorTrap.DebugLogCorrection(text);
 }