Esempio n. 1
0
        public static IEnumerable <Toil> AnimateLovin(Pawn pawn, Pawn mate, Building_Bed bed, Action finishAction = null,
                                                      int len = 250)
        {
            if (bed == null)
            {
                yield break;
            }

            Toil t;

            yield return(t = ToilerHelper.GotoThing(pawn, bed));

            t.AddFinishAction(delegate { Log.Message("Got To Bed for woohooing"); });

            var layDown = new Toil()
            {
                initAction = delegate
                {
                    pawn?.pather?.StopDead();
                    if (pawn?.jobs != null)
                    {
                        pawn.jobs.posture = PawnPosture.LayingInBed;
                    }
                },
                tickAction = delegate
                {
                    pawn?.GainComfortFromCellIfPossible();
                },
            };

            layDown.AddFinishAction(delegate {
                pawn?.needs?.joy?.GainJoy(Rand.Value * .15f, Constants.Joy_Woohoo);
                mate?.needs?.joy?.GainJoy(Rand.Value * .15f, Constants.Joy_Woohoo);

                /* Log.Message("[woohoo] animating done, woohoo joy between 0 and 5% added"); */
            });
            // Toils_LayDown.LayDown(TargetIndex.B, true, false, false, false);



            layDown.AddPreTickAction(delegate()
            {
                if (pawn.IsHashIntervalTick(100))
                {
                    /* Log.Message("Making Noises"); */
                    MoteMaker.ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
                }
            });
            if (finishAction != null)
            {
                layDown.AddFinishAction(finishAction);
            }


            layDown.defaultCompleteMode = ToilCompleteMode.Delay;
            layDown.defaultDuration     = len;

            yield return(layDown);
        }
Esempio n. 2
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
                });
            }
        }