protected override IEnumerable <Toil> MakeNewToils()
        {
            /* Log.Message("I got asked to do woohoo!!!!"); */
            var list = new List <Toil>();

            list.Add(Toils_Goto.Goto(TargetIndex.A, PathEndMode.ClosestTouch));
            list.Add(Toils_Goto.Goto(TargetIndex.B, PathEndMode.ClosestTouch));
            list.AddRange(WoohooManager.AnimateLovin(pawn, TargetA.Thing as Pawn, TargetB.Thing as Building_Bed));

            Toil t;

            list.Add(t = new Toil {
                initAction = delegate { Log.Message("Getting Woohooing, will be done in 400 ticks"); }, defaultDuration = 400, defaultCompleteMode = ToilCompleteMode.Delay
            });
            t.AddFinishAction(delegate { Log.Message("Done Woohing Get"); });

            PawnHelper.DelayNextWooHoo(pawn);
            //add a moodlet for being asked
            return(list);
        }
Esempio n. 2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            //Pawn mate = TargetA.Thing as Pawn;
            //Building_Bed bed = TargetB.Thing as Building_Bed;

            Pawn         mate;
            Building_Bed bed;

            if (TargetA != null && TargetA.Thing != null && (mate = TargetA.Thing as Pawn) != null &&
                TargetB != null && TargetB.Thing != null && (bed = TargetB.Thing as Building_Bed) != null &&
                pawn != null &&
                PawnHelper.is_human(pawn) &&
                PawnHelper.is_human(mate) &&
                !bed.IsBurning()
                )
            {
                //everything is in order then
            }
            else
            {
                Log.Error("[" + pawn.Name + "] can't woohoo right.", true);
                EndJobWith(JobCondition.Errored);
                return(null);
            }

            if (pawn == mate)
            {
                throw new Exception("You cant WooHoo Alone and Together with yourself");
            }

            var hookupBedManager = new HookupBedManager(bed);

            bool partnerSaidYes;
            IEnumerable <Toil> toilsAskForWoohoo;

            if (PawnHelper.IsNotWoohooing(mate))
            {
                pawn.records.Increment(Constants.CountAskedForWoohoo);
                mate.records.Increment(Constants.CountGotAskedToWooHoo);

                partnerSaidYes = AskPartner(pawn, mate);

                toilsAskForWoohoo = WoohooManager.ToilsAskForWoohoo(pawn, mate, bed, partnerSaidYes, hookupBedManager);
            }
            else
            {
                /* Log.Message("Partner already woohooin, dont need to ask."); */
                partnerSaidYes    = true;
                toilsAskForWoohoo = nothing();
            }

            ///Log.Message("[WooHoo]Toils Ongoing: ["+r.Count()+"]");
            if (partnerSaidYes)
            {
                toilsAskForWoohoo = toilsAskForWoohoo?.Union(WoohooManager.MakePartnerWoohoo(pawn, mate, bed))
                                    .Union(WoohooManager.AnimateLovin(pawn, mate, bed))
                                    .Union(MakeMyLoveToils(pawn, mate))
                                    .Union(
                    WoohooManager.AnimateLovin(pawn, mate, bed,
                                               null
                                               , 500)
                    );
            }
            else
            {
                mate.records.Increment(Constants.CountGotAskedToWooHooSaidNo);
            }

            toilsAskForWoohoo = toilsAskForWoohoo?.Union(hookupBedManager.GiveBackToil());

            /* Log.Message("[WooHoo]Toils: ["+r.Count()+"]"); */
            PawnHelper.DelayNextWooHoo(pawn);

            return(toilsAskForWoohoo);
        }