public override bool Run() { bool result = false; try { ProxyDefinition proxyDefinition = base.InteractionDefinition as ProxyDefinition; Vector3 slotPosition = Target.GetSlotPosition(Slot.RoutingSlot_0); if (Actor == WooHooer && !Actor.HasExitReason()) { if (!Target.SimLine.WaitForTurn(this, Actor, SimQueue.WaitBehavior.CutAheadOfLowerPrioritySims, ExitReason.Default, Toilet.kTimeToWaitInLine)) { return(result); } //float value1 = Actor.Motives.GetMotiveValue(CommodityKind.Bladder); //float value2 = WooHooee.Motives.GetMotiveValue(CommodityKind.Bladder); isSitting = (Actor.Position - slotPosition).Length() < (WooHooee.Position - slotPosition).Length(); //(value1 < Math.Min(0, value2)) || (value2 >= 0 && RandomUtil.CoinFlip()); ToiletStallWooHoo wooHoo = proxyDefinition.ProxyClone(WooHooee).CreateInstance(Target, WooHooee, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as ToiletStallWooHoo; wooHoo.LinkedInteractionInstance = this; wooHoo.WooHooer = WooHooer; wooHoo.WooHooee = WooHooee; wooHoo.isSitting = !isSitting; WooHooee.InteractionQueue.AddNext(wooHoo); } if (base.StartSync(!isSitting)) { if (!isSitting) { Actor.RouteToPointRadius(slotPosition, 1f); } if ((isSitting || Actor.WaitForSynchronizationLevelWithSim(LinkedInteractionInstance.InstanceActor, Sim.SyncLevel.Routed, 30f)) && Actor.RouteToSlot(Target, Slot.RoutingSlot_0)) { Actor.SynchronizationLevel = Sim.SyncLevel.Routed; base.StandardEntry(); StateMachineClient stateMachine = Target.GetStateMachine(Actor); if (SitDownAndWait(stateMachine)) { BuffInstance element = Actor.BuffManager.GetElement(BuffNames.ReallyHasToPee); if (element != null) { element.mTimeoutPaused = true; } base.BeginCommodityUpdates(); isWooHooing = !proxyDefinition.Makeout; bool skipFlush = false; if (isSitting) { Actor.EnableCensor(Sim.CensorType.FullHeight); base.FinishLinkedInteraction(false); skipFlush = !RelieveSelf(element); base.WaitForSyncComplete(); Actor.AutoEnableCensor(); Actor.BuffManager.UnpauseBuff(BuffNames.ImaginaryFriendFeelOfPorcelain); } else { string stateName = RandomUtil.GetRandomStringFromList(new string[] { "peeStanding", "clean" }); stateMachine.RequestState("x", stateName); Actor.EnableCensor(Sim.CensorType.FullHeight); TurnOnWooHooFx(); base.DoTimedLoop(RandomUtil.RandomFloatGaussianDistribution(5f, isWooHooing ? 15f : 10f)); if (!isWooHooing) { EventTracker.SendEvent(new SocialEvent(EventTypeId.kSocialInteraction, WooHooer, WooHooee, "Make Out", false, true, false, CommodityTypes.Undefined)); EventTracker.SendEvent(new SocialEvent(EventTypeId.kSocialInteraction, WooHooee, WooHooer, "Make Out", true, true, false, CommodityTypes.Undefined)); } else { EventTracker.SendEvent(EventTypeId.kWooHooed, WooHooer, Target); EventTracker.SendEvent(EventTypeId.kWooHooed, WooHooee, Target); CommonWoohoo.RunPostWoohoo(WooHooer, WooHooee, Target, proxyDefinition.GetStyle(this), proxyDefinition.GetLocation(Target), true); if (CommonPregnancy.IsSuccess(WooHooer, WooHooee, base.Autonomous, proxyDefinition.GetStyle(this))) { CommonPregnancy.Impregnate(WooHooer, WooHooee, base.Autonomous, proxyDefinition.GetStyle(this)); } WooHooer.BuffManager.AddElement(BuffNames.PublicWooHoo, Origin.FromWooHooInPublic); WooHooee.BuffManager.AddElement(BuffNames.PublicWooHoo, Origin.FromWooHooInPublic); } if (stateName == "clean") { stateMachine.RequestState("x", "putDown"); } RelieveSelf(element); base.EndCommodityUpdates(true); LinkedInteractionInstance.EndCommodityUpdates(true); } isWooHooing = false; Target.Cleanable.DirtyInc(Actor); bool autoFlush = !isSitting || Target.ToiletTuning.AutoFlushes; if (autoFlush || (!skipFlush && Target.ShouldFlush(Actor, base.Autonomous))) { Target.FlushToilet(Actor, stateMachine, !autoFlush); } if (Target.ShouldWashHands(Actor)) { Sink sink = Toilet.FindClosestSink(Actor); if (sink != null) { InteractionInstance interactionInstance = Sink.WashHands.Singleton.CreateInstance(sink, Actor, base.GetPriority(), false, true); Actor.InteractionQueue.PushAsContinuation(interactionInstance, false); } } result = true; } TurnOffCensorsAndFx(); stateMachine.RequestState("x", "Exit"); if (!isSitting) { base.FinishLinkedInteraction(true); if (result) { Relationship.Get(WooHooer, WooHooee, true).LTR.UpdateLiking(AllInOneBathroom.kLTRGainFromWoohooInAllInOneBathroom); } Actor.RouteAway(1f, 2f, false, new InteractionPriority(InteractionPriorityLevel.UserDirected), true, false, true, RouteDistancePreference.PreferFurthestFromRouteOrigin); } base.StandardExit(); } } } catch (ResetException) { throw; } catch (Exception exception) { Common.Exception(Actor, Target, exception); result = false; } return(result); }
public override bool Run() { try { BuffInstance element = Actor.BuffManager.GetElement(BuffNames.ReallyHasToPee); if ((element != null) && (element.mTimeoutCount <= UberToilet.kTimeoutRemainingForBladderEmergency)) { RequestWalkStyle(Sim.WalkStyle.Run); } else if (!Target.Line.WaitForTurn(this, SimQueue.WaitBehavior.DefaultAllowSubstitution, ~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), UberToilet.kTimeToWaitInLine)) { return(false); } else if (!Actor.RouteToSlotAndCheckInUse(Target, Slot.RoutingSlot_0)) { return(false); } ClearRequestedWalkStyles(); // Custom if (Shooless.Settings.GetPrivacy(Target)) { mSituation = Toilet.ToiletSituation.Create(Actor, Actor.LotCurrent); } if (mSituation != null) { if (!mSituation.Start()) { return(false); } if (!Actor.RouteToSlotAndCheckInUse(Target, Slot.RoutingSlot_0)) { mSituation.ExitToiletSituation(); return(false); } } CancellableByPlayer = false; StandardEntry(); StateMachineClient smc = StateMachineClient.Acquire(Actor, "ubertoilet_store"); smc.AddInterest <TraitNames>(TraitNames.HotHeaded); smc.SetActor("x", Actor); smc.SetActor("ubertoilet", Target); smc.EnterState("x", "Enter"); smc.SetParameter("isDirty", Target.Cleanable.NeedsToBeCleaned); smc.SetParameter("isBroken", Target.Repairable.Broken); mCensorEnabled = true; Actor.EnableCensor(Sim.CensorType.LowerBody); smc.AddOneShotScriptEventHandler(0x78, TurnOffCensorGrid); smc.AddOneShotScriptEventHandler(0xc8, TriggerTrapCallback); if (element != null) { element.mTimeoutPaused = true; } bool flag = false; if (ShouldSit(Actor)) { flag = true; Target.PutDownSeat(smc); smc.RequestState("x", "peeSitting"); if ((Target.SculptureComponent != null) && (Target.SculptureComponent.Material == SculptureComponent.SculptureMaterial.Ice)) { Actor.BuffManager.AddElement(BuffNames.Chilly, Origin.FromSittingOnIce); } if (Target.ToiletTuning.AutoFlushes && RandomUtil.RandomChance((float)UberToilet.kChanceOfToiletAutoFlushWhileInUse)) { smc.RequestState("x", "flushReaction"); } } else { Target.PutUpSeat(smc); smc.RequestState("x", "peeStanding"); } if (!Target.Repairable.Broken && (Target.mToiletOnStatus == UberToilet.ToiletOnStatus.Auto)) { Target.StartMusic(); } BeginCommodityUpdate(CommodityKind.Bladder, 0f); BeginCommodityUpdates(); Actor.Motives.LerpToFill(this, CommodityKind.Bladder, UberToilet.kMaxLengthUseToilet); StartStages(); OccultImaginaryFriend.GrantMilestoneBuff(Actor, BuffNames.ImaginaryFriendFeelOfPorcelain, Origin.FromImaginaryFriendFirstTime, true, true, false); bool succeeded = DoLoop(~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.BuffFailureState | ExitReason.MaxSkillPointsReached | ExitReason.HigherPriorityNext)); Actor.BuffManager.UnpauseBuff(BuffNames.ImaginaryFriendFeelOfPorcelain); EndCommodityUpdates(succeeded); if (succeeded) { Actor.Motives.GetMotive(CommodityKind.Bladder).PotionBladderDecayOverride = false; } if (element != null) { element.mTimeoutPaused = false; } Target.Cleanable.DirtyInc(Actor); if (Target.ShouldPutDownSeat(Actor)) { Target.PutDownSeat(smc); } InteractionInstance instance = null; bool flag3 = Target.Line.MemberCount() > 0x1; if (Target.Repairable.Broken) { if (flag) { smc.RequestState("x", "electricBreakSitting"); } else { smc.RequestState("x", "electricBreakStanding"); } } if ((mSituation == null) || !mSituation.SomeoneDidIntrude) { if (!Target.ToiletTuning.AutoFlushes) { Target.ToiletVolume++; if (Target.ShouldFlush(Actor, Autonomous)) { Target.FlushToilet(Actor, smc, true); } } if (Target.ShouldWashHands(Actor) && !flag3) { Sink target = Toilet.FindClosestSink(Actor); if (target != null) { instance = Sink.WashHands.Singleton.CreateInstance(target, Actor, GetPriority(), false, true); } } } if (Target.mToiletOnStatus == UberToilet.ToiletOnStatus.Auto) { Target.StopMusic(); } if (!Target.Repairable.Broken) { if (Target.Upgradable.SelfCleaning && Target.mSelfCleanOn) { smc.RequestState("x", "autoClean"); Target.Cleanable.ForceClean(); Actor.BuffManager.AddElement(BuffNames.Relaxed, Origin.None); Actor.Motives.ChangeValue(CommodityKind.Hygiene, UberToilet.kChanceOfRelaxed); } else if (RandomUtil.RandomChance(UberToilet.kChanceOfRelaxed)) { Actor.BuffManager.AddElement(BuffNames.Relaxed, Origin.None); } } smc.RequestState("x", "Exit"); if (mSituation != null) { mSituation.ExitToiletSituation(); } if (flag3) { PrivacySituation.RouteToAdjacentRoom(Actor); } StandardExit(); if (instance != null) { Actor.InteractionQueue.PushAsContinuation(instance, false); } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
public override bool Run() { try { BuffInstance element = Actor.BuffManager.GetElement(BuffNames.ReallyHasToPee); if ((element != null) && (element.mTimeoutCount <= Toilet.kTimeoutRemainingForBladderEmergency)) { RequestWalkStyle(Sim.WalkStyle.Run); } if (!Target.Line.WaitForTurn(this, SimQueue.WaitBehavior.DefaultAllowSubstitution, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), Toilet.kTimeToWaitInLine)) { return(false); } if (CanPerformShooPet) { if (!Actor.SimRoutingComponent.PreRouteCheckForLine(Target)) { return(false); } Sims3.SimIFace.Route r = Actor.CreateRoute(); r.PlanToSlot(Target, Slot.RoutingSlot_0); r.RegisterCallback(new RouteCallback(SlotInUse), RouteCallbackType.TriggerOnTrue, RouteCallbackConditions.OnEventType(RouteEvent.tEventType.EventDestinationObstructed)); if (!Actor.DoRoute(r)) { return(false); } if (Target.InUse) { Actor.AddExitReason(ExitReason.ObjectInUse); return(false); } } else if (!Actor.RouteToSlotAndCheckInUse(Target, Slot.RoutingSlot_0)) { return(false); } ClearRequestedWalkStyles(); if ((!(Target is ToiletStall)) && (Shooless.Settings.GetPrivacy(Target))) { mSituation = Toilet.ToiletSituation.Create(Actor, Actor.LotCurrent); } if (mSituation != null) { if (!mSituation.Start()) { return(false); } if (!Actor.RouteToSlotAndCheckInUse(Target, Slot.RoutingSlot_0)) { mSituation.ExitToiletSituation(); return(false); } } CancellableByPlayer = false; StandardEntry(); StateMachineClient stateMachine = Target.GetStateMachine(Actor); stateMachine.SetParameter("isDirty", Target.Cleanable.NeedsToBeCleaned); mCensorEnabled = true; OutfitCategories previousCategory = Actor.CurrentOutfitCategory; int previousIndex = Actor.CurrentOutfitIndex; bool switchOutfit = false; Actor.EnableCensor(Sim.CensorType.LowerBody); stateMachine.AddOneShotScriptEventHandler(120, TurnOffCensorGrid); stateMachine.AddOneShotScriptEventHandler(200, TriggerTrapCallback); if (element != null) { element.mTimeoutPaused = true; } if (ShouldSit(Actor)) { if (Shooless.Settings.mNakedToilet) { Actor.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToBathe); switchOutfit = true; } Target.PutDownSeat(stateMachine); stateMachine.RequestState("x", "peeSitting"); if ((Target.SculptureComponent != null) && (Target.SculptureComponent.Material == SculptureComponent.SculptureMaterial.Ice)) { Actor.BuffManager.AddElement(BuffNames.Chilly, Origin.FromSittingOnIce); } if (Target.ToiletTuning.AutoFlushes && RandomUtil.RandomChance((float)Toilet.kChanceOfToiletAutoFlushWhileInUse)) { stateMachine.RequestState("x", "flushReaction"); } } else { Target.PutUpSeat(stateMachine); stateMachine.RequestState("x", "peeStanding"); } BeginCommodityUpdate(CommodityKind.Bladder, 0f); BeginCommodityUpdates(); bool succeeded = false; try { Actor.Motives.LerpToFill(this, CommodityKind.Bladder, Toilet.kMaxLengthUseToilet); StartStages(); OccultImaginaryFriend.GrantMilestoneBuff(Actor, BuffNames.ImaginaryFriendFeelOfPorcelain, Origin.FromImaginaryFriendFirstTime, true, true, false); succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.BuffFailureState | ExitReason.MaxSkillPointsReached | ExitReason.HigherPriorityNext)); Actor.BuffManager.UnpauseBuff(BuffNames.ImaginaryFriendFeelOfPorcelain); } finally { EndCommodityUpdates(succeeded); } if (succeeded) { Motive motive = Actor.Motives.GetMotive(CommodityKind.Bladder); if (motive != null) { motive.PotionBladderDecayOverride = false; } } if (element != null) { element.mTimeoutPaused = false; } Target.Cleanable.DirtyInc(Actor); if (Target.ShouldPutDownSeat(Actor)) { Target.PutDownSeat(stateMachine); } InteractionInstance instance = null; bool flag2 = Target.Line.MemberCount() > 0x1; if ((mSituation == null) || !mSituation.SomeoneDidIntrude) { if (Target.ToiletTuning.AutoFlushes) { Target.FlushToilet(Actor, stateMachine, false); } else { Target.ToiletVolume++; if (Target.ShouldFlush(Actor, Autonomous)) { Target.FlushToilet(Actor, stateMachine, true); } } if (Target.ShouldWashHands(Actor) && !flag2) { Sink target = Toilet.FindClosestSink(Actor); if (target != null) { instance = Sink.WashHands.Singleton.CreateInstance(target, Actor, GetPriority(), false, true); } } } stateMachine.RequestState("x", "Exit"); if (mSituation != null) { mSituation.ExitToiletSituation(); } if (switchOutfit) { Actor.SwitchToOutfitWithSpin(previousCategory, previousIndex); } if (flag2) { PrivacySituation.RouteToAdjacentRoom(Actor); } StandardExit(); if (instance != null) { Actor.InteractionQueue.PushAsContinuation(instance, false); } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
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); } }