Ejemplo n.º 1
0
            public override bool Run()
            {
                if (this.Target.Parent != this.Actor && !CarrySystem.PickUp(this.Actor, this.Target))
                {
                    return(false);
                }
                if (this.Actor.GetObjectInRightHand() == null)
                {
                    return(false);
                }
                if (this.mJT == null)
                {
                    Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal);
                    return(false);
                }
                if (!this.Actor.RouteToObjectRadialRange(this.mJT, 0.5f, 1.5f))
                {
                    Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal);
                    return(false);
                }
                ObjectGuid containedObject = Slots.GetContainedObject(this.mJT.ObjectId, 2820733094u);

                if (containedObject != ObjectGuid.InvalidObjectGuid)
                {
                    Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal);
                    return(false);
                }
                if (this.Target.ParentToSlot(this.mJT, 2820733094u))
                {
                    CarrySystem.ExitCarry(this.Actor);
                    return(true);
                }
                Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal);
                return(false);
            }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
        }