public static bool IsAlone(Sim target) { if ((target.LotCurrent == null) || (target.LotCurrent.Household == null)) { return(true); } foreach (Sim sim in Households.AllHumans(target.LotCurrent.Household)) { if (sim == target) { continue; } if (sim.RoomId == target.RoomId) { return(false); } } return(true); }
public override bool Run() { try { Actor.PlaySoloAnimation("a_react_waveA_standing_x", true); EventTracker.SendEvent(new TravelUtil.TravelEvent(EventTypeId.kReturnedFromVacation, Actor, null, GameStates.sTravelData.mDestWorld, GameStates.sTravelData.mCurrentDayOfTrip)); if (GameStates.sTravelData.mEarlyDepartures == null) { GameStates.sTravelData.mEarlyDepartures = new List <Sim>(); } GameStates.sTravelData.mEarlyDepartures.Add(Actor); if (Households.AllHumans(Actor.Household).Count == 0x1) { GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); return(true); } if (Actor.IsActiveSim) { LotManager.SelectNextSim(); } Actor.SimDescription.DnPExportData = new DnPExportData(Actor.SimDescription); if (Actor.OpportunityManager != null) { Actor.OpportunityManager.StoreOpportunitiesForTravel(); } if (Actor.BuffManager != null) { Actor.BuffManager.StoreBuffsForTravel(Actor.SimDescription); } Actor.Household.RemoveSim(Actor); Actor.NullDnPManager(); Actor.Motives.FreezeDecayEverythingExcept(new CommodityKind[0x0]); Actor.Autonomy.IncrementAutonomyDisabled(); try { Actor.DisablePieMenuOnSim = true; if (DestinationLot != null) { Route r = Actor.CreateRoute(); r.DoRouteFail = false; DestinationLot.PlanToLot(r); Actor.DoRoute(r); } Actor.FadeOut(true, false, 1f); } finally { Actor.DisablePieMenuOnSim = false; } return(true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); } finally { TravelUtil.PlayerMadeTravelRequest = false; } return(false); }
protected static bool DelayedKill(Sim actor, Sim target, SimDescription.DeathType deathType) { if (actor == target) { target.SimDescription.SetDeathStyle(deathType, true); Urnstone urnstone = Urnstone.CreateGrave(target.SimDescription, false, true); if (urnstone != null) { if (!target.Inventory.TryToAdd(urnstone, false)) { urnstone.Destroy(); return(false); } urnstone.GhostSetup(target, true); } } else { List <IRabbitHolePartnershipDeed> list = Inventories.QuickDuoFind <IRabbitHolePartnershipDeed, GameObject>(target.Inventory); if ((list != null) && (list.Count > 0x0)) { Sim sim = null; float minValue = float.MinValue; foreach (Sim sim2 in Households.AllHumans(target.Household)) { if (sim2 != target) { float liking = -100f; Relationship relationship = Relationship.Get(target, sim2, false); if (relationship != null) { liking = relationship.LTR.Liking; } if (liking > minValue) { minValue = liking; sim = sim2; } } } foreach (IRabbitHolePartnershipDeed deed in list) { target.Inventory.RemoveByForce(deed); if (sim != null) { sim.Inventory.TryToAdd(deed, false); } else { deed.Destroy(); } } } InteractionInstance entry = Urnstone.KillSim.Singleton.CreateInstance(target, target, new InteractionPriority(InteractionPriorityLevel.MaxDeath, 0f), false, false); (entry as Urnstone.KillSim).simDeathType = deathType; target.InteractionQueue.Add(entry); } return(true); }
protected override bool OnPerform() { while ((SimClock.CurrentTicks - mPreviousTime) < (sOneMinute - 1)) { if (mExit) { break; } SpeedTrap.Sleep(); } int overrideSpeed = 0; Sims3.Gameplay.Gameflow.ClockSpeedModel model = Sims3.UI.Responder.Instance.ClockSpeedModel as Sims3.Gameplay.Gameflow.ClockSpeedModel; if (model != null) { if (Settings.mPausingOnCompletion) { if (Sim.ActiveActor != null) { if (Sim.ActiveActor.CurrentInteraction == null) { Settings.mPausingOnCompletion = false; GameflowEx.Pause(); } } } if (Settings.mSkipOnHumanSleep) { bool allSleeping = true; if ((Sim.ActiveActor == null) || (!Sim.ActiveActor.IsHuman)) { allSleeping = false; } else { foreach (Sim sim in Households.AllHumans(Household.ActiveHousehold)) { if (!(sim.CurrentInteraction is ISleeping)) { allSleeping = false; } } } if (allSleeping) { if (model.CurrentGameSpeed != Sims3.SimIFace.Gameflow.GameSpeed.Triple) { Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.SimIFace.Gameflow.GameSpeed.Triple, Sims3.Gameplay.Gameflow.SetGameSpeedContext.Automation); } Settings.mSkippingSleep = true; } else if (Settings.mSkippingSleep) { switch (model.CurrentGameSpeed) { case Sims3.SimIFace.Gameflow.GameSpeed.Triple: case Sims3.SimIFace.Gameflow.GameSpeed.Skip: Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.SimIFace.Gameflow.GameSpeed.Normal, Sims3.Gameplay.Gameflow.SetGameSpeedContext.Automation); break; } } } Sims3.SimIFace.Gameflow.GameSpeed speed = model.CurrentGameSpeed; switch (speed) { case Sims3.SimIFace.Gameflow.GameSpeed.Pause: Settings.mPausingOnCompletion = false; Settings.mSkippingSleep = false; break; case Sims3.SimIFace.Gameflow.GameSpeed.Normal: Settings.mSkippingSleep = false; break; case Sims3.SimIFace.Gameflow.GameSpeed.Double: if (Settings.mSwitchSpeedOnFast > 0) { overrideSpeed = Settings.mSwitchSpeedOnFast; } Settings.mSkippingSleep = false; Settings.mPausingOnCompletion = false; break; case Sims3.SimIFace.Gameflow.GameSpeed.Triple: if (Settings.mSwitchSpeedOnFast > 0) { overrideSpeed = Settings.mSwitchSpeedOnFast; } Settings.mPausingOnCompletion = false; break; case Sims3.SimIFace.Gameflow.GameSpeed.Skip: if (Settings.mSwitchSpeedOnFast > 0) { overrideSpeed = Settings.mSwitchSpeedOnFast; } Settings.mPausingOnCompletion = false; if (Settings.mPauseOnCompletion) { if (Sim.ActiveActor != null) { if (Sim.ActiveActor.CurrentInteraction != null) { Settings.mPausingOnCompletion = true; } } } break; } } using (TestSpan span = new TestSpan(Relativity.Logger.sLogger, "Simulate")) { if (mExit) { return(false); } int speed = Settings.GetSpeed(SimClock.CurrentTime(), overrideSpeed); PersistedSettings.sRelativeFactor = 0; if (speed != 0) { PersistedSettings.sRelativeFactor = sOneMinute / (float)speed; } if (speed != mPriorValues.mPreviousSpeed) { PriorValues.sFactorChanged = true; } if (PriorValues.sFactorChanged) { PriorValues.sFactorChanged = false; mPriorValues.RevertCommodityGains(); TuningAlterations.Revert(); TuningAlterations.Apply(); } mPriorValues.ApplyCommodityGains(); mPriorValues.mPreviousSpeed = speed; if (speed < 0) { speed = 0; } SimClock.TicksAdvanced += (speed - sOneMinute); mPreviousTime = SimClock.CurrentTicks; } return(true); }