protected override Job TryGiveJob(Pawn pawn) { int transportersGroup = pawn.mindState.duty.transportersGroup; TransporterUtility.GetTransportersInGroup(transportersGroup, pawn.Map, tmpTransporters); for (int i = 0; i < tmpTransporters.Count; i++) { CompTransporter transporter = tmpTransporters[i]; if (BillyLoadTransporterUtility.HasJobOnTransporter(pawn, transporter)) { return(BillyLoadTransporterUtility.JobOnTransporter(pawn, transporter)); } } return(null); }
protected Toil DetermineNumToHaul() { return(new Toil { initAction = delegate { int num = BillyLoadTransporterUtility.CountLeftToTransfer(this.pawn, this.Transferable, this.Transporter.TryGetComp <CompTransporter>()); if (this.pawn.carryTracker.CarriedThing != null) { num -= this.pawn.carryTracker.CarriedThing.stackCount; } if (num <= 0) { this.pawn.jobs.EndCurrentJob(JobCondition.Succeeded, true); } else { job.count = num; } }, defaultCompleteMode = ToilCompleteMode.Instant, atomicWithPrevious = true }); }
public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { CompTransporter transporter = t.TryGetComp <CompTransporter>(); return(BillyLoadTransporterUtility.JobOnTransporter(pawn, transporter)); }