Example #1
0
        private void CheckIfGuestsNeedToGoHome()
        {
            List <Sim> simsToGoHome = new List <Sim>();

            foreach (Sim sim in Guests)
            {
                bool flag = VisitSituation.IsGuestAllowedToStayOver(sim);
                if (sim.MoodManager.IsInStrongNegativeMood || (!flag && (sim.BuffManager.HasElement(BuffNames.Tired) || sim.BuffManager.HasElement(BuffNames.Exhausted))))
                {
                    AddSimToGoHome(sim, simsToGoHome);
                }

                if (sim.SimDescription.ChildOrBelow && (SimClock.Hours24 >= GetParams().HourAtWhichChildrenGoHome))
                {
                    AddSimToGoHome(sim, simsToGoHome);
                    foreach (Genealogy genealogy in sim.Genealogy.Parents)
                    {
                        SimDescription simDescription = genealogy.SimDescription;
                        if (simDescription != null)
                        {
                            Sim createdSim = simDescription.CreatedSim;
                            if ((createdSim != null) && Guests.Contains(createdSim))
                            {
                                AddSimToGoHome(createdSim, simsToGoHome);
                            }
                        }
                    }
                }

                float       delta = sim.MoodManager.MoodValue * GetParams().MoodToTimeMod;
                DateAndTime time;
                if (!flag && mTimeForSimToLeave.TryGetValue(sim.ObjectId, out time))
                {
                    time = SimClock.Add(time, TimeUnit.Minutes, delta);
                    if (time.CompareTo(SimClock.CurrentTime()) < 0x0)
                    {
                        AddSimToGoHome(sim, simsToGoHome);
                    }
                    else
                    {
                        mTimeForSimToLeave[sim.ObjectId] = time;
                    }
                }
            }
            foreach (Sim sim3 in simsToGoHome)
            {
                if (sim3.LotCurrent == Lot)
                {
                    MakeGuestGoHome(sim3);
                }
            }
        }