Exemple #1
0
        protected override void PrivatePerformAction(bool prompt)
        {
            try
            {
                Overwatch.Log("Recover Missing Sims");

                string msg = null;

                List <Sim> sims = new List <Sim>(LotManager.Actors);
                foreach (Sim sim in sims)
                {
                    SimDescription simDesc = sim.SimDescription;
                    if (simDesc == null)
                    {
                        continue;
                    }

                    if ((!sim.SimDescription.IsValidDescription) || (sim.Household == null))
                    {
                        try
                        {
                            GreyedOutTooltipCallback callback = null;
                            if (RecoverMissingSimTask.Allowed(sim.SimDescription, false, ref callback))
                            {
                                simDesc.Fixup();

                                if (Instantiation.AttemptToPutInSafeLocation(sim, true))
                                {
                                    sim.Autonomy.Motives.RecreateMotives(sim);
                                    sim.SetObjectToReset();
                                }

                                msg += Common.NewLine + simDesc.FullName;
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(simDesc, e);
                        }
                    }
                }

                List <Household> houses = new List <Household>(Household.sHouseholdList);
                foreach (Household house in houses)
                {
                    msg += Perform(house, prompt);
                }

                if ((msg != null) && (msg != ""))
                {
                    Overwatch.AlarmNotify(Common.Localize("RecoverMissingSims:Success", false, new object[] { msg }));
                }
            }
            catch (Exception exception)
            {
                Common.Exception(Name, exception);
            }
        }
Exemple #2
0
        public static void OnTest(Event e)
        {
            if (!Overwatch.Settings.mInstantationCheck)
            {
                return;
            }

            sTracer.Perform();
            if (!sTracer.mAllow)
            {
                return;
            }

            bool reset = false;

            Sim sim = e.TargetObject as Sim;

            if (sim == null)
            {
                return;
            }

            SimDescription simDesc = sim.SimDescription;

            GreyedOutTooltipCallback callback = null;

            if (!RecoverMissingSimTask.Allowed(simDesc, true, ref callback))
            {
                reset = true;
            }

            if (reset)
            {
                string notice = Common.Localize("InstantationCheck:Reset", sim.IsFemale, new object[] { sim });

                if (!sAlreadyShown.ContainsKey(sim.SimDescription.SimDescriptionId))
                {
                    sAlreadyShown.Add(sim.SimDescription.SimDescriptionId, true);

                    Common.Notify(sim, notice);
                }

                sim.Destroy();

                Overwatch.Log(notice);
            }
        }