public override Job JobOnThing(Pawn pawn, Thing thing, bool forced = false) { IBillGiver billGiver = thing as IBillGiver; if (billGiver != null && ThingIsUsableBillGiver(thing) && billGiver.BillStack.AnyShouldDoNow && billGiver.UsableForBillsAfterFueling()) { LocalTargetInfo target = thing; bool ignoreOtherReservations = forced; if (pawn.CanReserve(target, 1, -1, null, ignoreOtherReservations) && !thing.IsBurning() && !thing.IsForbidden(pawn)) { CompRefuelable compRefuelable = thing.TryGetComp <CompRefuelable>(); if (compRefuelable != null && !compRefuelable.HasFuel) { if (!RefuelWorkGiverUtility.CanRefuel(pawn, thing, forced)) { return(null); } return(RefuelWorkGiverUtility.RefuelJob(pawn, thing, forced)); } billGiver.BillStack.RemoveIncompletableBills(); return(StartOrResumeBillJob(pawn, billGiver)); } } return(null); }
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false) { if (CanRefuelThing(t)) { return(RefuelWorkGiverUtility.CanRefuel(pawn, t, forced)); } return(false); }
public override Job JobOnThing(Pawn pawn, Thing thing, bool forced = false) { IBillGiver billGiver = thing as IBillGiver; if (billGiver == null || !ThingIsUsableBillGiver(thing) || !billGiver.BillStack.AnyShouldDoNow || !billGiver.UsableForBillsAfterFueling() || !pawn.CanReserve(thing, 1, -1, null, forced) || thing.IsBurning() || thing.IsForbidden(pawn)) { return(null); } CompRefuelable compRefuelable = thing.TryGetComp <CompRefuelable>(); if (compRefuelable != null && !compRefuelable.HasFuel) { if (!RefuelWorkGiverUtility.CanRefuel(pawn, thing, forced)) { return(null); } return(RefuelWorkGiverUtility.RefuelJob(pawn, thing, forced)); } billGiver.BillStack.RemoveIncompletableBills(); return(StartOrResumeBillJob(pawn, billGiver)); }