Exemplo n.º 1
0
        public static bool CanRefill(Pawn pawn, Thing t, bool forced = false)
        {
            CompRefillable compRefill = t.TryGetComp <CompRefillable>();

            if (compRefill is null || compRefill.IsFull())
            {
                return(false);
            }
            bool flag = !forced;

            if (flag && !compRefill.ShouldAutoRefill)
            {
                return(false);
            }
            if (!t.IsForbidden(pawn))
            {
                LocalTargetInfo target = t;
                if (pawn.CanReserve(target, 1, -1, null, forced))
                {
                    if (t.Faction != pawn.Faction)
                    {
                        return(false);
                    }
                    if (RefillWorkGiverUtility.FindNextFuelItem(pawn, t) is null)
                    {
                        JobFailReason.Is("No items available to refill", null);
                        return(false);
                    }
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        public static Job RefillJob(Pawn pawn, Thing t, bool forced = false)
        {
            Thing t2 = RefillWorkGiverUtility.FindNextFuelItem(pawn, t);

            return(new Job(JobDefOfCuisine.Refill, t, t2));
        }