Beispiel #1
0
            public override InteractionInstance CreateInstance(ref InteractionInstanceParameters parameters)
            {
                InteractionInstance na = new TakeShowerEx();

                na.Init(ref parameters);
                return(na);
            }
Beispiel #2
0
        public static bool Perform(Bathtub.TakeBath ths)
        {
            if (!ths.Target.Line.WaitForTurn(ths, SimQueue.WaitBehavior.DefaultEvict, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), Bathtub.kTimeToWaitForBath))
            {
                return(false);
            }

            bool flag = ths.Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed;

            try
            {
                ths.mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(ths.Actor, Sim.ClothesChangeReason.GoingToBathe);
            }
            catch
            {
                return(false);
            }

            ths.mSwitchOutfitHelper.Start();

            int num;

            if (!ths.Actor.RouteToSlotListAndCheckInUse(ths.Target, ths.Target.RouteEnterSlots, out num))
            {
                return(false);
            }

            if (Shooless.Settings.GetPrivacy(ths.Target))
            {
                ths.mSituation = new Bathtub.BathtubPrivacySituation(ths);
                if (!ths.mSituation.Start())
                {
                    return(false);
                }
            }

            ths.StandardEntry();
            if (ths.Actor.HasTrait(TraitNames.Hydrophobic))
            {
                ths.Actor.PlayReaction(ReactionTypes.WhyMe, ths.Target, ThoughtBalloonAxis.kDislike, ReactionSpeed.ImmediateWithoutOverlay);
            }
            if (!ths.Actor.RouteToSlot(ths.Target, ths.Target.RouteEnterSlots, out num))
            {
                if (ths.mSituation != null)
                {
                    ths.mSituation.Exit();
                }
                ths.StandardExit();

                return(false);
            }

            if (ths.Autonomous)
            {
                ths.mPriority = new InteractionPriority(InteractionPriorityLevel.UserDirected);
            }

            ths.mSlotIndex = num;
            if (ths.mSituation != null)
            {
                ths.mSituation.DeferShoo = true;
            }

            ths.mSwitchOutfitHelper.Wait(true);
            ths.mCurrentStateMachine = ths.Target.GetStateMachine(ths.Actor, "Enter_Working");
            ths.mSwitchOutfitHelper.AddScriptEventHandler(ths.mCurrentStateMachine);
            ths.TakeBathInteractionPreLoop();
            if (ths.mSituation != null)
            {
                ths.mSituation.StateMachine = ths.mCurrentStateMachine;
            }

            ths.StartStages();
            if (ths.Actor.SimDescription.IsPlantSim)
            {
                ths.ModifyCommodityUpdate(CommodityKind.Hygiene, Bathtub.kPlantSimHygieneModifier);
            }
            ths.BeginCommodityUpdates();

            bool succeeded = false;

            try
            {
                ths.Actor.RegisterGroupTalk();
                if (ths.mSituation != null)
                {
                    ths.mSituation.DeferShoo = false;
                    if (ths.mSituation.SomeoneDidIntrude)
                    {
                        ths.mSituation.ReactToIntrusion();
                    }
                }

                succeeded = ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), ths.DuringBath, null);

                if (succeeded)
                {
                    if (ths.Actor.HasTrait(TraitNames.Hydrophobic))
                    {
                        ths.Actor.PlayReaction(ReactionTypes.Cry, ths.Target, ThoughtBalloonAxis.kDislike, ReactionSpeed.AfterInteraction);
                    }
                    ths.Actor.BuffManager.RemoveElement(BuffNames.Singed);
                    ths.Actor.BuffManager.RemoveElement(BuffNames.SingedElectricity);
                    ths.Actor.BuffManager.RemoveElement(BuffNames.GotFleasHuman);
                    ths.Actor.SimDescription.RemoveFacePaint();
                    if (flag)
                    {
                        ths.mSwitchOutfitHelper.Dispose();
                        try
                        {
                            ths.mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(ths.Actor, Sim.ClothesChangeReason.GoingToBathe);
                            ths.mSwitchOutfitHelper.Start();
                            ths.mSwitchOutfitHelper.Wait(false);
                            ths.mSwitchOutfitHelper.ChangeOutfit();
                        }
                        catch
                        { }
                    }
                    ths.Actor.Motives.SetMax(CommodityKind.Hygiene);
                }

                if (!flag || (flag && succeeded))
                {
                    ths.mCurrentStateMachine.SetParameter("changeClothes", !ths.Actor.OccultManager.DisallowClothesChange());
                    ths.mSwitchOutfitHelper.Dispose();
                    try
                    {
                        ths.mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(ths.Actor, TakeShowerEx.GetOutfitReason(ths.Actor));
                        ths.mSwitchOutfitHelper.Start();
                        ths.mSwitchOutfitHelper.AddScriptEventHandler(ths.mCurrentStateMachine);
                        ths.mSwitchOutfitHelper.Wait(false);
                    }
                    catch
                    { }
                }
                ths.Actor.UnregisterGroupTalk();
            }
            finally
            {
                ths.EndCommodityUpdates(succeeded);
            }

            if (ths.mSituation != null)
            {
                ths.mSituation.StateMachine = null;
            }

            ths.TakeBathInteractionPostLoop();
            ths.StandardExit();
            return(succeeded);
        }
Beispiel #3
0
 public override InteractionInstance CreateInstance(ref InteractionInstanceParameters parameters)
 {
     InteractionInstance na = new TakeShowerEx();
     na.Init(ref parameters);
     return na;
 }