public static void JobOnThingRefill(Pawn pawn, Thing thing, ref Job __result, WorkGiver_DoBill __instance, bool forced = false) { if (__result is null) { IBillGiver billGiver = thing as IBillGiver; if (!(billGiver is null) && __instance.ThingIsUsableBillGiver(thing) && billGiver.BillStack.AnyShouldDoNow && billGiver.UsableForBillsAfterFueling()) { LocalTargetInfo target = thing; if (pawn.CanReserve(target, 1, -1, null, forced) && !thing.IsBurning() && !thing.IsForbidden(pawn)) { CompRefillable compRefillable = thing.TryGetComp <CompRefillable>(); if (compRefillable is null || compRefillable.IsFull()) { billGiver.BillStack.RemoveIncompletableBills(); __result = (Job)AccessTools.Method(type: typeof(WorkGiver_DoBill), name: "StartOrResumeBillJob").Invoke(__instance, new object[] { pawn, billGiver }); return; } if (!RefillWorkGiverUtility.CanRefill(pawn, thing, forced)) { __result = null; return; } __result = RefillWorkGiverUtility.RefillJob(pawn, thing, forced); } } return; } }
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false) { return(RefillWorkGiverUtility.CanRefill(pawn, t, forced)); }