public static bool PushDrinkAsContinuation(Sim sim, ConcessionsStand.ConcessionsBeverage g) { GameObject chair = FindClosestChair(sim); Posture posture = new Glass.CarryingGlassPosture(sim, g); if (sim.Posture is Sim.StandingPosture) { sim.Posture = posture; } else { posture.PreviousPosture = sim.Posture.PreviousPosture; sim.Posture.PreviousPosture = posture; } //if (chair != null) //{ // foreach (InteractionObjectPair item in chair.Interactions) // { // //Get the sit interaction // if (item.ToString().ToLower().Contains(".sit+definition")) // { // g.mTotalSips = AddMenuItem.ReturnTotalSipsSitting(); // g.mAvailableSipsLeft = g.mTotalSips; // sim.InteractionQueue.PushAsContinuation(Sims3.Gameplay.InteractionsShared.Sit.Singleton, chair, true, new InteractionPriority(InteractionPriorityLevel.UserDirected), true); // sim.InteractionQueue.PushAsContinuation(Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup.DrinkHeldCup.Singleton, g, true, new InteractionPriority(InteractionPriorityLevel.UserDirected), true); // } // } //} //else { try { g.mTotalSips = AddMenuItem.ReturnTotalSipsStanding(); g.mAvailableSipsLeft = g.mTotalSips; sim.InteractionQueue.PushAsContinuation(Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup.DrinkHeldCup.Singleton, g, true, new InteractionPriority(InteractionPriorityLevel.UserDirected), true); } catch (Exception ex) { StyledNotification.Show(new StyledNotification.Format(ex.Message, StyledNotification.NotificationStyle.kGameMessageNegative)); } // sim.InteractionQueue.PushAsContinuation(Glass.Drink.Singleton, g, true); } return(true); }
public static bool PushDrinkAsContinuation(Sim sim, ConcessionsStand.ConcessionsBeverage g) { GameObject chair = FindClosestChair(sim); Posture posture = new Glass.CarryingGlassPosture(sim, g); if (sim.Posture is Sim.StandingPosture) { sim.Posture = posture; } else { posture.PreviousPosture = sim.Posture.PreviousPosture; sim.Posture.PreviousPosture = posture; } //if (chair != null) //{ // foreach (InteractionObjectPair item in chair.Interactions) // { // //Get the sit interaction // if (item.ToString().ToLower().Contains(".sit+definition")) // { // g.mTotalSips = AddMenuItem.ReturnTotalSipsSitting(); // g.mAvailableSipsLeft = g.mTotalSips; // sim.InteractionQueue.PushAsContinuation(Sims3.Gameplay.InteractionsShared.Sit.Singleton, chair, true, new InteractionPriority(InteractionPriorityLevel.UserDirected), true); // sim.InteractionQueue.PushAsContinuation(Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup.DrinkHeldCup.Singleton, g, true, new InteractionPriority(InteractionPriorityLevel.UserDirected), true); // } // } //} //else { try { g.mTotalSips = AddMenuItem.ReturnTotalSipsStanding(); g.mAvailableSipsLeft = g.mTotalSips; sim.InteractionQueue.PushAsContinuation(Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup.DrinkHeldCup.Singleton, g, true, new InteractionPriority(InteractionPriorityLevel.UserDirected), true); } catch (Exception ex) { StyledNotification.Show(new StyledNotification.Format(ex.Message, StyledNotification.NotificationStyle.kGameMessageNegative)); } // sim.InteractionQueue.PushAsContinuation(Glass.Drink.Singleton, g, true); } return true; }
public override bool Run() { try { BuffInstance element = Actor.BuffManager.GetElement(BuffNames.ReallyHasToPee); if ((element != null) && (element.mTimeoutCount <= Urinal.kTimeoutRemainingForBladderEmergency)) { RequestWalkStyle(Sim.WalkStyle.Run); } if (!Target.Line.WaitForTurn(this, SimQueue.WaitBehavior.DefaultAllowSubstitution, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), Urinal.kTimeToWaitInLine)) { return(false); } if (!Target.RouteToUrinalAndCheckInUse(Actor)) { return(false); } ClearRequestedWalkStyles(); if (Shooless.Settings.GetPrivacy(Target)) { mSituation = Urinal.UrinalSituation.Create(Actor, Actor.LotCurrent); } if (mSituation != null) { if (!mSituation.Start()) { return(false); } if (!Target.RouteToUrinalAndCheckInUse(Actor)) { return(false); } } CancellableByPlayer = false; StandardEntry(); mCurrentStateMachine = Target.GetStateMachine(Actor); Glass.CarryingGlassPosture posture = Actor.Posture as Glass.CarryingGlassPosture; if (posture != null) { mDrinkInHand = posture.ObjectBeingCarried as Glass; CarrySystem.ExitCarry(Actor); mDrinkInHand.FadeOut(true); mDrinkInHand.UnParent(); Actor.PopPosture(); SetParameter("hasDrink", true); SetActor("drink", mDrinkInHand); if (Target.HasDrinkSlot && (Target.GetContainedObject(Slot.ContainmentSlot_0) == null)) { mDrinkInHand.ParentToSlot(Target, Slot.ContainmentSlot_0); mDrinkInHand.FadeIn(); } } mCensorEnabled = true; Actor.EnableCensor(Sim.CensorType.LowerBody); AddOneShotScriptEventHandler(0x78, OnAnimationEvent); AnimateSim("use"); if (element != null) { element.mTimeoutPaused = true; } if (Actor.HasTrait(TraitNames.Inappropriate)) { mWillFart = RandomUtil.RandomChance01(Urinal.kChanceInappropriateFart); if (mWillFart) { mFartTime = RandomUtil.RandomFloatGaussianDistribution(0.1f, 0.9f); } } BeginCommodityUpdate(CommodityKind.Bladder, 0f); BeginCommodityUpdates(); bool succeeded = false; try { Actor.Motives.LerpToFill(this, CommodityKind.Bladder, Urinal.kMaxLengthUseToilet); StartStages(); succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.BuffFailureState | ExitReason.MaxSkillPointsReached | ExitReason.HigherPriorityNext), new Interaction <Sim, Urinal> .InsideLoopFunction(LoopFunc), mCurrentStateMachine); } finally { EndCommodityUpdates(succeeded); } if (succeeded) { Motive motive = Actor.Motives.GetMotive(CommodityKind.Bladder); if (motive != null) { motive.PotionBladderDecayOverride = false; } } if (element != null) { element.mTimeoutPaused = false; } if (Target.IsCleanable) { Target.Cleanable.DirtyInc(Actor); } bool flag2 = Target.Line.MemberCount() > 0x1; InteractionInstance instance = null; if ((mSituation == null) || !mSituation.SomeoneDidIntrude) { if (Target.AutoFlushes) { Target.FlushToilet(Actor, mCurrentStateMachine, false); } else { Target.ToiletVolume++; if (Target.ShouldFlush(Actor, Autonomous)) { Target.FlushToilet(Actor, mCurrentStateMachine, true); } } if (((mDrinkInHand == null) && Urinal.ShouldWashHands(Actor)) && !flag2) { Sink target = Toilet.FindClosestSink(Actor); if (target != null) { instance = Sink.WashHands.Singleton.CreateInstance(target, Actor, GetPriority(), false, true); } } } AddOneShotScriptEventHandler(0x68, OnAnimationEvent); AddOneShotScriptEventHandler(0x64, OnAnimationEvent); AnimateSim("exit"); if (mSituation != null) { mSituation.ExitUrinalSituation(); } if (mDrinkInHand != null) { CarrySystem.EnterWhileHolding(Actor, mDrinkInHand); Actor.Posture = new Glass.CarryingGlassPosture(Actor, mDrinkInHand); mDrinkInHand.FadeIn(); } if (flag2) { PrivacySituation.RouteToAdjacentRoom(Actor); } StandardExit(); if (instance != null) { Actor.InteractionQueue.PushAsContinuation(instance, true); } if (!flag2 && (instance == null)) { Actor.RouteAway(Urinal.kMinDistanceToMoveAwayAfterUsingUrinal, Urinal.kMaxDistanceToMoveAwayAfterUsingUrinal, false, GetPriority(), true, true, true, RouteDistancePreference.NoPreference); } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
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); }