Esempio n. 1
0
        public static IEnumerable <Toil> ToilsAskForWoohoo(Pawn pawn, Pawn mate, Building_Bed bed, bool askSuccess,
                                                           HookupBedManager hookupBedManager)
        {
            yield return(ToilerHelper.GotoThing(pawn, mate));

            yield return(AskForWoohoo(pawn, mate, bed, askSuccess));

            if (askSuccess)
            {
                yield return(new Toil
                {
                    initAction = delegate()
                    {
                        /* Log.Message("Claiming Bed spots"); */
                        hookupBedManager.claim(pawn, mate);
                        /* Log.Message("Claimed Bed spots"); */
                    },
                    defaultCompleteMode = ToilCompleteMode.Instant
                });
            }
            else
            {
                yield return(new Toil
                {
                    initAction = delegate()
                    {
                        /* Log.Message("Cursing at for asking"); */

                        Job newJob = new Job(JobDefOf.Insult, pawn, bed);
                        mate.jobs.StartJob(newJob, JobCondition.InterruptForced, null, false, true, null, null,
                                           true);
                    },
                    socialMode = RandomSocialMode.Off,
                    defaultCompleteMode = ToilCompleteMode.Instant
                });
            }
        }
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);
        }