Exemple #1
0
        public override bool Run()
        {
            try
            {
                if (Route())
                {
                    if (!Target.CanBeUsedAsBed)
                    {
                        return(false);
                    }

                    HeartShapedBed target = Target as HeartShapedBed;
                    if (((target != null) && target.IsVibrating) && !Target.IsActorUsingMe(Actor))
                    {
                        target.SetVibration(Actor, false);
                    }

                    StandardEntry(false);

                    Definition definition = InteractionDefinition as Definition;

                    try
                    {
                        if (ShouldChangeIntoSleepwear())
                        {
                            GameObject container = mEntryPart.Container;
                            if (!container.IsActorUsingMe(Actor))
                            {
                                container.AddToUseList(Actor);
                            }

                            Actor.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToBed);
                        }
                        else if (definition.mIsWoohoo)
                        {
                            GameObject container = mEntryPart.Container;
                            if (!container.IsActorUsingMe(Actor))
                            {
                                container.AddToUseList(Actor);
                            }

                            if (!container.IsOutside)
                            {
                                if (Woohooer.Settings.mNakedOutfitBed)
                                {
                                    Actor.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToBathe);

                                    Woohooer.Settings.AddChange(Actor);
                                }
                                else if (Woohooer.Settings.mChangeForBedWoohoo)
                                {
                                    Actor.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToBed);
                                }
                            }
                        }
                    }
                    catch (ResetException)
                    {
                        throw;
                    }
                    catch (Exception e)
                    {
                        Common.Exception(Actor, Target, e);
                    }

                    Target.AddBuffs(Actor);
                    if (Actor.Posture is RelaxingPosture)
                    {
                        MaybePushRelax();
                        DoCommodityUpdates();
                        StandardExit(false, false);
                        return(true);
                    }
                    else if (mEntryPart.RelaxOnBed(Actor, mEntryStateName))
                    {
                        if (Actor.HasExitReason(ExitReason.UserCanceled))
                        {
                            Actor.AddExitReason(ExitReason.CancelledByPosture);
                            StandardExit(false, false);
                            return(false);
                        }
                        DoCommodityUpdates();

                        MaybePushRelax();

                        StandardExit(false, false);
                        return(true);
                    }

                    StandardExit(false, false);

                    if (ExitImmediately)
                    {
                        Actor.Posture.CancelPosture(Actor);
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(false);
        }