public void Reset(SimDescription sim, AgingState state) { state.DayPassedSinceLastTransition = mDayPassed; if (IsOldEnoughToAge(AgingManager.Singleton, state)) { if (mWithoutCake != 0) { state.AgeTransitionWithoutCakeAlarm = AlarmManager.Global.AddAlarm(mWithoutCake, TimeUnit.Hours, state.AgeTransitionWithoutCakeCallback, "The Cake is a Lie and Then You Die", AlarmType.AlwaysPersisted, sim); Overwatch.Log("Age-up: " + state.SimDescription.FullName); } if (mMessage != 0) { state.AgeTransitionMessageAlarm = AlarmManager.Global.AddAlarm(mMessage, TimeUnit.Hours, state.ShowAgeTransitionMessageCallback, "Tell Player that the Cake is a Lie", AlarmType.AlwaysPersisted, sim); } } else { if (mWithoutCake != 0) { Overwatch.Log("Age-up Dropped: " + state.SimDescription.FullName); } } if (mEarlyMessage != 0) { state.AgeTransitionEarlyMessageAlarm = AlarmManager.Global.AddAlarm(mEarlyMessage, TimeUnit.Hours, state.ShowAgeTransitionEarlyMessageCallback, "Tell player that the cake will be a lie in a few days", AlarmType.AlwaysPersisted, sim); } }
public static bool IsInactiveActive(AgingState ths) { if ((!SimTypes.IsSelectable(ths.SimDescription)) && (ths.SimDescription.Household == Household.ActiveHousehold)) { return(true); } return(false); }
public static bool IsInactiveActive(AgingState ths) { if ((!SimTypes.IsSelectable(ths.SimDescription)) && (ths.SimDescription.Household == Household.ActiveHousehold)) { return true; } return false; }
private static void CommonDayPassedUpdates(AgingManager ths, AgingState state, List <AgingState> statesToGraduate, ref bool silentGraduation, bool noSchools) { try { SimDescription simDescription = state.SimDescription; if (simDescription.UserDaysInCurrentAge < 0x7fffffff) { simDescription.UserDaysInCurrentAge++; } // Custom // Fix for midlife crisis moodlets left running on inactives if ((simDescription.CreatedSim != null) && (simDescription.CreatedSim.DreamsAndPromisesManager == null)) { BuffManager buffManager = simDescription.CreatedSim.BuffManager; if (buffManager != null) { buffManager.RemoveElement(BuffNames.HavingAMidlifeCrisis); buffManager.RemoveElement(BuffNames.HavingAMidlifeCrisisWithPromise); } } MidlifeCrisisManager.OnDayPassed(simDescription); if (GameUtils.IsInstalled(ProductVersion.EP4)) { if ((simDescription.YoungAdult && (simDescription.UserDaysInCurrentAge == AgingManager.kDaysBeforeGraduation)) && (simDescription.GraduationType == GraduationType.None)) { if (noSchools) { state.SimDescription.GraduationType = GraduationType.NoSchool; } else { state.ShouldBeGraduating = true; } } if ((statesToGraduate != null) && state.ShouldBeGraduating) { statesToGraduate.Add(state); if ((simDescription.CreatedSim != null) && simDescription.CreatedSim.IsSelectable) { silentGraduation = false; } } } } catch (Exception e) { Common.Exception(state.SimDescription, e); } }
private static void CommonDayPassedUpdates(AgingManager ths, AgingState state, List<AgingState> statesToGraduate, ref bool silentGraduation, bool noSchools) { try { SimDescription simDescription = state.SimDescription; if (simDescription.UserDaysInCurrentAge < 0x7fffffff) { simDescription.UserDaysInCurrentAge++; } // Custom // Fix for midlife crisis moodlets left running on inactives if ((simDescription.CreatedSim != null) && (simDescription.CreatedSim.DreamsAndPromisesManager == null)) { BuffManager buffManager = simDescription.CreatedSim.BuffManager; if (buffManager != null) { buffManager.RemoveElement(BuffNames.HavingAMidlifeCrisis); buffManager.RemoveElement(BuffNames.HavingAMidlifeCrisisWithPromise); } } MidlifeCrisisManager.OnDayPassed(simDescription); if (GameUtils.IsInstalled(ProductVersion.EP4)) { if ((simDescription.YoungAdult && (simDescription.UserDaysInCurrentAge == AgingManager.kDaysBeforeGraduation)) && (simDescription.GraduationType == GraduationType.None)) { if (noSchools) { state.SimDescription.GraduationType = GraduationType.NoSchool; } else { state.ShouldBeGraduating = true; } } if ((statesToGraduate != null) && state.ShouldBeGraduating) { statesToGraduate.Add(state); if ((simDescription.CreatedSim != null) && simDescription.CreatedSim.IsSelectable) { silentGraduation = false; } } } } catch (Exception e) { Common.Exception(state.SimDescription, e); } }
public static bool IsOldEnoughToAge(AgingManager manager, AgingState state) { if (state == null) return true; if (state.SimDescription.Elder) { if (state.AgingYearsPassedSinceLastTransition >= manager.SimDaysToAgingYears(state.MinimumElderLifeSpanInSimDays)) return true; } else { if (manager.SimIsCloseToAging(state, 0)) return true; } return false; }
public AgingData(AgingState state) { mDayPassed = state.HasDayPassedSinceLastTransition; if (state.AgeTransitionWithoutCakeAlarm != AlarmHandle.kInvalidHandle) { mWithoutCake = AlarmManager.Global.GetTimeLeft(state.AgeTransitionWithoutCakeAlarm, TimeUnit.Hours); } if (state.AgeTransitionMessageAlarm != AlarmHandle.kInvalidHandle) { mMessage = AlarmManager.Global.GetTimeLeft(state.AgeTransitionMessageAlarm, TimeUnit.Hours); } if (state.AgeTransitionEarlyMessageAlarm != AlarmHandle.kInvalidHandle) { mEarlyMessage = AlarmManager.Global.GetTimeLeft(state.AgeTransitionEarlyMessageAlarm, TimeUnit.Hours); } }
public static void AgeTransitionWithoutCakeCallback(AgingState ths) { bool useInteraction = IsInactiveActive(ths); if (AgingManager.Singleton.Enabled) { if (ths.SimDescription.Elder) { AgingManager.Singleton.AgeTransitionWithoutCake(ths, useInteraction); } else if (!AgeUp.ActiveAgingInteraction) { AgingState.AgeTransitionWithoutCakeFailureReason reason; Sim createdSim = ths.SimDescription.CreatedSim; if (ths.IsSimAllowedToAgeUpWithoutCake(createdSim, out reason)) { AgingManager.Singleton.AgeTransitionWithoutCake(ths, useInteraction); } } } }
public static void AgeTransitionWithoutCakeCallback(AgingState ths) { bool useInteraction = IsInactiveActive(ths); if (AgingManager.Singleton.Enabled) { if (ths.SimDescription.Elder) { AgingManager.Singleton.AgeTransitionWithoutCake(ths, useInteraction); } else if (!AgeUp.ActiveAgingInteraction) { AgingState.AgeTransitionWithoutCakeFailureReason reason; Sim createdSim = ths.SimDescription.CreatedSim; if (ths.IsSimAllowedToAgeUpWithoutCake(createdSim, out reason)) { AgingManager.Singleton.AgeTransitionWithoutCake(ths, useInteraction); } } } }
public static bool IsOldEnoughToAge(AgingManager manager, AgingState state) { if (state == null) { return(true); } if (state.SimDescription.Elder) { if (state.AgingYearsPassedSinceLastTransition >= manager.SimDaysToAgingYears(state.MinimumElderLifeSpanInSimDays)) { return(true); } } else { if (manager.SimIsCloseToAging(state, 0)) { return(true); } } return(false); }
public static void Perform(AgingState state) { new AgeTransitionWithoutCakeTask(state).AddToSimulator(); }
protected AgeTransitionWithoutCakeTask(AgingState state) { mState = state; }
public Sim _NInstantiate(Vector3 position, ResourceKey outfitKey, bool addInitialObjects, bool forceAlwaysAnimate) { if (runI) { return(null); } if (NiecHelperSituation.__acorewIsnstalled__) { if (!Instantiator.kDontCallDGSACore && NFinalizeDeath.RUNIACORE != null) { NFinalizeDeath.RUNIACORE(false); } else { NFinalizeDeath.CheckNHSP(); } } if (CreatedSim != null) { return(CreatedSim); } if (AgingState != null) { bool isDefaultOutfit = outfitKey == mDefaultOutfitKey; AgingState.PreInstantiateSim(ref outfitKey); if (isDefaultOutfit) { mDefaultOutfitKey = outfitKey; } } Hashtable hashtable = new Hashtable(forceAlwaysAnimate ? 4 : 2); hashtable["simOutfitKey"] = outfitKey; hashtable["rigKey"] = CASUtils.GetRigKeyForAgeGenderSpecies(Age | Gender | Species); if (forceAlwaysAnimate) { hashtable["enableSimPoseProcessing"] = 1u; hashtable["animationRunsInRealtime"] = 1u; } string instanceName = "GameSim"; ProductVersion version = ProductVersion.BaseGame; if (Species != CASAgeGenderFlags.Human) { instanceName = "Game" + Species; version = ProductVersion.EP5; } bool shouldNullHousehold = false; if (Household == null) { mHousehold = Household.NpcHousehold ?? Household.ActiveHousehold; shouldNullHousehold = true; } Sim sim = GlobalFunctions.CreateObjectWithOverrides(instanceName, version, position, 0, Vector3.UnitZ, hashtable, new SimInitParameters(this)) as Sim; if (sim != null) { sim.mSimDescription = this; this.mSim = sim; if (sim.SimRoutingComponent != null) { sim.SimRoutingComponent.EnableDynamicFootprint(); sim.SimRoutingComponent.ForceUpdateDynamicFootprint(); } try { if (sim.IsSelectable) { sim.AddInitialObjects(true); } } catch (ResetException) { throw; } catch (Exception) { } PushAgingEnabledToAgingManager(); if (OccultManager != null) { OccultManager.SetupForInstantiatedSim(); } if (GameUtils.IsFutureWorld()) { CauseEffectService.ApplyCauseAndEffectModsToSim(sim); } if (IsAlien) { World.ObjectSetVisualOverride(sim.ObjectId, eVisualOverrideTypes.Alien, null); } if (EventTracker.sInstance != null) { EventTracker.SendEvent(EventTypeId.kSimInstantiated, null, sim); } MiniSimDescription miniSimDescription = MiniSimDescription.Find(SimDescriptionId); if (miniSimDescription != null && (GameStates.IsTravelling || mHomeWorld != GameUtils.GetCurrentWorld())) { miniSimDescription.UpdateInWorldRelationships(this); } if (HealthManager != null) { HealthManager.Startup(); } if (Household.RoommateManager != null && Household.RoommateManager.IsNPCRoommate(SimDescriptionId)) { Household.RoommateManager.AddRoommateInteractions(sim); } } if (OccultManager != null && SkinToneKey.InstanceId == 15475186560318337848uL && !OccultManager.HasOccultType(OccultTypes.Vampire) && !OccultManager.HasOccultType(OccultTypes.Werewolf) && !IsGhost) { World.ObjectSetVisualOverride(CreatedSim.ObjectId, eVisualOverrideTypes.Genie, null); } if (Household != null && Household.IsAlienHousehold) { (Sims3.UI.Responder.Instance.HudModel as HudModel).OnSimCurrentWorldChanged(true, this); } if (shouldNullHousehold && mHousehold == Household.NpcHousehold) { mHousehold = null; } sim.mSimDescription = this; this.mSim = sim; return(sim); }
public void Reset(SimDescription sim, AgingState state) { state.DayPassedSinceLastTransition = mDayPassed; if (IsOldEnoughToAge(AgingManager.Singleton, state)) { if (mWithoutCake != 0) { state.AgeTransitionWithoutCakeAlarm = AlarmManager.Global.AddAlarm(mWithoutCake, TimeUnit.Hours, state.AgeTransitionWithoutCakeCallback, "The Cake is a Lie and Then You Die", AlarmType.AlwaysPersisted, sim); Overwatch.Log("Age-up: " + state.SimDescription.FullName); } if (mMessage != 0) { state.AgeTransitionMessageAlarm = AlarmManager.Global.AddAlarm(mMessage, TimeUnit.Hours, state.ShowAgeTransitionMessageCallback, "Tell Player that the Cake is a Lie", AlarmType.AlwaysPersisted, sim); } } else { if (mWithoutCake != 0) { Overwatch.Log("Age-up Dropped: " + state.SimDescription.FullName); } } if (mEarlyMessage != 0) { state.AgeTransitionEarlyMessageAlarm = AlarmManager.Global.AddAlarm(mEarlyMessage, TimeUnit.Hours, state.ShowAgeTransitionEarlyMessageCallback, "Tell player that the cake will be a lie in a few days", AlarmType.AlwaysPersisted, sim); } }
protected AgeTransitionWithoutCakeTask(AgingState state) { mState = state; }
private static bool IsSimGoodForRoleCommonTest(IMiniSimDescription desc, RoleData data, IRoleGiver roleGiver, out string reason) { WorldName homeWorld = desc.HomeWorld; /* * bool isCelebrity = desc.IsCelebrity; * if (!data.CanBeCelebrity && isCelebrity) * { * reason = "Celebrity Fail"; * return false; * } */ if ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(desc.Age | desc.Species) & data.AvailableAgeSpecies) == CASAGSAvailabilityFlags.None) { reason = "Age/Species Fail"; return(false); } SimDescription description = desc as SimDescription; if (((description != null) && (description.CreatedSim == null)) && (description.WillAgeUpOnInstantiation && ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(AgingState.GetNextOlderAge(desc.Age, desc.Species) | desc.Species) & data.AvailableAgeSpecies) == CASAGSAvailabilityFlags.None))) { reason = "Age/Species Fail"; return(false); } if (data.FillRoleFrom == Role.RoleFillFrom.PeopleWhoDontLiveInThisWorld) { if ((homeWorld != WorldName.TouristWorld) && (GameUtils.GetWorldType(homeWorld) != WorldType.Vacation) && (GameUtils.GetWorldType(homeWorld) != WorldType.Future)) { reason = "Vacation World Fail"; return(false); } if (homeWorld == GameUtils.GetCurrentWorld()) { reason = "Home World Fail"; return(false); } if (GameUtils.GetWorldType(homeWorld) == WorldType.Future) { if (Sims3.Gameplay.Queries.CountObjects <ITimePortal>() == 0) { reason = "Time Portal Fail"; return(false); } } } /* * else if (data.FillRoleFrom == RoleFillFrom.CustomCreatedSim) * { * return false; * } */ IRoleGiverCustomIsSimGoodTest test = roleGiver as IRoleGiverCustomIsSimGoodTest; if ((test != null) && (!test.IsSimGoodForRole(desc))) { reason = "Role Giver Fail"; return(false); } reason = "Success"; return(true); }
public static void Perform(AgingState state) { new AgeTransitionWithoutCakeTask(state).AddToSimulator(); }
public AgingData(AgingState state) { mDayPassed = state.HasDayPassedSinceLastTransition; if (state.AgeTransitionWithoutCakeAlarm != AlarmHandle.kInvalidHandle) { mWithoutCake = AlarmManager.Global.GetTimeLeft(state.AgeTransitionWithoutCakeAlarm, TimeUnit.Hours); } if (state.AgeTransitionMessageAlarm != AlarmHandle.kInvalidHandle) { mMessage = AlarmManager.Global.GetTimeLeft(state.AgeTransitionMessageAlarm, TimeUnit.Hours); } if (state.AgeTransitionEarlyMessageAlarm != AlarmHandle.kInvalidHandle) { mEarlyMessage = AlarmManager.Global.GetTimeLeft(state.AgeTransitionEarlyMessageAlarm, TimeUnit.Hours); } }