public static void CustomAnnihilation(SimDescription badSim, SimDescription goodSim) { if ((badSim == null) || (goodSim == null)) { return; } if (object.ReferenceEquals(badSim, goodSim)) { return; } Overwatch.Log("Annihilation: " + Relationships.GetFullName(badSim)); if (object.ReferenceEquals(goodSim.mMaternityOutfits, badSim.mMaternityOutfits)) { badSim.mMaternityOutfits = new OutfitCategoryMap(); Overwatch.Log("Doppleganger mMaternityOutfits copy " + Relationships.GetFullName(badSim)); } if (object.ReferenceEquals(goodSim.mOutfits, badSim.mOutfits)) { badSim.mOutfits = new OutfitCategoryMap(); Overwatch.Log("Doppleganger mOutfits copy " + Relationships.GetFullName(badSim)); } if (object.ReferenceEquals(goodSim.CelebrityManager, badSim.CelebrityManager)) { badSim.CelebrityManager = null; Overwatch.Log("Doppleganger CelebrityManager copy " + Relationships.GetFullName(badSim)); } if (object.ReferenceEquals(goodSim.CareerManager, badSim.CareerManager)) { badSim.CareerManager = null; Overwatch.Log("Doppleganger CareerManager copy " + Relationships.GetFullName(badSim)); } /* * if ((badSim.Household != null) && (object.ReferenceEquals(goodSim.mHousehold, badSim.mHousehold))) * { * badSim.mHousehold = null; * Overwatch.Log("Doppleganger mHousehold copy " + GetFullName(badSim)); * } */ if ((badSim.mPartner != null) && (object.ReferenceEquals(goodSim.mPartner, badSim.mPartner))) { badSim.mPartner = null; Overwatch.Log("Doppleganger mPartner copy " + Relationships.GetFullName(badSim)); } if (object.ReferenceEquals(goodSim.mGenealogy, badSim.mGenealogy)) { badSim.mGenealogy = new Genealogy(badSim); Overwatch.Log("Doppleganger mGenealogy copy " + Relationships.GetFullName(badSim)); } if ((badSim.AssignedRole != null) && (object.ReferenceEquals(goodSim.AssignedRole, badSim.AssignedRole))) { badSim.AssignedRole = null; Overwatch.Log("Doppleganger AssignedRole copy " + Relationships.GetFullName(badSim)); } Annihilation.Perform(badSim, true); }
public static bool AttemptServiceDisposal(SimDescription sim, bool oldAge, string reason) { if (sim == null) { return(false); } bool hasChildren = (Relationships.GetChildren(sim).Count > 0); if (!oldAge) { if (hasChildren) { return(false); } if ((sim.IsHuman) && (sim.TeenOrAbove)) { bool found = false; foreach (SimDescription other in Households.Humans(sim.Household)) { if (other == sim) { continue; } if (other.TeenOrAbove) { found = true; break; } } if (!found) { return(false); } } foreach (Household house in Household.GetHouseholdsLivingInWorld()) { if (Notifications.HasSignificantRelationship(house, sim)) { return(false); } } } if (hasChildren) { if (!Annihilation.Perform(sim, false)) { return(false); } if (Common.kDebugging) { Common.DebugNotify("Disposed: " + sim.FullName + " (" + sim.Species + ")" + Common.NewLine + reason); } } else { if (!Annihilation.Cleanse(sim)) { return(false); } if (Common.kDebugging) { Common.DebugNotify("Cleansed: " + sim.FullName + " (" + sim.Species + ")" + Common.NewLine + reason); } } return(true); }
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); } }