Ejemplo n.º 1
0
        public override bool Run()
        {
            this.mClothingPile = this.Actor.GetObjectInRightHand() as ClothingPileWet;
            if (mClothingPile == null)
            {
                ClothingPileWet closestObject1 = GlobalFunctions.GetClosestObject <ClothingPileWet>((IEnumerable <ClothingPileWet>) this.Target.LotCurrent.GetObjects <ClothingPileWet>(), (IGameObject)this.Target);
                if (closestObject1 != null)
                {
                    this.Actor.InteractionQueue.PushAsContinuation(ClothingPileWet.DryClothesInDryer.Singleton, (IGameObject)closestObject1, true);
                    return(true);
                }
                WashingMachine closestObject2 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>) this.Target.LotCurrent.GetObjects <WashingMachine>(), (IGameObject)this.Target, new Predicate <WashingMachine>(WashingMachineDoLaundryEx.IsWashingDone));
                if (closestObject2 != null)
                {
                    this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DryClothesInDryer.Singleton, (IGameObject)closestObject2, true);
                    return(true);
                }
                return(false);
            }
            if (!this.Target.RouteToDryerAndCheckInUse((InteractionInstance)this) || this.Target.CurDryerState != Dryer.DryerState.Empty)
            {
                CarrySystem.PutDownOnFloor(this.Actor, new SacsEventHandler(this.OnPutdownAnimationEvent), 102U);
                return(false);
            }
            this.StandardEntry();
            this.Target.mDryerStateMachine = StateMachineClient.Acquire((IHasScriptProxy)this.Target, "dryer");
            StateMachineClient dryerStateMachine = this.Target.mDryerStateMachine;

            dryerStateMachine.SetActor("x", (IHasScriptProxy)this.Actor);
            dryerStateMachine.SetActor("clothesBag", (IHasScriptProxy)this.mClothingPile);
            dryerStateMachine.SetActor("dryer", (IHasScriptProxy)this.Target);
            dryerStateMachine.EnterState("x", "Enter");
            dryerStateMachine.EnterState("dryer", "Enter");
            dryerStateMachine.AddPersistentScriptEventHandler(0U, new SacsEventHandler(this.OnAnimationEvent));
            this.BeginCommodityUpdates();
            CarrySystem.ExitAndKeepHolding(this.Actor);
            dryerStateMachine.RequestState(false, "dryer", "Start Dryer");
            dryerStateMachine.RequestState(true, "x", "Start Dryer");
            this.EndCommodityUpdates(true);
            dryerStateMachine.RequestState(false, "dryer", "Loop Operate");
            dryerStateMachine.RequestState(true, "x", "Exit Add Clothes");
            Punishment.ApplyAbsolvingActionToSim(this.Actor, Punishment.AbsolvingActionType.DoingLaundry);
            this.StandardExit();
            return(true);
        }
Ejemplo n.º 2
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);
        }