private IEnumerable <Toil> FeedToils() { yield return(new Toil { initAction = delegate { this.$this.feedNutritionLeft = JobDriver_InteractAnimal.RequiredNutritionPerFeed(this.$this.Animal); }, defaultCompleteMode = ToilCompleteMode.Instant }); Toil gotoAnimal = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch); yield return(gotoAnimal); yield return(this.StartFeedAnimal(TargetIndex.A)); yield return(Toils_Ingest.FinalizeIngest(this.Animal, TargetIndex.B)); yield return(Toils_General.PutCarriedThingInInventory()); yield return(Toils_General.ClearTarget(TargetIndex.B)); yield return(Toils_Jump.JumpIf(gotoAnimal, () => this.$this.feedNutritionLeft > 0f)); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedNullOrForbidden(TargetIndex.B); this.FailOn(() => !FoodUtility.ShouldBeFedBySomeone(Deliveree)); if (pawn.inventory != null && pawn.inventory.Contains(base.TargetThingA)) { yield return(Toils_Misc.TakeItemFromInventoryToCarrier(pawn, TargetIndex.A)); } else if (base.TargetThingA is Building_NutrientPasteDispenser) { yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnForbidden(TargetIndex.A)); yield return(Toils_Ingest.TakeMealFromDispenser(TargetIndex.A, pawn)); } else { yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnForbidden(TargetIndex.A)); yield return(Toils_Ingest.PickupIngestible(TargetIndex.A, Deliveree)); } yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch)); yield return(Toils_Ingest.ChewIngestible(Deliveree, 1.5f, TargetIndex.A).FailOnCannotTouch(TargetIndex.B, PathEndMode.Touch)); yield return(Toils_Ingest.FinalizeIngest(Deliveree, TargetIndex.A)); }
// Token: 0x0600003F RID: 63 RVA: 0x00004036 File Offset: 0x00002236 protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedNullOrForbidden(TargetIndex.B); this.FailOn(() => !FoodUtility.ShouldBeFedBySomeone(this.Deliveree)); bool flag = base.TargetThingA is Building_NutrientPasteDispenser; if (flag) { yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnForbidden(TargetIndex.A)); yield return(Toils_Ingest.TakeMealFromDispenser(TargetIndex.A, this.pawn)); } else { yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnForbidden(TargetIndex.A)); yield return(Toils_Ingest.PickupIngestible(TargetIndex.A, this.Deliveree)); } yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch)); yield return(Toils_Ingest.ChewIngestible(this.Deliveree, 1.5f, TargetIndex.A, TargetIndex.None).FailOnCannotTouch(TargetIndex.B, PathEndMode.Touch)); yield return(Toils_Ingest.FinalizeIngest(this.Deliveree, TargetIndex.A)); yield break; }
private IEnumerable <Toil> FeedToils() { Toil toil = new Toil(); toil.initAction = delegate { feedNutritionLeft = RequiredNutritionPerFeed(Animal); }; toil.defaultCompleteMode = ToilCompleteMode.Instant; yield return(toil); Toil gotoAnimal = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch); yield return(gotoAnimal); yield return(StartFeedAnimal(TargetIndex.A)); yield return(Toils_Ingest.FinalizeIngest(Animal, TargetIndex.B)); yield return(Toils_General.PutCarriedThingInInventory()); yield return(Toils_General.ClearTarget(TargetIndex.B)); yield return(Toils_Jump.JumpIf(gotoAnimal, () => feedNutritionLeft > 0f)); }
protected override IEnumerable <Toil> MakeNewToils() { if (!this.usingNutrientPasteDispenser) { this.FailOn(() => !this.$this.IngestibleSource.Destroyed && !this.$this.IngestibleSource.IngestibleNow); } Toil chew = Toils_Ingest.ChewIngestible(this.pawn, this.ChewDurationMultiplier, TargetIndex.A, TargetIndex.B).FailOn((Toil x) => !this.$this.IngestibleSource.Spawned && (this.$this.pawn.carryTracker == null || this.$this.pawn.carryTracker.CarriedThing != this.$this.IngestibleSource)).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch); foreach (Toil toil in this.PrepareToIngestToils(chew)) { yield return(toil); } yield return(chew); yield return(Toils_Ingest.FinalizeIngest(this.pawn, TargetIndex.A)); yield return(Toils_Jump.JumpIf(chew, () => this.$this.job.GetTarget(TargetIndex.A).Thing is Corpse && this.$this.pawn.needs.food.CurLevelPercentage < 0.9f)); }
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() { base.AddFinishAction(delegate { this.$this.Map.attackTargetsCache.UpdateTarget(this.$this.pawn); }); Toil prepareToEatCorpse = new Toil(); prepareToEatCorpse.initAction = delegate { Pawn actor = prepareToEatCorpse.actor; Corpse corpse = this.$this.Corpse; if (corpse == null) { Pawn prey = this.$this.Prey; if (prey == null) { actor.jobs.EndCurrentJob(JobCondition.Incompletable, true); return; } corpse = prey.Corpse; if (corpse == null || !corpse.Spawned) { actor.jobs.EndCurrentJob(JobCondition.Incompletable, true); return; } } if (actor.Faction == Faction.OfPlayer) { corpse.SetForbidden(false, false); } else { corpse.SetForbidden(true, false); } actor.CurJob.SetTarget(TargetIndex.A, corpse); }; yield return(Toils_General.DoAtomic(delegate { this.$this.Map.attackTargetsCache.UpdateTarget(this.$this.pawn); })); Action onHitAction = delegate { Pawn prey = this.$this.Prey; bool surpriseAttack = this.$this.firstHit && !prey.IsColonist; if (this.$this.pawn.meleeVerbs.TryMeleeAttack(prey, this.$this.job.verbToUse, surpriseAttack)) { if (!this.$this.notifiedPlayerAttacked && PawnUtility.ShouldSendNotificationAbout(prey)) { this.$this.notifiedPlayerAttacked = true; Messages.Message("MessageAttackedByPredator".Translate(prey.LabelShort, this.$this.pawn.LabelIndefinite(), prey.Named("PREY"), this.$this.pawn.Named("PREDATOR")).CapitalizeFirst(), prey, MessageTypeDefOf.ThreatSmall, true); } this.$this.Map.attackTargetsCache.UpdateTarget(this.$this.pawn); this.$this.firstHit = false; } }; Toil followAndAttack = Toils_Combat.FollowAndMeleeAttack(TargetIndex.A, onHitAction).JumpIfDespawnedOrNull(TargetIndex.A, prepareToEatCorpse).JumpIf(() => this.$this.Corpse != null, prepareToEatCorpse).FailOn(() => Find.TickManager.TicksGame > this.$this.startTick + 5000 && (float)(this.$this.job.GetTarget(TargetIndex.A).Cell - this.$this.pawn.Position).LengthHorizontalSquared > 4f); followAndAttack.AddPreTickAction(new Action(this.CheckWarnPlayer)); yield return(followAndAttack); yield return(prepareToEatCorpse); Toil gotoCorpse = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch); yield return(gotoCorpse); float durationMultiplier = 1f / this.pawn.GetStatValue(StatDefOf.EatingSpeed, true); yield return(Toils_Ingest.ChewIngestible(this.pawn, durationMultiplier, TargetIndex.A, TargetIndex.None).FailOnDespawnedOrNull(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch)); yield return(Toils_Ingest.FinalizeIngest(this.pawn, TargetIndex.A)); yield return(Toils_Jump.JumpIf(gotoCorpse, () => this.$this.pawn.needs.food.CurLevelPercentage < 0.9f)); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: this.FailOnDespawnedNullOrForbidden(TargetIndex.B); this.FailOn(() => !FoodUtility.ShouldBeFedBySomeone(base.Deliveree)); if (this.pawn.inventory != null && this.pawn.inventory.Contains(base.TargetThingA)) { this.$current = Toils_Misc.TakeItemFromInventoryToCarrier(this.pawn, TargetIndex.A); if (!this.$disposing) { this.$PC = 1; } return(true); } if (base.TargetThingA is Building_NutrientPasteDispenser) { this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnForbidden(TargetIndex.A); if (!this.$disposing) { this.$PC = 2; } return(true); } this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnForbidden(TargetIndex.A); if (!this.$disposing) { this.$PC = 4; } return(true); case 1u: break; case 2u: this.$current = Toils_Ingest.TakeMealFromDispenser(TargetIndex.A, this.pawn); if (!this.$disposing) { this.$PC = 3; } return(true); case 3u: break; case 4u: this.$current = Toils_Ingest.PickupIngestible(TargetIndex.A, base.Deliveree); if (!this.$disposing) { this.$PC = 5; } return(true); case 5u: break; case 6u: this.$current = Toils_Ingest.ChewIngestible(base.Deliveree, 1.5f, TargetIndex.A, TargetIndex.None).FailOnCannotTouch(TargetIndex.B, PathEndMode.Touch); if (!this.$disposing) { this.$PC = 7; } return(true); case 7u: this.$current = Toils_Ingest.FinalizeIngest(base.Deliveree, TargetIndex.A); if (!this.$disposing) { this.$PC = 8; } return(true); case 8u: this.$PC = -1; return(false); default: return(false); } this.$current = Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch); if (!this.$disposing) { this.$PC = 6; } return(true); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; bool flag = false; switch (num) { case 0u: if (!this.usingNutrientPasteDispenser) { this.FailOn(() => !base.IngestibleSource.Destroyed && !base.IngestibleSource.IngestibleNow); } chew = Toils_Ingest.ChewIngestible(this.pawn, base.ChewDurationMultiplier, TargetIndex.A, TargetIndex.B).FailOn((Toil x) => !base.IngestibleSource.Spawned && (this.pawn.carryTracker == null || this.pawn.carryTracker.CarriedThing != base.IngestibleSource)).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch); enumerator = base.PrepareToIngestToils(chew).GetEnumerator(); num = 4294967293u; break; case 1u: break; case 2u: this.$current = Toils_Ingest.FinalizeIngest(this.pawn, TargetIndex.A); if (!this.$disposing) { this.$PC = 3; } return(true); case 3u: this.$current = Toils_Jump.JumpIf(chew, () => this.job.GetTarget(TargetIndex.A).Thing is Corpse && this.pawn.needs.food.CurLevelPercentage < 0.9f); if (!this.$disposing) { this.$PC = 4; } return(true); case 4u: this.$PC = -1; return(false); default: return(false); } try { switch (num) { } if (enumerator.MoveNext()) { toil = enumerator.Current; this.$current = toil; if (!this.$disposing) { this.$PC = 1; } flag = true; return(true); } } finally { if (!flag) { if (enumerator != null) { enumerator.Dispose(); } } } this.$current = chew; if (!this.$disposing) { this.$PC = 2; } return(true); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable); if (base.HasChair) { this.EndOnDespawnedOrNull(TargetIndex.B, JobCondition.Incompletable); } if (base.HasDrink) { this.FailOnDestroyedNullOrForbidden(TargetIndex.C); this.$current = Toils_Goto.GotoThing(TargetIndex.C, PathEndMode.OnCell).FailOnSomeonePhysicallyInteracting(TargetIndex.C); if (!this.$disposing) { this.$PC = 1; } return(true); } break; case 1u: this.$current = Toils_Haul.StartCarryThing(TargetIndex.C, false, false, false); if (!this.$disposing) { this.$PC = 2; } return(true); case 2u: break; case 3u: chew = new Toil(); chew.tickAction = delegate() { this.pawn.rotationTracker.FaceCell(base.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); this.$current = chew; if (!this.$disposing) { this.$PC = 4; } return(true); case 4u: if (base.HasDrink) { this.$current = Toils_Ingest.FinalizeIngest(this.pawn, TargetIndex.C); if (!this.$disposing) { this.$PC = 5; } return(true); } goto IL_1D6; case 5u: goto IL_1D6; default: return(false); } this.$current = Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell); if (!this.$disposing) { this.$PC = 3; } return(true); IL_1D6: this.$PC = -1; return(false); }