Ejemplo n.º 1
0
        public static bool Perform(SimDescription me, SimDescription.DeathType deathType)
        {
            if (me == null)
            {
                return(false);
            }

            Sim createdSim = me.CreatedSim;

            if (createdSim == PlumbBob.SelectedActor)
            {
                IntroTutorial.ForceExitTutorial();
                LotManager.SelectNextSim();
            }

            if (createdSim != null)
            {
                createdSim = Households.Reset.ResetSim(createdSim, false);

                if ((createdSim != null) && (createdSim.BuffManager != null))
                {
                    createdSim.BuffManager.RemoveAllElements();
                }
            }

            Urnstone urnstone = Urnstones.CreateGrave(me, deathType, true, true);

            if (urnstone == null)
            {
                SimpleMessageDialog.Show(Common.Localize("ForceKill:MenuName"), Common.Localize("ForceKill:Error"));
                return(false);
            }

            if (createdSim != null)
            {
                if ((createdSim.Autonomy != null) &&
                    (createdSim.Autonomy.SituationComponent != null))
                {
                    List <Situation> situations = new List <Situation>(createdSim.Autonomy.SituationComponent.Situations);
                    foreach (Situation situation in situations)
                    {
                        situation.Exit();
                    }
                }

                if (createdSim.LotCurrent != null)
                {
                    Lot lotCurrent = createdSim.LotCurrent;
                    lotCurrent.LastDiedSim = me;
                    lotCurrent.NumDeathsOnLot++;
                }

                if (createdSim.InteractionQueue != null)
                {
                    createdSim.InteractionQueue.CancelAllInteractions();
                }

                urnstone.GhostCleanup(createdSim, true);

                createdSim.Destroy();
            }

            return(true);
        }