Beispiel #1
0
        public bool CleansingKill(SimDescription sim, SimDescription.DeathType deathType, bool cleanse)
        {
            AddTry("CleansingKill");

            if (!GameStates.IsLiveState)
            {
                IncStat("CleansingKill Mode Save");
                return(false);
            }

            string name = sim.FullName;

            if (cleanse)
            {
                Annihilation.CleanseGenealogy(sim);

                SetCleansed(sim);
            }

            bool bSuccess = false;

            Sim createdSim = sim.CreatedSim;

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

                        SpeedTrap.Sleep();
                    }

                    if ((deathType != SimDescription.DeathType.None) || (cleanse))
                    {
                        if (createdSim.Kill(deathType))
                        {
                            bSuccess = true;
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.DebugException(createdSim, e);
                }
            }

            if (!bSuccess)
            {
                if (createdSim == PlumbBob.SelectedActor)
                {
                    IntroTutorial.ForceExitTutorial();
                }

                if (Sims == null)
                {
                    AddSuccess("CleansingKill: Destruct Fail");
                    return(false);
                }

                if (!Annihilation.Perform(sim, cleanse))
                {
                    Main.RemoveSim(sim.SimDescriptionId);
                }
                else
                {
                    if (!cleanse)
                    {
                        sim.Dispose(true, false, true);
                    }

                    // Special case to stop HangWithCoworker bounces
                    Careers.RemoveSim(sim.SimDescriptionId);
                }

                bSuccess = true;
            }

            if (bSuccess)
            {
                AddSuccess("CleansingKill: Success");

                IncStat("Killed: " + name, Common.DebugLevel.High);

                return(true);
            }
            else
            {
                return(false);
            }
        }