示例#1
0
        // Token: 0x06006FBE RID: 28606 RVA: 0x0026D010 File Offset: 0x0026C010
        public void FinalizeDeath()
        {
            this.MakeHouseholdHorsesGoHome();
            if (this.Target.SimDescription.IsEnrolledInBoardingSchool())
            {
                this.Target.SimDescription.BoardingSchool.OnRemovedFromSchool();
            }
            Urnstone.FinalizeSimDeath(this.Target.SimDescription, this.Target.Household, this.mSituation.PetSavior == null);
            int minuteOfDeath = (int)Math.Floor((double)SimClock.ConvertFromTicks(SimClock.CurrentTime().Ticks, TimeUnit.Minutes)) % 60;

            this.mGrave.MinuteOfDeath = minuteOfDeath;
            if (this.Target.DeathReactionBroadcast != null)
            {
                this.Target.DeathReactionBroadcast.Dispose();
                this.Target.DeathReactionBroadcast = null;
            }
            this.Target.SetHiddenFlags((HiddenFlags)4294967295u);
            Household household = this.Target.Household;

            if (household != null)
            {
                if (household.IsActive)
                {
                    this.Target.MoveInventoryItemsToAFamilyMember();
                }
                this.Target.LotCurrent.LastDiedSim = this.Target.SimDescription;
                this.Target.LotCurrent.NumDeathsOnLot++;
                this.Actor.ClearSynchronizationData();
                this.mSituation.DeathCheckForAbandonedChildren(this.Target);
                if (this.Target.SimDescription.DeathStyle != SimDescription.DeathType.OldAge)
                {
                    this.Actor.RemoveInteractionByType(GrimReaperSituation.ChessChallenge.Singleton);
                }
                if (BoardingSchool.ShouldSimsBeRemovedFromBoardingSchool(household))
                {
                    BoardingSchool.RemoveAllSimsFromBoardingSchool(household);
                }
                if (household.IsActive && !this.Target.BuffManager.HasElement(BuffNames.Ensorcelled))
                {
                    int num = 0;
                    foreach (Sim sim in household.AllActors)
                    {
                        if (sim.BuffManager.HasElement(BuffNames.Ensorcelled))
                        {
                            num++;
                        }
                    }
                    if (household.AllActors.Count == num + 1)
                    {
                        foreach (Sim sim2 in household.AllActors)
                        {
                            if (sim2.BuffManager.HasElement(BuffNames.Ensorcelled))
                            {
                                sim2.BuffManager.RemoveElement(BuffNames.Ensorcelled);
                            }
                        }
                    }
                }
                int num2 = household.AllActors.Count - household.GetNumberOfRoommates();
                if (household.IsActive && num2 == 1 && !Household.RoommateManager.IsNPCRoommate(this.Target))
                {
                    this.mSituation.LastSimOfHousehold = this.Target;
                }
                else
                {
                    if (this.Target.IsActiveSim)
                    {
                        LotManager.SelectNextSim();
                    }
                    if (this.mWasMemberOfActiveHousehold)
                    {
                        household.RemoveSim(this.Target);
                    }
                }
            }
            this.mGrave.RemoveFromUseList(this.Actor);
            Ocean singleton = Ocean.Singleton;

            if (singleton != null && singleton.IsActorUsingMe(this.Target))
            {
                singleton.RemoveFromUseList(this.Target);
                this.Target.Posture = null;
            }
        }