// Token: 0x0600003E RID: 62 RVA: 0x00003F28 File Offset: 0x00002128 public override bool TryMakePreToilReservations(bool errorOnFailed) { bool flag = this.pawn == null || this.Deliveree == null || this.job == null || this.Food == null; bool result; if (flag) { result = false; } else { bool flag2 = !this.pawn.Reserve(this.Deliveree, this.job, 1, -1, null, true); if (flag2) { result = false; } else { bool flag3 = !(base.TargetThingA is Building_NutrientPasteDispenser); if (flag3) { int maxAmountToPickup = FoodUtility.GetMaxAmountToPickup(this.Food, this.pawn, this.job.count); bool flag4 = !this.pawn.Reserve(this.Food, this.job, 1, maxAmountToPickup, null, true); if (flag4) { return(false); } this.job.count = maxAmountToPickup; } bool flag5 = this.pawn.Reserve(this.Deliveree, this.job, 1, -1, null, true); result = flag5; } } return(result); }
private Toil ReserveFood() { return(new Toil { initAction = delegate { if (pawn.Faction != null) { Thing thing = job.GetTarget(TargetIndex.A).Thing; if (pawn.carryTracker.CarriedThing != thing) { int maxAmountToPickup = FoodUtility.GetMaxAmountToPickup(thing, pawn, job.count); if (maxAmountToPickup != 0) { if (!pawn.Reserve(thing, job, 10, maxAmountToPickup)) { Log.Error(string.Concat("Pawn food reservation for ", pawn, " on job ", this, " failed, because it could not register food from ", thing, " - amount: ", maxAmountToPickup)); pawn.jobs.EndCurrentJob(JobCondition.Errored); } job.count = maxAmountToPickup; } } } }, defaultCompleteMode = ToilCompleteMode.Instant, atomicWithPrevious = true }); }
public override bool TryMakePreToilReservations(bool errorOnFailed) { if (pawn.Faction != null && !(IngestibleSource is Building_NutrientPasteDispenser)) { Thing ingestibleSource = IngestibleSource; if (!pawn.Reserve(ingestibleSource, job, 10, FoodUtility.GetMaxAmountToPickup(ingestibleSource, pawn, job.count), null, errorOnFailed)) { return(false); } } return(true); }
public override bool TryMakePreToilReservations(bool errorOnFailed) { if (!pawn.Reserve(Deliveree, job, 1, -1, null, errorOnFailed)) { return(false); } if (!(base.TargetThingA is Building_NutrientPasteDispenser) && (pawn.inventory == null || !pawn.inventory.Contains(base.TargetThingA))) { int maxAmountToPickup = FoodUtility.GetMaxAmountToPickup(Food, pawn, job.count); if (!pawn.Reserve(Food, job, 10, maxAmountToPickup, null, errorOnFailed)) { return(false); } job.count = maxAmountToPickup; } return(true); }