Beispiel #1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell));

            this.gaze            = new Toil();
            this.gaze.tickAction = delegate
            {
                float num = 1f;
                List <GameCondition> activeConditions = this.$this.pawn.Map.gameConditionManager.ActiveConditions;
                for (int i = 0; i < activeConditions.Count; i++)
                {
                    num *= activeConditions[i].SkyGazeJoyGainFactor;
                }
                activeConditions = Find.World.gameConditionManager.ActiveConditions;
                for (int j = 0; j < activeConditions.Count; j++)
                {
                    num *= activeConditions[j].SkyGazeJoyGainFactor;
                }
                Pawn  pawn = this.$this.pawn;
                float extraJoyGainFactor = num;
                JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor);
            };
            this.gaze.defaultCompleteMode = ToilCompleteMode.Delay;
            this.gaze.defaultDuration     = this.job.def.joyDuration;
            this.gaze.FailOn(() => this.$this.pawn.Position.Roofed(this.$this.pawn.Map));
            this.gaze.FailOn(() => !JoyUtility.EnjoyableOutsideNow(this.$this.pawn, null));
            yield return(this.gaze);
        }
Beispiel #2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable);
            this.EndOnDespawnedOrNull(TargetIndex.B, JobCondition.Incompletable);
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.OnCell));

            Toil play = new Toil();

            play.tickAction = delegate
            {
                this.$this.pawn.rotationTracker.FaceCell(this.$this.TargetA.Cell);
                this.$this.pawn.GainComfortFromCellIfPossible();
                float statValue          = this.$this.TargetThingA.GetStatValue(StatDefOf.EntertainmentStrengthFactor, true);
                Pawn  pawn               = this.$this.pawn;
                float extraJoyGainFactor = statValue;
                JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor);
            };
            play.handlingFacing      = true;
            play.defaultCompleteMode = ToilCompleteMode.Delay;
            play.defaultDuration     = this.job.def.joyDuration;
            play.AddFinishAction(delegate
            {
                JoyUtility.TryGainRecRoomThought(this.$this.pawn);
            });
            this.ModifyPlayToil(play);
            yield return(play);
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.Touch));

            Toil doWork = new Toil();

            doWork.initAction = delegate
            {
                workLeft = 2300f;
            };
            doWork.tickAction = delegate
            {
                workLeft -= doWork.actor.GetStatValue(StatDefOf.ConstructionSpeed) * 1.7f;
                if (workLeft <= 0f)
                {
                    Thing thing = ThingMaker.MakeThing(ThingDefOf.Snowman);
                    thing.SetFaction(pawn.Faction);
                    GenSpawn.Spawn(thing, base.TargetLocA, base.Map);
                    ReadyForNextToil();
                }
                else
                {
                    JoyUtility.JoyTickCheckEnd(pawn);
                }
            };
            doWork.defaultCompleteMode = ToilCompleteMode.Never;
            doWork.FailOn(() => !JoyUtility.EnjoyableOutsideNow(pawn));
            doWork.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            yield return(doWork);
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable);
            this.EndOnDespawnedOrNull(TargetIndex.B, JobCondition.Incompletable);
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.OnCell));

            Toil play = new Toil();

            play.tickAction = delegate()
            {
                this.pawn.rotationTracker.FaceTarget(base.TargetA);
                this.pawn.GainComfortFromCellIfPossible();
                Pawn     pawn      = this.pawn;
                Building joySource = (Building)base.TargetThingA;
                JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, 1f, joySource);
            };
            play.handlingFacing      = true;
            play.defaultCompleteMode = ToilCompleteMode.Delay;
            play.defaultDuration     = this.job.def.joyDuration;
            play.AddFinishAction(delegate
            {
                JoyUtility.TryGainRecRoomThought(this.pawn);
            });
            this.ModifyPlayToil(play);
            yield return(play);

            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOn(() => !JoyUtility.EnjoyableOutsideNow(pawn));
            Toil goToil = Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell);

            goToil.tickAction = delegate
            {
                if (Find.TickManager.TicksGame > startTick + job.def.joyDuration)
                {
                    EndJobWith(JobCondition.Succeeded);
                }
                else
                {
                    JoyUtility.JoyTickCheckEnd(pawn);
                }
            };
            yield return(goToil);

            Toil toil = new Toil();

            toil.initAction = delegate
            {
                if (job.targetQueueA.Count > 0)
                {
                    LocalTargetInfo targetA = job.targetQueueA[0];
                    job.targetQueueA.RemoveAt(0);
                    job.targetA = targetA;
                    JumpToToil(goToil);
                }
            };
            yield return(toil);
        }
Beispiel #6
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell));

            Toil gaze = new Toil();

            gaze.initAction = delegate()
            {
                this.pawn.jobs.posture = PawnPosture.LayingOnGroundFaceUp;
            };
            gaze.tickAction = delegate()
            {
                float num  = this.pawn.Map.gameConditionManager.AggregateSkyGazeJoyGainFactor(this.pawn.Map);
                Pawn  pawn = this.pawn;
                float extraJoyGainFactor = num;
                JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor, null);
            };
            gaze.defaultCompleteMode = ToilCompleteMode.Delay;
            gaze.defaultDuration     = this.job.def.joyDuration;
            gaze.FailOn(() => this.pawn.Position.Roofed(this.pawn.Map));
            gaze.FailOn(() => !JoyUtility.EnjoyableOutsideNow(this.pawn, null));
            yield return(gaze);

            yield break;
        }
Beispiel #7
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.Touch));

            Toil doWork = new Toil();

            doWork.initAction = delegate()
            {
                this.workLeft = 2300f;
            };
            doWork.tickAction = delegate()
            {
                this.workLeft -= doWork.actor.GetStatValue(StatDefOf.ConstructionSpeed, true);
                if (this.workLeft <= 0f)
                {
                    Thing thing = ThingMaker.MakeThing(ThingDefOf.Snowman, null);
                    thing.SetFaction(this.pawn.Faction, null);
                    GenSpawn.Spawn(thing, this.TargetLocA, this.Map, WipeMode.Vanish);
                    this.ReadyForNextToil();
                    return;
                }
                JoyUtility.JoyTickCheckEnd(this.pawn, JoyTickFullJoyAction.EndJob, 1f, null);
            };
            doWork.defaultCompleteMode = ToilCompleteMode.Never;
            doWork.FailOn(() => !JoyUtility.EnjoyableOutsideNow(this.pawn, null));
            doWork.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            yield return(doWork);

            yield break;
        }
Beispiel #8
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOn(() => !JoyUtility.EnjoyableOutsideNow(this.$this.pawn, null));
            Toil goToil = Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell);

            goToil.tickAction = delegate
            {
                if (Find.TickManager.TicksGame > this.$this.startTick + this.$this.job.def.joyDuration)
                {
                    this.$this.EndJobWith(JobCondition.Succeeded);
                    return;
                }
                JoyUtility.JoyTickCheckEnd(this.$this.pawn, JoyTickFullJoyAction.EndJob, 1f, null);
            };
            yield return(goToil);

            yield return(new Toil
            {
                initAction = delegate
                {
                    if (this.$this.job.targetQueueA.Count > 0)
                    {
                        LocalTargetInfo targetA = this.$this.job.targetQueueA[0];
                        this.$this.job.targetQueueA.RemoveAt(0);
                        this.$this.job.targetA = targetA;
                        this.$this.JumpToToil(goToil);
                        return;
                    }
                }
            });
        }
Beispiel #9
0
 protected void MeditationTick()
 {
     pawn.skills.Learn(SkillDefOf.Intellectual, 0.0180000011f);
     pawn.GainComfortFromCellIfPossible();
     if (pawn.needs.joy != null)
     {
         JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.None);
     }
     if (pawn.IsHashIntervalTick(100))
     {
         MoteMaker.ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Meditating);
     }
     if (!ModsConfig.RoyaltyActive)
     {
         return;
     }
     pawn.psychicEntropy.Notify_Meditated();
     if (pawn.HasPsylink && pawn.psychicEntropy.PsychicSensitivity > float.Epsilon)
     {
         if (psyfocusMote == null || psyfocusMote.Destroyed)
         {
             psyfocusMote = MoteMaker.MakeAttachedOverlay(pawn, ThingDefOf.Mote_PsyfocusPulse, Vector3.zero);
         }
         psyfocusMote.Maintain();
         if (sustainer == null || sustainer.Ended)
         {
             sustainer = SoundDefOf.MeditationGainPsyfocus.TrySpawnSustainer(SoundInfo.InMap(pawn, MaintenanceType.PerTick));
         }
         sustainer.Maintain();
         pawn.psychicEntropy.GainPsyfocus(Focus.Thing);
     }
 }
Beispiel #10
0
        protected override void WaitTickAction()
        {
            float num = ArtThing.GetStatValue(StatDefOf.Beauty) / ArtThing.def.GetStatValueAbstract(StatDefOf.Beauty);
            float extraJoyGainFactor = (num > 0f) ? num : 0f;

            pawn.GainComfortFromCellIfPossible();
            JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor, (Building)ArtThing);
        }
        protected virtual void WatchTickAction()
        {
            this.pawn.rotationTracker.FaceCell(base.TargetA.Cell);
            this.pawn.GainComfortFromCellIfPossible();
            Pawn     pawn      = this.pawn;
            Building joySource = (Building)base.TargetThingA;

            JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, 1f, joySource);
        }
        protected virtual void WatchTickAction()
        {
            base.pawn.rotationTracker.FaceCell(base.TargetA.Cell);
            base.pawn.GainComfortFromCellIfPossible();
            float statValue          = base.TargetThingA.GetStatValue(StatDefOf.EntertainmentStrengthFactor, true);
            Pawn  pawn               = base.pawn;
            float extraJoyGainFactor = statValue;

            JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor);
        }
Beispiel #13
0
        protected override void WaitTickAction()
        {
            float num  = this.ArtThing.GetStatValue(StatDefOf.Beauty, true) / this.ArtThing.def.GetStatValueAbstract(StatDefOf.Beauty, null);
            float num2 = (num <= 0f) ? 0f : num;

            this.pawn.GainComfortFromCellIfPossible();
            Pawn  pawn = this.pawn;
            float extraJoyGainFactor = num2;

            JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor, (Building)this.ArtThing);
        }
Beispiel #14
0
        protected override void WaitTickAction()
        {
            float num  = 1f;
            Room  room = pawn.GetRoom();

            if (room != null)
            {
                num *= room.GetStat(RoomStatDefOf.GraveVisitingJoyGainFactor);
            }
            pawn.GainComfortFromCellIfPossible();
            JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, num, Grave);
        }
Beispiel #15
0
 protected override Action GetWaitTickAction()
 {
     return(delegate
     {
         float num = this.ArtThing.GetStatValue(StatDefOf.EntertainmentStrengthFactor, true);
         float num2 = this.ArtThing.GetStatValue(StatDefOf.Beauty, true) / this.ArtThing.def.GetStatValueAbstract(StatDefOf.Beauty, null);
         num *= ((num2 <= 0f) ? 0f : num2);
         this.pawn.GainComfortFromCellIfPossible();
         Pawn pawn = this.pawn;
         float extraJoyGainFactor = num;
         JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor);
     });
 }
Beispiel #16
0
 protected override Action GetWaitTickAction()
 {
     return(delegate
     {
         float statValue = this.ArtThing.GetStatValue(StatDefOf.EntertainmentStrengthFactor, true);
         float num = this.ArtThing.GetStatValue(StatDefOf.Beauty, true) / this.ArtThing.def.GetStatValueAbstract(StatDefOf.Beauty, null);
         statValue = (float)(statValue * ((!(num > 0.0)) ? 0.0 : num));
         base.pawn.GainComfortFromCellIfPossible();
         Pawn pawn = base.pawn;
         float extraJoyGainFactor = statValue;
         JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor);
     });
 }
Beispiel #17
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable);
            Toil chooseCell = Toils_Misc.FindRandomAdjacentReachableCell(TargetIndex.A, TargetIndex.B);

            yield return(chooseCell);

            yield return(Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null));

            yield return(Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell));

            Toil play = new Toil();

            play.initAction = delegate()
            {
                this.job.locomotionUrgency = LocomotionUrgency.Walk;
            };
            play.tickAction = delegate()
            {
                this.pawn.rotationTracker.FaceCell(base.TargetA.Thing.OccupiedRect().ClosestCellTo(this.pawn.Position));
                if (this.ticksLeftThisToil == 300)
                {
                    SoundDefOf.PlayBilliards.PlayOneShot(new TargetInfo(this.pawn.Position, this.pawn.Map, false));
                }
                if (Find.TickManager.TicksGame > this.startTick + this.job.def.joyDuration)
                {
                    base.EndJobWith(JobCondition.Succeeded);
                }
                else
                {
                    Pawn     pawn      = this.pawn;
                    Building joySource = (Building)base.TargetThingA;
                    JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, 1f, joySource);
                }
            };
            play.handlingFacing      = true;
            play.socialMode          = RandomSocialMode.SuperActive;
            play.defaultCompleteMode = ToilCompleteMode.Delay;
            play.defaultDuration     = 600;
            play.AddFinishAction(delegate
            {
                JoyUtility.TryGainRecRoomThought(this.pawn);
            });
            yield return(play);

            yield return(Toils_Reserve.Release(TargetIndex.B));

            yield return(Toils_Jump.Jump(chooseCell));

            yield break;
        }
        protected override void WaitTickAction()
        {
            float num  = 1f;
            Room  room = this.pawn.GetRoom(RegionType.Set_Passable);

            if (room != null)
            {
                num *= room.GetStat(RoomStatDefOf.GraveVisitingJoyGainFactor);
            }
            this.pawn.GainComfortFromCellIfPossible();
            Pawn  pawn = this.pawn;
            float extraJoyGainFactor = num;

            JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor, this.Grave);
        }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable);
                    this.EndOnDespawnedOrNull(TargetIndex.B, JobCondition.Incompletable);
                    this.$current = Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.OnCell);
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    play            = new Toil();
                    play.tickAction = delegate()
                    {
                        this.pawn.rotationTracker.FaceTarget(base.TargetA);
                        this.pawn.GainComfortFromCellIfPossible();
                        Pawn     pawn      = this.pawn;
                        Building joySource = (Building)base.TargetThingA;
                        JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, 1f, joySource);
                    };
                    play.handlingFacing      = true;
                    play.defaultCompleteMode = ToilCompleteMode.Delay;
                    play.defaultDuration     = this.job.def.joyDuration;
                    play.AddFinishAction(delegate
                    {
                        JoyUtility.TryGainRecRoomThought(this.pawn);
                    });
                    this.ModifyPlayToil(play);
                    this.$current = play;
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

                case 2u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
 protected override Action GetWaitTickAction()
 {
     return(delegate
     {
         float num = this.Grave.GetStatValue(StatDefOf.EntertainmentStrengthFactor, true);
         Room room = this.pawn.GetRoom(RegionType.Set_Passable);
         if (room != null)
         {
             num *= room.GetStat(RoomStatDefOf.GraveVisitingJoyGainFactor);
         }
         this.pawn.GainComfortFromCellIfPossible();
         Pawn pawn = this.pawn;
         float extraJoyGainFactor = num;
         JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor);
     });
 }
Beispiel #21
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.$current = Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell);
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    gaze            = new Toil();
                    gaze.initAction = delegate()
                    {
                        this.pawn.jobs.posture = PawnPosture.LayingOnGroundFaceUp;
                    };
                    gaze.tickAction = delegate()
                    {
                        float num2 = this.pawn.Map.gameConditionManager.AggregateSkyGazeJoyGainFactor(this.pawn.Map);
                        Pawn  pawn = this.pawn;
                        float extraJoyGainFactor = num2;
                        JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor, null);
                    };
                    gaze.defaultCompleteMode = ToilCompleteMode.Delay;
                    gaze.defaultDuration     = this.job.def.joyDuration;
                    gaze.FailOn(() => this.pawn.Position.Roofed(this.pawn.Map));
                    gaze.FailOn(() => !JoyUtility.EnjoyableOutsideNow(this.pawn, null));
                    this.$current = gaze;
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

                case 2u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            this.FailOn(() => !this.Patient.InBed() || !this.Patient.Awake());
            if (this.Chair != null)
            {
                this.FailOnDespawnedNullOrForbidden(TargetIndex.B);
            }
            if (this.Chair != null)
            {
                yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.OnCell));
            }
            else
            {
                yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell));
            }
            yield return(Toils_Interpersonal.WaitToBeAbleToInteract(this.pawn));

            yield return(new Toil
            {
                tickAction = delegate()
                {
                    this.Patient.needs.joy.GainJoy(this.job.def.joyGainRate * 0.000144f, this.job.def.joyKind);
                    if (this.pawn.IsHashIntervalTick(320))
                    {
                        InteractionDef intDef = (Rand.Value >= 0.8f) ? InteractionDefOf.DeepTalk : InteractionDefOf.Chitchat;
                        this.pawn.interactions.TryInteractWith(this.Patient, intDef);
                    }
                    this.pawn.rotationTracker.FaceCell(this.Patient.Position);
                    this.pawn.GainComfortFromCellIfPossible();
                    JoyUtility.JoyTickCheckEnd(this.pawn, JoyTickFullJoyAction.None, 1f, null);
                    if (this.pawn.needs.joy.CurLevelPercentage > 0.9999f && this.Patient.needs.joy.CurLevelPercentage > 0.9999f)
                    {
                        this.pawn.jobs.EndCurrentJob(JobCondition.Succeeded, true);
                    }
                },
                handlingFacing = true,
                socialMode = RandomSocialMode.Off,
                defaultCompleteMode = ToilCompleteMode.Delay,
                defaultDuration = this.job.def.joyDuration
            });

            yield break;
        }
Beispiel #23
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable);
            if (this.HasChair)
            {
                this.EndOnDespawnedOrNull(TargetIndex.B, JobCondition.Incompletable);
            }
            if (this.HasDrink)
            {
                this.FailOnDestroyedNullOrForbidden(TargetIndex.C);
                yield return(Toils_Goto.GotoThing(TargetIndex.C, PathEndMode.OnCell).FailOnSomeonePhysicallyInteracting(TargetIndex.C));

                yield return(Toils_Haul.StartCarryThing(TargetIndex.C, false, false, false));
            }
            yield return(Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell));

            Toil chew = new Toil();

            chew.tickAction = delegate()
            {
                this.pawn.rotationTracker.FaceCell(this.ClosestGatherSpotParentCell);
                this.pawn.GainComfortFromCellIfPossible();
                JoyUtility.JoyTickCheckEnd(this.pawn, JoyTickFullJoyAction.GoToNextToil, 1f, null);
            };
            chew.handlingFacing      = true;
            chew.defaultCompleteMode = ToilCompleteMode.Delay;
            chew.defaultDuration     = this.job.def.joyDuration;
            chew.AddFinishAction(delegate
            {
                JoyUtility.TryGainRecRoomThought(this.pawn);
            });
            chew.socialMode = RandomSocialMode.SuperActive;
            Toils_Ingest.AddIngestionEffects(chew, this.pawn, TargetIndex.C, TargetIndex.None);
            yield return(chew);

            if (this.HasDrink)
            {
                yield return(Toils_Ingest.FinalizeIngest(this.pawn, TargetIndex.C));
            }
            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell));

            yield return(new Toil
            {
                initAction = delegate
                {
                    this.$this.faceDir = ((!this.$this.job.def.faceDir.IsValid) ? Rot4.Random : this.$this.job.def.faceDir);
                },
                tickAction = delegate
                {
                    this.$this.pawn.rotationTracker.FaceCell(this.$this.pawn.Position + this.$this.faceDir.FacingCell);
                    this.$this.pawn.GainComfortFromCellIfPossible();
                    JoyUtility.JoyTickCheckEnd(this.$this.pawn, JoyTickFullJoyAction.EndJob, 1f);
                },
                handlingFacing = true,
                defaultCompleteMode = ToilCompleteMode.Delay,
                defaultDuration = this.job.def.joyDuration
            });
        }
Beispiel #25
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell));

            Toil toil = new Toil();

            toil.initAction = delegate
            {
                pawn.jobs.posture = PawnPosture.LayingOnGroundFaceUp;
            };
            toil.tickAction = delegate
            {
                float extraJoyGainFactor = pawn.Map.gameConditionManager.AggregateSkyGazeJoyGainFactor(pawn.Map);
                JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, extraJoyGainFactor);
            };
            toil.defaultCompleteMode = ToilCompleteMode.Delay;
            toil.defaultDuration     = job.def.joyDuration;
            toil.FailOn(() => pawn.Position.Roofed(pawn.Map));
            toil.FailOn(() => !JoyUtility.EnjoyableOutsideNow(pawn));
            yield return(toil);
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            Toil relax;

            if (this.FromBed)
            {
                this.KeepLyingDown(TargetIndex.A);
                yield return(Toils_Bed.ClaimBedIfNonMedical(TargetIndex.A, TargetIndex.None));

                yield return(Toils_Bed.GotoBed(TargetIndex.A));

                relax = Toils_LayDown.LayDown(TargetIndex.A, true, false, true, true);
                relax.AddFailCondition(() => !this.pawn.Awake());
            }
            else
            {
                yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell));

                relax            = new Toil();
                relax.initAction = delegate()
                {
                    this.faceDir = ((!this.job.def.faceDir.IsValid) ? Rot4.Random : this.job.def.faceDir);
                };
                relax.handlingFacing = true;
            }
            relax.defaultCompleteMode = ToilCompleteMode.Delay;
            relax.defaultDuration     = this.job.def.joyDuration;
            relax.AddPreTickAction(delegate
            {
                if (this.faceDir.IsValid)
                {
                    this.pawn.rotationTracker.FaceCell(this.pawn.Position + this.faceDir.FacingCell);
                }
                this.pawn.GainComfortFromCellIfPossible();
                JoyUtility.JoyTickCheckEnd(this.pawn, JoyTickFullJoyAction.EndJob, 1f, null);
            });
            yield return(relax);

            yield break;
        }
Beispiel #27
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                {
                    this.FailOn(() => !JoyUtility.EnjoyableOutsideNow(this.pawn, null));
                    Toil goToil = Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell);
                    goToil.tickAction = delegate()
                    {
                        if (Find.TickManager.TicksGame > this.startTick + this.job.def.joyDuration)
                        {
                            this.EndJobWith(JobCondition.Succeeded);
                        }
                        else
                        {
                            JoyUtility.JoyTickCheckEnd(this.pawn, JoyTickFullJoyAction.EndJob, 1f, null);
                        }
                    };
                    this.$current = goToil;
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);
                }

                case 1u:
                {
                    Toil getNextDest = new Toil();
                    getNextDest.initAction = delegate()
                    {
                        if (< MakeNewToils > c__AnonStorey.< > f__ref$0.$this.job.targetQueueA.Count > 0)
                        {
                            LocalTargetInfo targetA = < MakeNewToils > c__AnonStorey.< > f__ref$0.$this.job.targetQueueA[0];
                            < MakeNewToils > c__AnonStorey.< > f__ref$0.$this.job.targetQueueA.RemoveAt(0);
                            < MakeNewToils > c__AnonStorey.< > f__ref$0.$this.job.targetA = targetA;
        protected override IEnumerable <Toil> MakeNewToils()
        {
            _003CMakeNewToils_003Ec__Iterator0 _003CMakeNewToils_003Ec__Iterator = (_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_0036: stateMachine*/;

            this.FailOn(() => !JoyUtility.EnjoyableOutsideNow(_003CMakeNewToils_003Ec__Iterator._0024this.pawn, null));
            Toil goToil = Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell);

            goToil.tickAction = delegate
            {
                if (Find.TickManager.TicksGame > _003CMakeNewToils_003Ec__Iterator._0024this.startTick + _003CMakeNewToils_003Ec__Iterator._0024this.job.def.joyDuration)
                {
                    _003CMakeNewToils_003Ec__Iterator._0024this.EndJobWith(JobCondition.Succeeded);
                }
                else
                {
                    JoyUtility.JoyTickCheckEnd(_003CMakeNewToils_003Ec__Iterator._0024this.pawn, JoyTickFullJoyAction.EndJob, 1f);
                }
            };
            yield return(goToil);

            /*Error: Unable to find new state assignment for yield return*/;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            Toil toil;

            if (FromBed)
            {
                this.KeepLyingDown(TargetIndex.A);
                yield return(Toils_Bed.ClaimBedIfNonMedical(TargetIndex.A));

                yield return(Toils_Bed.GotoBed(TargetIndex.A));

                toil = Toils_LayDown.LayDown(TargetIndex.A, hasBed: true, lookForOtherJobs: false, CanSleep);
                toil.AddFailCondition(() => !pawn.Awake());
            }
            else
            {
                yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell));

                toil            = new Toil();
                toil.initAction = delegate
                {
                    faceDir = (job.def.faceDir.IsValid ? job.def.faceDir : Rot4.Random);
                };
                toil.handlingFacing = true;
            }
            toil.defaultCompleteMode = ToilCompleteMode.Delay;
            toil.defaultDuration     = job.def.joyDuration;
            toil.AddPreTickAction(delegate
            {
                if (faceDir.IsValid)
                {
                    pawn.rotationTracker.FaceCell(pawn.Position + faceDir.FacingCell);
                }
                pawn.GainComfortFromCellIfPossible();
                JoyUtility.JoyTickCheckEnd(pawn);
            });
            yield return(toil);
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.EndOnDespawnedOrNull(TargetIndex.A);
            yield return(Toils_Goto.Goto(TargetIndex.B, PathEndMode.OnCell));

            Toil toil = new Toil();

            toil.tickAction = delegate
            {
                base.pawn.rotationTracker.FaceTarget(base.TargetA);
                base.pawn.GainComfortFromCellIfPossible();
                JoyUtility.JoyTickCheckEnd(base.pawn, joySource: (Building)base.TargetThingA, fullJoyAction: job.doUntilGatheringEnded ? JoyTickFullJoyAction.None : JoyTickFullJoyAction.EndJob);
            };
            toil.handlingFacing      = true;
            toil.defaultCompleteMode = ToilCompleteMode.Delay;
            toil.defaultDuration     = (job.doUntilGatheringEnded ? job.expiryInterval : job.def.joyDuration);
            toil.AddFinishAction(delegate
            {
                JoyUtility.TryGainRecRoomThought(pawn);
            });
            ModifyPlayToil(toil);
            yield return(toil);
        }