コード例 #1
0
ファイル: HotTubGetIn.cs プロジェクト: yakoder/NRaas
            public override InteractionInstance CreateInstance(ref InteractionInstanceParameters parameters)
            {
                InteractionInstance result = new HotTubGetIn();

                result.Init(ref parameters);
                return(result);
            }
コード例 #2
0
ファイル: HotTubGetIn.cs プロジェクト: Robobeurre/NRaas
 public override InteractionInstance CreateInstance(ref InteractionInstanceParameters parameters)
 {
     InteractionInstance result = new HotTubGetIn();
     result.Init(ref parameters);
     return result;
 }
コード例 #3
0
            public PushWooHooOrTryForBaby(HotTubBase obj, Sim actor, Sim target, bool autonomous, bool pushGetIn, InteractionDefinition definition)
            {
                mObject     = obj;
                mActor      = actor;
                mTarget     = target;
                mDefinition = definition;
                mAutonomous = autonomous;

                if (pushGetIn)
                {
                    InteractionDefinition getInDefinition = HotTubGetIn.Singleton;
                    if (Woohooer.Settings.mNakedOutfitHotTub)
                    {
                        InteractionInstanceParameters parameters = new InteractionInstanceParameters(new InteractionObjectPair(HotTubGetIn.SkinnyDipSingleton, mObject), actor, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true);

                        bool success = true;

                        GreyedOutTooltipCallback greyedOutTooltipCallback = null;
                        if (!IUtil.IsPass(HotTubGetIn.SkinnyDipSingleton.Test(ref parameters, ref greyedOutTooltipCallback)))
                        {
                            success = false;
                        }

                        if (success)
                        {
                            parameters = new InteractionInstanceParameters(new InteractionObjectPair(HotTubGetIn.SkinnyDipSingleton, mObject), target, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true);

                            if (!IUtil.IsPass(HotTubGetIn.SkinnyDipSingleton.Test(ref parameters, ref greyedOutTooltipCallback)))
                            {
                                success = false;
                            }
                        }

                        if (success)
                        {
                            getInDefinition = HotTubGetIn.SkinnyDipSingleton;
                        }
                    }

                    mActor.GreetSimOnMyLotIfPossible(mTarget);
                    HotTubGetIn entry = getInDefinition.CreateInstanceWithCallbacks(mObject, mActor, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true, null, OnActorCompleted, null) as HotTubGetIn;
                    entry.mIsMaster = true;
                    if (mActor.InteractionQueue.Add(entry))
                    {
                        InteractionInstance instance = getInDefinition.CreateInstanceWithCallbacks(mObject, mTarget, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true, null, OnCompleted, null);

                        if (mTarget.InteractionQueue.Add(instance))
                        {
                            instance.LinkedInteractionInstance = entry;
                        }
                        else
                        {
                            mTargetFail = true;
                        }
                    }
                }
                else
                {
                    OnCompleted(mActor, 1);
                }
            }
コード例 #4
0
ファイル: HotTubGetIn.cs プロジェクト: yakoder/NRaas
        public override bool Run()
        {
            try
            {
                Definition interactionDefinition = InteractionDefinition as Definition;
                bool       isSkinnyDipping       = interactionDefinition.IsSkinnyDipping || (Actor.CurrentOutfitCategory == OutfitCategories.SkinnyDippingTowel);

                pickSeat();
                if (isSkinnyDipping)
                {
                    mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToSwim, OutfitCategories.Naked, false);
                }
                else
                {
                    mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToSwim);
                }

                mSwitchOutfitHelper.Start();
                Slot none = Slot.None;
                if (!RouteToHottub(out none))
                {
                    return(false);
                }

                HotTubSeat part = Target.PartComponent.GetPart(none) as HotTubSeat;
                if (part.InUse && !MoveSimToDifferentSeat(part))
                {
                    return(false);
                }

                if (Target.Repairable.Broken)
                {
                    return(false);
                }

                StandardEntry();
                BeginCommodityUpdates();
                if (Actor.HasTrait(TraitNames.Hydrophobic))
                {
                    Actor.PlayReaction(ReactionTypes.WhyMe, Target, ReactionSpeed.ImmediateWithoutOverlay);
                }

                // Custom
                bool succeeded = HotTubBaseEx.SitDown(Target, Actor, none, part, mSwitchOutfitHelper, isSkinnyDipping, InvitedBy, Autonomous);
                if (succeeded)
                {
                    if (Actor.HasExitReason(ExitReason.CancelledByPosture))
                    {
                        InteractionInstance cancelTransition = Actor.Posture.GetCancelTransition();
                        Actor.InteractionQueue.PushAsContinuation(cancelTransition, true);
                    }
                    else
                    {
                        if ((!Target.Repairable.Broken && !Target.Repairable.UpdateBreakage(Actor)) && Actor.HasTrait(TraitNames.Hydrophobic))
                        {
                            Actor.BuffManager.AddElementPaused(BuffNames.Hydrophobic, Origin.FromHotTub);
                        }
                        Target.PushRelaxInteraction(Actor, Autonomous);
                    }
                }

                StandardExit(!succeeded, !succeeded);
                EndCommodityUpdates(succeeded);

                if (mIsMaster)
                {
                    HotTubGetIn linked = LinkedInteractionInstance as HotTubGetIn;
                    if (linked != null)
                    {
                        Sim linkedActor = linked.Actor;

                        while (!Cancelled)
                        {
                            if (!linkedActor.InteractionQueue.HasInteraction(linked))
                            {
                                break;
                            }

                            if (linked.mCompleted)
                            {
                                break;
                            }

                            SpeedTrap.Sleep(10);
                        }
                    }
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }