public override bool InRabbitHole() { base.Target.ClearAmbientSounds(base.Target); if (GameUtils.IsFutureWorld()) { base.Target.AddAmbientSound("rhole_hospital_future_lp"); } else { base.Target.AddAmbientSound("rhole_hospital_loop"); } base.Target.AddAmbientSound("rhole_hospital_future_oneshot"); base.Target.StartAmbientSounds(base.Actor, base.Target); if (SimDescription.Find(this.mTargetDescription) != null) { Sim createdSim = SimDescription.Find(this.mTargetDescription).CreatedSim; if (base.SelectedObjects.Count >= 1) { while (!base.Actor.WaitForExitReason(Sim.kWaitForExitReasonDefaultTime, ExitReason.CancelExternal)) { if (((createdSim != null) && (createdSim.CurrentInteraction is Hospital.BeForcedToMakeBabyWith)) && ((createdSim.SimInRabbitHolePosture && (base.SimFollowers != null)) && base.SimFollowers.Contains(createdSim))) { break; } if (((createdSim != null) && (createdSim.InteractionQueue != null)) && (createdSim.InteractionQueue.GetNumVisibleInteractions() == 0)) { return(false); } } if (base.Actor.HasExitReason(ExitReason.CancelExternal)) { createdSim.AddExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); return(false); } base.BeginCommodityUpdates(); base.StartStages(); Definition interactionDefinition = base.InteractionDefinition as Definition; Common.Notify("Customize: " + interactionDefinition.customize.ToString()); if (interactionDefinition.customize && (!CustomizeBabyDNAModel.ShowCreateCustomizeBabyDNAUIDialog(base.Actor) || base.Actor.HasExitReason(ExitReason.CancelExternal))) { base.Actor.AddExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); createdSim.AddExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); return(false); } bool succeeded = base.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); base.EndCommodityUpdates(succeeded); if (base.Actor.HasExitReason(ExitReason.CancelExternal)) { createdSim.AddExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); return(false); } this.MakeBaby(base.Actor.SimDescription, SimDescription.Find(this.mTargetDescription), interactionDefinition.customize); this.mBabyIsMade = true; base.Actor.Household.ModifyFamilyFunds(-kCostOfBabyMaking); return(succeeded); } } return(false); }
public static void CancelAllPosingActions(Sim Target) { Target.LookAtManager.ClearAllLookAts(true); Target.AddExitReason(ExitReason.UserCanceled); Target.InteractionQueue.CancelAllInteractionsByType(PoseByName.Singleton); Target.InteractionQueue.CancelAllInteractionsByType(PlayPoseFromList.Singleton); Target.InteractionQueue.CancelAllInteractionsByType(PoseFromMyList.Singleton); Target.InteractionQueue.CancelAllInteractionsByType(TakeSamePoseAs.Singleton); Target.InteractionQueue.CancelAllInteractionsByType(QuickPose.Singleton); Target.InteractionQueue.CancelAllInteractionsByType(QuickPoseFromMyList.Singleton); Target.InteractionQueue.CancelAllInteractionsByType(RepeatPoseWithLookAt.Singleton); }
public override void Init(ArrestSuspectSituation parent) { Sim simToArrest = parent.SimToArrest; Sim cop = parent.Cop; CarService copCar = parent.CopCar; IPoliceStation target = parent.Station; InteractionInstance entry = target.GetGoToJailDefinition().CreateInstance(target, simToArrest, new InteractionPriority((InteractionPriorityLevel)99), false, false); simToArrest.AddExitReason(ExitReason.CanceledByScript); simToArrest.InteractionQueue.AddNext(entry); copCar.GetOut(cop); InteractionDefinition i = new RabbitHole.ArrestSimInRabbitHole.Definition();//.Definition(SimArrestSituation.Create(parent.Lot, parent.SimToArrest, parent.SimsLocation), false); // InteractionDefinition i = new RabbitHole.ArrestSimInRabbitHole.Definition(parent, false); base.ForceSituationSpecificInteraction(target, cop, i, null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority((InteractionPriorityLevel)99)); }
public void motive_motive_distress(Sim sim, CommodityKind commodity) { if (commodity == (CommodityKind)0x44440444) { return; } SimDescription simd = sim.SimDescription; BuffManager buffManager = sim.BuffManager; Motives moves = sim.Motives; switch (commodity) { case CommodityKind.Bladder: { bool flag = true; InteractionDefinition interactionDefinition; switch (simd.Species) { case CASAgeGenderFlags.Horse: interactionDefinition = Sim.HorsePee.Singleton; break; case CASAgeGenderFlags.Dog: case CASAgeGenderFlags.LittleDog: interactionDefinition = (InteractionDefinition)Sim.DogPeeStart.Singleton; break; case CASAgeGenderFlags.Cat: interactionDefinition = (InteractionDefinition)Sim.CatPeeStart.Singleton; break; default: interactionDefinition = Sim.BladderFailure.Singleton; break; } foreach (InteractionInstance interaction in sim.InteractionQueue.InteractionList) { if (interaction is Sim.DogPee || interaction is Sim.CatPee || interaction.InteractionDefinition == interactionDefinition) { flag = false; break; } } if (flag) { SwimmingInPool swimmingInPool = sim.Posture as SwimmingInPool; if (swimmingInPool == null) { InteractionInstance interactionInstance = interactionDefinition.CreateInstance(sim, sim, new InteractionPriority(InteractionPriorityLevel.High), false, false); Sim.DogPeeStart dogPeeStart = interactionInstance as Sim.DogPeeStart; if (dogPeeStart != null) { dogPeeStart.DoNotRoute = true; } else { Sim.CatPeeStart catPeeStart = interactionInstance as Sim.CatPeeStart; if (catPeeStart != null) { catPeeStart.DoNotRoute = true; } } if (sim.InteractionQueue.AddNext(interactionInstance) && simd.IsRaccoon) { sim.AddExitReason(ExitReason.BuffFailureState); } else { BuffInstance buffOfSolveCommodity = buffManager.GetBuffOfSolveCommodity(commodity); if (buffOfSolveCommodity != null && buffOfSolveCommodity.EffectValue <= 0) { ThoughtBalloonManager.BalloonData balloonData = new ThoughtBalloonManager.BalloonData(buffOfSolveCommodity.ThumbString); if (balloonData.IsValid) { balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon; balloonData.mCoolDown = ThoughtBalloonCooldown.None; sim.ThoughtBalloonManager.ShowBalloon(balloonData); } } moves.SetMax(CommodityKind.Bladder); if (!simd.IsPet) { PuddleManager.AddPuddle(sim.Position); moves.SetValue(CommodityKind.Hygiene, -100f); if (GlobalFunctions.AreOtherSimsNearby(sim, BuffEmbarrassed.DistanceForEmbarrassedBuff)) { buffManager.AddElement(BuffNames.Embarrassed, Origin.FromPeeingSelf); } ActiveTopic.AddToSim(sim, "Embarrassment"); } else { MetaAutonomyVenueType metaAutonomyVenueType = sim.LotCurrent.GetMetaAutonomyVenueType(); if ((!simd.IsADogSpecies || metaAutonomyVenueType != MetaAutonomyVenueType.DogPark) && World.GetTerrainType(sim.Position) == TerrainType.LotFloor) { PuddleManager.AddPuddle(sim.Position); } } EventTracker.SendEvent(EventTypeId.kBladderFailure, sim); } Motive motive = moves.GetMotive(CommodityKind.Bladder); if (motive != null) { motive.PotionBladderDecayOverride = false; } } else { swimmingInPool.ContainerPool.PeeInPool(sim); } } break; } case CommodityKind.Hunger: case CommodityKind.VampireThirst: if (simd.IsFrankenstein) { OccultFrankenstein.PushFrankensteinShortOut(sim); } else if (!simd.IsGhost && !simd.IsDead && !IsCheckKillSimInteraction(sim)) { if (sim.Posture.Satisfies(CommodityKind.ScubaDiving, null) && !simd.IsMermaid) { sim.Kill(SimDescription.DeathType.ScubaDrown); } else if (sim.Posture.Satisfies(CommodityKind.SwimmingInPool, null) && !simd.IsMermaid) { sim.Kill(SimDescription.DeathType.Drown); } else if (SimTemperature.HasFrozenSolidInteraction(sim)) { sim.Kill(SimDescription.DeathType.Freeze, null, false); } else if (OccultMermaid.IsDehydrated(sim)) { sim.Kill(SimDescription.DeathType.MermaidDehydrated, null, false); } else { sim.Kill(sim.SimDescription.IsVampire ? SimDescription.DeathType.Thirst : SimDescription.DeathType.Starve); } } break; case CommodityKind.Temperature: { float value = moves.GetValue(CommodityKind.Temperature); if (value > 0f) { SimTemperature.PushSpontaneouslyCombustInteraction(sim); } else { SimTemperature.PushFreezeInteraction(sim); } break; } case CommodityKind.MermaidDermalHydration: OccultMermaid.CollapseFromDehydration(sim); break; } }
public static bool SitDown(HotTubBase ths, Sim s, Slot slot, HotTubSeat seat, Sim.SwitchOutfitHelper switchOutfitHelper, bool isSkinnyDipping, Sim invitedBy, bool isAutonomous) { bool flag = isSkinnyDipping; bool paramValue = true; if ((s.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Swimwear) && !isSkinnyDipping) { paramValue = false; } if ((s.OccultManager.DisallowClothesChange() || (s.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed)) || s.BuffManager.DisallowClothesChange()) { paramValue = false; } if ((s.Service != null) && (s.Service.ServiceType == ServiceType.GrimReaper)) { paramValue = false; } if (s.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Naked) { flag = false; } else { s.RefreshCurrentOutfit(false); } if (!paramValue) { flag = false; } ths.PartComponent.SetSimAtPart(s, slot); switchOutfitHelper.Wait(true); StateMachineClient smc = StateMachineClient.Acquire(s, "HotTub", AnimationPriority.kAPDefault); if (smc == null) { s.AddExitReason(ExitReason.NullValueFound); ths.PartComponent.SetSimAtPart(null, slot); switchOutfitHelper.Dispose(); return false; } smc.SetActor("x", s); smc.SetActor("hotTub", ths); smc.SetParameter("IkSuffix", seat.IKSuffix); smc.SetParameter("isMirrored", seat.IsMirrored); smc.SetParameter("doClothesSpin", paramValue); smc.SetParameter("playLookaround", isSkinnyDipping && ths.IsFirstSkinnyDipper()); smc.AddOneShotScriptEventHandler(0x67, new SacsEventHandler(ths.TubEntered)); smc.AddOneShotScriptEventHandler(0xc9, new SacsEventHandler(seat.SlotSimIntoHottub)); smc.AddPersistentScriptEventHandler(0x69, new SacsEventHandler(seat.UnparentAndUpdateDrinkStatus)); if (flag) { smc.AddOneShotScriptEventHandler(0x67, new SacsEventHandler(seat.CreateClothingPile)); } smc.EnterState("x", "Enter"); switchOutfitHelper.AddScriptEventHandler(smc); Glass actor = null; seat.DrinkRef = null; Glass.CarryingGlassPosture posture = s.Posture as Glass.CarryingGlassPosture; if (posture != null) { actor = posture.ObjectBeingCarried as Glass; CarrySystem.ExitCarry(s); actor.FadeOut(true); actor.UnParent(); s.PopPosture(); actor.ParentToSlot(ths, seat.DrinkSlot); actor.FadeIn(); smc.SetActor("drink", actor); seat.DrinkRef = actor; } s.InteractionQueue.CancelAllInteractionsByType(Glass.Drink.Singleton); StereoCheap cheap = s.Inventory.Find<StereoCheap>(); if (((cheap != null) && !ths.IsSlotOccupied(ths.BoomboxSlot)) && s.Inventory.TryToRemove(cheap)) { cheap.SetOpacity(0f, 0f); if (cheap.ParentToSlot(ths, ths.BoomboxSlot)) { cheap.FadeIn(false); } else { cheap.FadeIn(false, 0f); s.Inventory.TryToAdd(cheap); } } smc.SetParameter("hasDrink", actor != null); smc.RequestState("x", "Sitting"); HotTubPosture posture2 = new HotTubPosture(s, ths, smc, seat); posture2.InvitedBy = invitedBy; posture2.AutonomouslyChosen = isAutonomous; s.Posture = posture2; if (!s.Posture.Satisfies(CommodityKind.InHotTub, ths)) { s.AddExitReason(ExitReason.FailedToStart); ths.PartComponent.SetSimAtPart(null, slot); seat.DrinkRef = null; return false; } EventTracker.SendEvent(new Event(EventTypeId.kGoHotTubbing, s, ths)); if (isSkinnyDipping) { StartSkinnyDipBroadcastersAndSendWishEvents(ths, s); } return true; }
public static bool SitDown(HotTubBase ths, Sim s, Slot slot, HotTubSeat seat, Sim.SwitchOutfitHelper switchOutfitHelper, bool isSkinnyDipping, Sim invitedBy, bool isAutonomous) { bool flag = isSkinnyDipping; bool paramValue = true; if ((s.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Swimwear) && !isSkinnyDipping) { paramValue = false; } if ((s.OccultManager.DisallowClothesChange() || (s.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed)) || s.BuffManager.DisallowClothesChange()) { paramValue = false; } if ((s.Service != null) && (s.Service.ServiceType == ServiceType.GrimReaper)) { paramValue = false; } if (s.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Naked) { flag = false; } else { s.RefreshCurrentOutfit(false); } if (!paramValue) { flag = false; } ths.PartComponent.SetSimAtPart(s, slot); switchOutfitHelper.Wait(true); StateMachineClient smc = StateMachineClient.Acquire(s, "HotTub", AnimationPriority.kAPDefault); if (smc == null) { s.AddExitReason(ExitReason.NullValueFound); ths.PartComponent.SetSimAtPart(null, slot); switchOutfitHelper.Dispose(); return(false); } smc.SetActor("x", s); smc.SetActor("hotTub", ths); smc.SetParameter("IkSuffix", seat.IKSuffix); smc.SetParameter("isMirrored", seat.IsMirrored); smc.SetParameter("doClothesSpin", paramValue); smc.SetParameter("playLookaround", isSkinnyDipping && ths.IsFirstSkinnyDipper()); smc.AddOneShotScriptEventHandler(0x67, new SacsEventHandler(ths.TubEntered)); smc.AddOneShotScriptEventHandler(0xc9, new SacsEventHandler(seat.SlotSimIntoHottub)); smc.AddPersistentScriptEventHandler(0x69, new SacsEventHandler(seat.UnparentAndUpdateDrinkStatus)); if (flag) { smc.AddOneShotScriptEventHandler(0x67, new SacsEventHandler(seat.CreateClothingPile)); } smc.EnterState("x", "Enter"); switchOutfitHelper.AddScriptEventHandler(smc); Glass actor = null; seat.DrinkRef = null; Glass.CarryingGlassPosture posture = s.Posture as Glass.CarryingGlassPosture; if (posture != null) { actor = posture.ObjectBeingCarried as Glass; CarrySystem.ExitCarry(s); actor.FadeOut(true); actor.UnParent(); s.PopPosture(); actor.ParentToSlot(ths, seat.DrinkSlot); actor.FadeIn(); smc.SetActor("drink", actor); seat.DrinkRef = actor; } s.InteractionQueue.CancelAllInteractionsByType(Glass.Drink.Singleton); StereoCheap cheap = s.Inventory.Find <StereoCheap>(); if (((cheap != null) && !ths.IsSlotOccupied(ths.BoomboxSlot)) && s.Inventory.TryToRemove(cheap)) { cheap.SetOpacity(0f, 0f); if (cheap.ParentToSlot(ths, ths.BoomboxSlot)) { cheap.FadeIn(false); } else { cheap.FadeIn(false, 0f); s.Inventory.TryToAdd(cheap); } } smc.SetParameter("hasDrink", actor != null); smc.RequestState("x", "Sitting"); HotTubPosture posture2 = new HotTubPosture(s, ths, smc, seat); posture2.InvitedBy = invitedBy; posture2.AutonomouslyChosen = isAutonomous; s.Posture = posture2; if (!s.Posture.Satisfies(CommodityKind.InHotTub, ths)) { s.AddExitReason(ExitReason.FailedToStart); ths.PartComponent.SetSimAtPart(null, slot); seat.DrinkRef = null; return(false); } EventTracker.SendEvent(new Event(EventTypeId.kGoHotTubbing, s, ths)); if (isSkinnyDipping) { StartSkinnyDipBroadcastersAndSendWishEvents(ths, s); } return(true); }