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> PrepareToIngestToils_ToolUser(Toil chewToil) { if (eatingFromInventory) { yield return(Toils_Misc.TakeItemFromInventoryToCarrier(pawn, TargetIndex.A)); } else { yield return(ReserveFood()); Toil gotoToPickup = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A); yield return(Toils_Jump.JumpIf(gotoToPickup, () => pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation))); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.A)); yield return(Toils_Jump.Jump(chewToil)); yield return(gotoToPickup); yield return(Toils_Ingest.PickupIngestible(TargetIndex.A, pawn)); } if (job.takeExtraIngestibles > 0) { foreach (Toil item in TakeExtraIngestibles()) { yield return(item); } } if (!pawn.Drafted) { yield return(Toils_Ingest.CarryIngestibleToChewSpot(pawn, TargetIndex.A).FailOnDestroyedOrNull(TargetIndex.A)); } yield return(Toils_Ingest.FindAdjacentEatSurface(TargetIndex.B, TargetIndex.A)); }
private IEnumerable <Toil> PrepareToIngestToils_ToolUser(Toil chewToil) { if (eatingFromInventory) { yield return(Toils_Misc.TakeItemFromInventoryToCarrier(pawn, TargetIndex.A)); } else { yield return(ReserveFood()); Toil gotoToPickup = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A); yield return(Toils_Jump.JumpIf(gotoToPickup, () => pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation))); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.A)); yield return(Toils_Jump.Jump(chewToil)); yield return(gotoToPickup); yield return(Toils_Ingest.PickupIngestible(TargetIndex.A, pawn)); Toil reserveExtraFoodToCollect = Toils_Ingest.ReserveFoodFromStackForIngesting(TargetIndex.C); Toil findExtraFoodToCollect = new Toil { initAction = delegate { if (pawn.inventory.innerContainer.TotalStackCountOfDef(IngestibleSource.def) < job.takeExtraIngestibles) { Thing thing = GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForDef(IngestibleSource.def), PathEndMode.Touch, TraverseParms.For(pawn), 12f, (Thing x) => pawn.CanReserve(x, 10, 1) && !x.IsForbidden(pawn) && x.IsSociallyProper(pawn)); if (thing != null) { job.SetTarget(TargetIndex.C, thing); JumpToToil(reserveExtraFoodToCollect); } } }, defaultCompleteMode = ToilCompleteMode.Instant }; yield return(Toils_Jump.Jump(findExtraFoodToCollect)); yield return(reserveExtraFoodToCollect); yield return(Toils_Goto.GotoThing(TargetIndex.C, PathEndMode.Touch)); yield return(Toils_Haul.TakeToInventory(TargetIndex.C, () => job.takeExtraIngestibles - pawn.inventory.innerContainer.TotalStackCountOfDef(IngestibleSource.def))); yield return(findExtraFoodToCollect); } if (!IngestibleSource.def.IsDrug) { yield return(Toils_Ingest.CarryIngestibleToChewSpot(pawn, TargetIndex.A).FailOnDestroyedOrNull(TargetIndex.A)); } yield return(Toils_Ingest.FindAdjacentEatSurface(TargetIndex.B, TargetIndex.A)); }
private IEnumerable <Toil> PrepareToIngestToils_ToolUser(Toil chewToil) { if (this.eatingFromInventory) { yield return(Toils_Misc.TakeItemFromInventoryToCarrier(this.pawn, TargetIndex.A)); } else { yield return(this.ReserveFoodIfWillIngestWholeStack()); Toil gotoToPickup = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A); yield return(Toils_Jump.JumpIf(gotoToPickup, () => this.pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation))); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.A)); yield return(Toils_Jump.Jump(chewToil)); yield return(gotoToPickup); yield return(Toils_Ingest.PickupIngestible(TargetIndex.A, this.pawn)); Toil reserveExtraFoodToCollect = Toils_Reserve.Reserve(TargetIndex.C, 1, -1, null); Toil findExtraFoodToCollect = new Toil(); findExtraFoodToCollect.initAction = delegate() { if (this.pawn.inventory.innerContainer.TotalStackCountOfDef(this.IngestibleSource.def) < this.job.takeExtraIngestibles) { Thing thing = GenClosest.ClosestThingReachable(this.pawn.Position, this.pawn.Map, ThingRequest.ForDef(this.IngestibleSource.def), PathEndMode.Touch, TraverseParms.For(this.pawn, Danger.Deadly, TraverseMode.ByPawn, false), 12f, (Thing x) => this.pawn.CanReserve(x, 1, -1, null, false) && !x.IsForbidden(this.pawn) && x.IsSociallyProper(this.pawn), null, 0, -1, false, RegionType.Set_Passable, false); if (thing != null) { this.job.SetTarget(TargetIndex.C, thing); this.JumpToToil(reserveExtraFoodToCollect); } } }; findExtraFoodToCollect.defaultCompleteMode = ToilCompleteMode.Instant; yield return(Toils_Jump.Jump(findExtraFoodToCollect)); yield return(reserveExtraFoodToCollect); yield return(Toils_Goto.GotoThing(TargetIndex.C, PathEndMode.Touch)); yield return(Toils_Haul.TakeToInventory(TargetIndex.C, () => this.job.takeExtraIngestibles - this.pawn.inventory.innerContainer.TotalStackCountOfDef(this.IngestibleSource.def))); yield return(findExtraFoodToCollect); } yield return(Toils_Ingest.CarryIngestibleToChewSpot(this.pawn, TargetIndex.A).FailOnDestroyedOrNull(TargetIndex.A)); yield return(Toils_Ingest.FindAdjacentEatSurface(TargetIndex.B, TargetIndex.A)); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedOrNull(TargetIndex.B); if (eatingFromInventory) { yield return(Toils_Misc.TakeItemFromInventoryToCarrier(pawn, TargetIndex.A)); } else if (usingNutrientPasteDispenser) { yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnForbidden(TargetIndex.A)); yield return(Toils_Ingest.TakeMealFromDispenser(TargetIndex.A, pawn)); } else { yield return(Toils_Ingest.ReserveFoodFromStackForIngesting(TargetIndex.A, Deliveree)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnForbidden(TargetIndex.A)); yield return(Toils_Ingest.PickupIngestible(TargetIndex.A, Deliveree)); } Toil toil = new Toil(); toil.initAction = delegate { Pawn actor = toil.actor; Job curJob = actor.jobs.curJob; actor.pather.StartPath(curJob.targetC, PathEndMode.OnCell); }; toil.defaultCompleteMode = ToilCompleteMode.PatherArrival; toil.FailOnDestroyedNullOrForbidden(TargetIndex.B); toil.AddFailCondition(delegate { Pawn pawn = (Pawn)toil.actor.jobs.curJob.targetB.Thing; if (!pawn.IsPrisonerOfColony) { return(true); } return((!pawn.guest.CanBeBroughtFood) ? true : false); }); yield return(toil); Toil toil2 = new Toil(); toil2.initAction = delegate { pawn.carryTracker.TryDropCarriedThing(toil2.actor.jobs.curJob.targetC.Cell, ThingPlaceMode.Direct, out Thing _); }; toil2.defaultCompleteMode = ToilCompleteMode.Instant; yield return(toil2); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; Toil toil; switch (num) { case 0u: this.FailOnDespawnedOrNull(TargetIndex.B); if (this.eatingFromInventory) { this.$current = Toils_Misc.TakeItemFromInventoryToCarrier(this.pawn, TargetIndex.A); if (!this.$disposing) { this.$PC = 1; } return(true); } if (this.usingNutrientPasteDispenser) { this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnForbidden(TargetIndex.A); if (!this.$disposing) { this.$PC = 2; } return(true); } this.$current = Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null); 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_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnForbidden(TargetIndex.A); if (!this.$disposing) { this.$PC = 5; } return(true); case 5u: this.$current = Toils_Ingest.PickupIngestible(TargetIndex.A, base.Deliveree); if (!this.$disposing) { this.$PC = 6; } return(true); case 6u: break; case 7u: { Toil toil = new Toil(); toil.initAction = delegate() { Thing thing; this.pawn.carryTracker.TryDropCarriedThing(toil.actor.jobs.curJob.targetC.Cell, ThingPlaceMode.Direct, out thing, null); }; toil.defaultCompleteMode = ToilCompleteMode.Instant; this.$current = toil; if (!this.$disposing) { this.$PC = 8; } return(true); } case 8u: this.$PC = -1; return(false); default: return(false); } toil = new Toil(); toil.initAction = delegate() { Pawn actor = toil.actor; Job curJob = actor.jobs.curJob; actor.pather.StartPath(curJob.targetC, PathEndMode.OnCell); }; toil.defaultCompleteMode = ToilCompleteMode.PatherArrival; toil.FailOnDestroyedNullOrForbidden(TargetIndex.B); toil.AddFailCondition(delegate { Pawn pawn = (Pawn)toil.actor.jobs.curJob.targetB.Thing; return(!pawn.IsPrisonerOfColony || !pawn.guest.CanBeBroughtFood); }); this.$current = toil; if (!this.$disposing) { this.$PC = 7; } return(true); }
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); }