Exemplo n.º 1
0
        public bool MoveSim(SimDescription sim, Household moveTo)
        {
            if (sim.Household == moveTo)
            {
                return(true);
            }

            if (sim.Household != null)
            {
                if (sim.CreatedSim != null)
                {
                    try
                    {
                        if ((sim.CreatedSim.Autonomy != null) && (sim.CreatedSim.Autonomy.Motives == null))
                        {
                            sim.CreatedSim.Autonomy.RecreateAllMotives();

                            IncStat("Motives Recreated");
                        }

                        if (sim.CreatedSim.LotCurrent == null)
                        {
                            sim.CreatedSim.InternalOnSetLotCurrent(null);
                        }
                    }
                    catch (Exception e)
                    {
                        Common.DebugException(sim, e);

                        Sims.Reset(sim);
                    }
                }

                Household oldHouse = sim.Household;

                ProcessAbandonHouse(oldHouse, moveTo);

                sim.Household.Remove(sim);

                foreach (SimDescription member in HouseholdsEx.All(oldHouse))
                {
                    GetData(member).InvalidateCache();
                }
            }

            moveTo.Add(sim);

            foreach (SimDescription member in HouseholdsEx.All(moveTo))
            {
                GetData(member).InvalidateCache();
            }

            ManagerSim.ForceRecount();

            SetValue <InspectedOption, bool>(moveTo, false);

            Sims.Instantiate(sim, moveTo.LotHome, true);

            return(sim.Household == moveTo);
        }
Exemplo n.º 2
0
        protected override void PrivatePerform(SimDescription sim, SimData data, ScenarioFrame frame)
        {
            PregnancySimData other = data.Get <PregnancySimData>();

            if (sim.IsPregnant)
            {
                if ((other.mLastCheckPregnancy != 0) && (other.mLastCheckPregnancy < SimClock.ElapsedCalendarDays()))
                {
                    if (!AllowProgression(sim))
                    {
                        // Delay pregnancy indefinitely
                        sim.Pregnancy.mHourOfPregnancy = other.mPregnancyHour;

                        IncStat("Pregnancy Suspended");
                    }
                    else
                    {
                        if (other.mPregnancyHour == sim.Pregnancy.mHourOfPregnancy)
                        {
                            IncStat(sim.FirstName + " " + sim.LastName + ": Stuck Pregnancy", Common.DebugLevel.High);

                            if (!SimTypes.IsSelectable(sim))
                            {
                                Sims.Reset(sim);

                                if ((sim.CreatedSim != null) && (sim.LotHome != null))
                                {
                                    SimDescription dad = ManagerSim.Find(sim.Pregnancy.DadDescriptionId);
                                    if (dad != null)
                                    {
                                        Sims.Instantiate(dad, sim.LotHome, false);
                                    }

                                    if (sim.Pregnancy.PreggersAlarm != AlarmHandle.kInvalidHandle)
                                    {
                                        AlarmManager.Global.RemoveAlarm(sim.Pregnancy.PreggersAlarm);
                                        sim.Pregnancy.PreggersAlarm = AlarmHandle.kInvalidHandle;
                                    }
                                    sim.Pregnancy.Continue(sim.CreatedSim, true);

                                    IncStat("Pregnancy Reset");
                                }
                            }
                        }
                    }
                }

                other.mPregnancyHour      = sim.Pregnancy.mHourOfPregnancy;
                other.mLastCheckPregnancy = SimClock.ElapsedCalendarDays();
            }
            else
            {
                other.mPregnancyHour      = 0;
                other.mLastCheckPregnancy = 0;
            }
        }
Exemplo n.º 3
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Sim createdSim = Sim.CreatedSim;

            if (createdSim == null)
            {
                return(false);
            }

            if (createdSim.LotCurrent == null)
            {
                return(false);
            }

            if (createdSim.LotCurrent.IsCommunityLot)
            {
                if (createdSim.LotCurrent != LotManager.ActiveLot)
                {
                    if (Sims != null)
                    {
                        Sims.Reset(Sim);
                    }

                    if (createdSim.Motives != null)
                    {
                        createdSim.Motives.ForceSetMax(CommodityKind.Temperature);
                    }

                    if ((createdSim != null) && (createdSim.BuffManager != null))
                    {
                        createdSim.BuffManager.RemoveElement(BuffNames.OnFire);
                        createdSim.BuffManager.RemoveElement(BuffNames.Torched);
                    }

                    IncStat("Sim Reset");
                }
                else
                {
                    IncStat("Active Lot");
                }

                return(true);
            }

            Add(frame, new ExtinguishScenario(createdSim.LotCurrent), ScenarioResult.Start);
            return(true);
        }
Exemplo n.º 4
0
        protected override void PrivatePerform(SimDescription sim, SimData data, ScenarioFrame frame)
        {
            MoodSimData other = data.Get <MoodSimData>();

            Sim createdSim = sim.CreatedSim;

            if ((createdSim != null) && (createdSim.InWorld) && (createdSim.Proxy != null) && (!SimTypes.IsSelectable(sim)))
            {
                if (createdSim.BuffManager != null)
                {
                    createdSim.BuffManager.RemoveElement(BuffNames.TooMuchSun);

                    if ((createdSim.BuffManager.HasElement(BuffNames.Starving)) ||
                        (createdSim.BuffManager.HasElement(BuffNames.MadlyThirsty)))
                    {
                        IncStat("Hunger Reset");

                        IncStat(sim.FullName + ": Stuck Sim", Common.DebugLevel.High);

                        Sims.Reset(sim);

                        other.mMoodPushedHome = 0;
                    }
                }

                if ((createdSim.MoodManager != null) && (createdSim.MoodManager.MoodFlavor == MoodFlavor.Miserable))
                {
                    if (other.mMoodPushedHome == 0)
                    {
                        if ((createdSim.InteractionQueue == null) || (sim.LotHome == null))
                        {
                            IncStat("Mood Reset");

                            IncStat(sim.FullName + ": Stuck Townie", Common.DebugLevel.High);

                            Sims.Reset(sim);

                            other.mMoodPushedHome = 0;
                        }
                        else
                        {
                            IncStat("Mood Push");

                            createdSim.InteractionQueue.CancelAllInteractions();
                            createdSim.InteractionQueue.Add(GoHome.Singleton.CreateInstance(sim.LotHome, createdSim, new Sims3.Gameplay.Interactions.InteractionPriority(Sims3.Gameplay.Interactions.InteractionPriorityLevel.UserDirected), false, true));

                            other.mMoodPushedHome = SimClock.ElapsedCalendarDays();
                        }
                    }
                    else if ((other.mMoodPushedHome + 1) < SimClock.ElapsedCalendarDays())
                    {
                        IncStat("Mood Reset");

                        IncStat(sim.FullName + ": Stuck Sim", Common.DebugLevel.High);

                        Sims.Reset(sim);

                        other.mMoodPushedHome = 0;
                    }
                }
                else
                {
                    other.mMoodPushedHome = 0;
                }
            }
        }