Пример #1
0
        public override bool Run()
        {
            try
            {
                if (!Target.IsActorUsingMe(Actor))
                {
                    List <ISurface> objectsInRoom = Actor.LotCurrent.GetObjectsInRoom <ISurface>(Actor.RoomId);
                    if (!CarrySystem.PutDownOnNearestSurface(Actor, objectsInRoom, SurfaceType.Normal, false, false, true))
                    {
                        CarrySystem.PutDownOnFloor(Actor);
                    }

                    if (!Actor.RouteToSlotList(Target, Target.UseableSlots(Actor, false, true), out mSlotIndex))
                    {
                        return(false);
                    }

                    Target.SetRoutingSlotInUse(mSlotIndex);
                    if (Actor.HasExitReason())
                    {
                        return(false);
                    }

                    SetPriority(new InteractionPriority(InteractionPriorityLevel.High));
                    mActorFairy = Actor.SimDescription.OccultManager.GetOccultType(OccultTypes.Fairy) as OccultFairy;

                    StandardEntry();
                    BeginCommodityUpdates();
                    EnterStateMachine("fairyhouseaccess", "Enter", "x");
                    SetParameter("Slot", FairyHouse.kSlotToCompass[mSlotIndex]);

                    if (mActorFairy != null)
                    {
                        mActorFairy.AttachTrueFairyFormToAnimation(mCurrentStateMachine);
                    }

                    AddOneShotScriptEventHandler(0x65, OnHideActorEx);
                    AnimateSim("Fly In");

                    if (mActorFairy != null)
                    {
                        mActorFairy.HideFairyTrueFormHardStop();
                    }

                    FairyHouse.FairyHousePosture posture = new FairyHouse.FairyHousePosture(Actor, Target, mCurrentStateMachine);
                    Actor.Posture      = posture;
                    Actor.BridgeOrigin = posture.Idle();
                    PlumbBob.Reparent();

                    if (!Target.IsLightOn())
                    {
                        Target.TurnOnLight();
                    }
                    EndCommodityUpdates(true);
                    StandardExit(false, false);
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Пример #2
0
        public override bool Run()
        {
            try
            {
                if (WoohooHouse == null)
                {
                    return(false);
                }
                if (!SafeToSync())
                {
                    return(false);
                }
                PetHouse.WoohooPetHouseB entry = PetHouse.WoohooPetHouseB.Singleton.CreateInstance(Actor, Target, GetPriority(), Autonomous, CancellableByPlayer) as PetHouse.WoohooPetHouseB;
                entry.LinkedInteractionInstance = this;
                Target.InteractionQueue.Add(entry);
                Actor.SynchronizationLevel  = Sim.SyncLevel.Started;
                Actor.SynchronizationTarget = Target;
                Actor.SynchronizationRole   = Sim.SyncRole.Initiator;
                if (!WoohooHouse.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.Default, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), 10f))
                {
                    return(false);
                }
                if (!Actor.RouteToSlotAndCheckInUse(WoohooHouse, Slot.RoutingSlot_3))
                {
                    if (!Actor.HasExitReason(ExitReason.RouteFailed))
                    {
                        WoohooHouse.SimLine.RemoveFromQueue(Actor);
                        WoohooHouse.PlayRouteFailAndWanderAway(Actor);
                        return(false);
                    }
                    Actor.RemoveExitReason(ExitReason.RouteFailed);
                    if (!Actor.RouteToSlotAndCheckInUse(WoohooHouse, Slot.RoutingSlot_3))
                    {
                        WoohooHouse.SimLine.RemoveFromQueue(Actor);
                        WoohooHouse.PlayRouteFailAndWanderAway(Actor);
                        return(false);
                    }
                }
                StandardEntry();
                WoohooHouse.AddToUseList(Actor);
                WoohooHouse.AddToUseList(Target);
                EnterStateMachine("PetHouse", "enter", "x");
                SetActor("petHouse", WoohooHouse);
                SetActor("y", Target);
                Animate("x", "getInWoohooX");
                Actor.ParentToSlot(WoohooHouse, WoohooHouse.GetContainmentSlotForActor(Actor));
                WoohooHouse.SimLine.RemoveFromQueue(Actor);
                if (!Actor.WaitForSynchronizationLevelWithSim(Target, Sim.SyncLevel.Routed, 30f))
                {
                    Actor.UnParent();
                    Animate("x", "inHouseNeutral");
                    Animate("x", "exit");
                    StandardExit();
                    WoohooHouse.RemoveFromUseList(Actor);
                    WoohooHouse.RemoveFromUseList(Target);
                    return(false);
                }
                BeginCommodityUpdates();
                (LinkedInteractionInstance as PetHouse.WoohooPetHouseB).BeginCommodityUpdates();
                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                EnterState("y", "enter");
                Animate("y", "getInWoohooY");
                AnimateJoinSims("woohoo");
                Actor.UnParent();
                AnimateSim("exitWoohoo");
                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);

                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                CommonWoohoo.RunPostWoohoo(Actor, Target, WoohooHouse, definition.GetStyle(this), definition.GetLocation(WoohooHouse), true);

                if (CommonPregnancy.IsSuccess(Actor, Target, Autonomous, definition.GetStyle(this)))
                {
                    CommonPregnancy.Impregnate(Actor, Target, Autonomous, definition.GetStyle(this));
                }

                StateMachineClient smc = StateMachineClient.Acquire(Actor, "PetHouse");
                smc.SetActor("petHouse", WoohooHouse);
                smc.SetActor("x", Actor);
                smc.EnterState("x", "inHouseNeutral");
                PetHouse.PetHousePosture posture = new PetHouse.PetHousePosture(WoohooHouse, Actor, smc);
                Actor.Posture       = posture;
                ActorStayingInHouse = Actor.InteractionQueue.PushAsContinuation(PetHouse.LieDown.Singleton.CreateInstance(WoohooHouse, Actor, GetPriority(), Autonomous, CancellableByPlayer), true);
                if (!ActorStayingInHouse)
                {
                    posture.CancelPosture(Actor);
                }
                EndCommodityUpdates(true);
                (LinkedInteractionInstance as PetHouse.WoohooPetHouseB).EndCommodityUpdates(true);
                PlumbBob.Reparent();
                StandardExit();
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
                return(false);
            }
        }
Пример #3
0
        public override bool Run()
        {
            try
            {
                RoutePlanResult result = Actor.CreateRoute().PlanToSlot(Target, Target.UseableSlots(Actor, true, true));
                if (!result.Succeeded())
                {
                    return(false);
                }

                mSlotIndex = FairyHouse.kSlotToIndex[(Slot)result.mDestSlotNameHash];
                Target.SetRoutingSlotInUse(mSlotIndex);
                if (Actor.IsActiveSim)
                {
                    PlumbBob.HidePlumbBob();
                }

                StandardEntry(false);
                BeginCommodityUpdates();
                mActorFairy = Actor.SimDescription.OccultManager.GetOccultType(OccultTypes.Fairy) as OccultFairy;

                mCurrentStateMachine = Actor.Posture.CurrentStateMachine;
                AddOneShotScriptEventHandler(0x66, OnShowActorEx);
                SetParameter("Slot", FairyHouse.kSlotToCompass[mSlotIndex]);

                if (mActorFairy != null)
                {
                    mActorFairy.FairyTrueForm.SetPosition(Target.GetPositionOfSlot((Slot)result.mDestSlotNameHash));
                    mActorFairy.FairyTrueForm.SetForward(Target.GetForwardOfSlot((Slot)result.mDestSlotNameHash));
                }

                if (mActorFairy != null)
                {
                    mActorFairy.AttachTrueFairyFormToAnimation(mCurrentStateMachine);
                }

                AnimateSim("Fly Out");
                AnimateSim("Exit");
                EndCommodityUpdates(true);
                StandardExit();

                if (Target.IsLightOn() && (Target.ActorsUsingMe.Count == 0x0))
                {
                    Target.TurnOffLight();
                }

                FairyHouse.FairyHousePosture posture = Actor.Posture as FairyHouse.FairyHousePosture;
                if (posture != null)
                {
                    posture.CancelPosture(Actor);
                }

                Actor.PopPosture();
                Actor.BridgeOrigin = Actor.Posture.Idle();
                PlumbBob.Reparent();
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }