Exemplo n.º 1
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);
                }
            }
Exemplo n.º 2
0
        public override bool Run()
        {
            try
            {
                if ((Book == null) || Book.HasBeenDestroyed)
                {
                    return(false);
                }

                Book.AddToReferenceList(Actor);
                mAddedToReferenceList = true;
                InteractionDefinition readToSleepSingleton   = null;
                InteractionDefinition beReadToSleepSingleton = null;

                // Custom
                IReadToSleepObject myBed = Target.Bed as IReadToSleepObject;
                if (myBed != null)
                {
                    if (myBed.TestReadToSleep(Actor, Target))
                    {
                        readToSleepSingleton   = myBed.GetReadToSleepSingleton();
                        beReadToSleepSingleton = myBed.GetBeReadToSleepSingleton();
                    }
                }

                if (beReadToSleepSingleton == null)
                {
                    for (int i = 0; i < 2; i++)
                    {
                        foreach (IReadToSleepObject obj2 in Target.LotCurrent.GetObjects <IReadToSleepObject>())
                        {
                            if ((i == 0) && (myBed != null))
                            {
                                if (myBed.RoomId != obj2.RoomId)
                                {
                                    continue;
                                }
                            }

                            if (obj2.TestReadToSleep(Actor, Target))
                            {
                                readToSleepSingleton   = obj2.GetReadToSleepSingleton();
                                beReadToSleepSingleton = obj2.GetBeReadToSleepSingleton();
                                break;
                            }
                        }

                        if (beReadToSleepSingleton != null)
                        {
                            break;
                        }
                    }
                }

                if ((readToSleepSingleton == null) && (beReadToSleepSingleton == null))
                {
                    return(false);
                }
                InteractionInstance entry = null;
                if (beReadToSleepSingleton != null)
                {
                    entry = beReadToSleepSingleton.CreateInstanceWithCallbacks(Actor, Target, GetPriority(), Autonomous, CancellableByPlayer, new Callback(OnChildStarted), new Callback(OnChildCompleted), new Callback(OnChildFailed));
                    entry.LinkedInteractionInstance = this;
                    if (!Target.InteractionQueue.Add(entry))
                    {
                        return(false);
                    }
                }
                if (Book.InInventory)
                {
                    if (!Actor.Inventory.Contains(Book))
                    {
                        IGameObject closestBookshelf;
                        Bookshelf_GetBook.Definition definition3 = new Bookshelf_GetBook.Definition(Book);
                        if (kAlwaysUseClosestBookshelf && (ClosestBookshelf != null))
                        {
                            closestBookshelf = ClosestBookshelf;
                        }
                        else
                        {
                            closestBookshelf = Book.ItemComp.InventoryParent.Owner;
                        }
                        if (!definition3.CreateInstance(closestBookshelf, Actor, GetPriority(), Autonomous, CancellableByPlayer).RunInteraction())
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    if (!CarrySystem.PickUp(Actor, Book))
                    {
                        return(false);
                    }
                    if (!CarrySystem.PutInSimInventory(Actor))
                    {
                        return(false);
                    }
                }

                if (!Actor.Inventory.Contains(Book))
                {
                    return(false);
                }

                if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                {
                    return(false);
                }

                LinkedInteractionInstance = null;
                InteractionInstance instance = readToSleepSingleton.CreateInstance(Target, Actor, GetPriority(), Autonomous, CancellableByPlayer);
                instance.LinkedInteractionInstance = entry;
                (instance as IReadToSleepInteraction).ReservedBook = Book;
                return(Actor.InteractionQueue.PushAsContinuation(instance, true));
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }