diff --git a/Source/CombatExtended/CombatExtended/Jobs/JobGiver_UpdateLoadout.cs b/Source/CombatExtended/CombatExtended/Jobs/JobGiver_UpdateLoadout.cs index 1b2ac52a4b..de8db31d47 100644 --- a/Source/CombatExtended/CombatExtended/Jobs/JobGiver_UpdateLoadout.cs +++ b/Source/CombatExtended/CombatExtended/Jobs/JobGiver_UpdateLoadout.cs @@ -215,7 +215,7 @@ private static void FindPickup(Pawn pawn, LoadoutSlot curSlot, int findCount, ou { findItem = t => t.GetInnerIfMinified().def == curSlot.thingDef; } - Predicate search = t => findItem(t) && !t.IsForbidden(pawn) && pawn.CanReserve(t, 10, 1) && !isFoodInPrison(t) && AllowedByBiocode(t, pawn); + Predicate search = t => findItem(t) && !t.IsForbidden(pawn) && pawn.CanReserve(t, 10, 1) && !isFoodInPrison(t) && AllowedByBiocode(t, pawn) && AllowedByFoodRestriction(t, pawn); // look for a thing near the pawn. curThing = GenClosest.ClosestThingReachable( @@ -278,6 +278,18 @@ private static bool AllowedByBiocode(Thing thing, Pawn pawn) return (compBiocoded == null || !compBiocoded.Biocoded || compBiocoded.CodedPawn == pawn); } + private static bool AllowedByFoodRestriction(Thing thing, Pawn pawn) + { + if (thing != null && thing.def.IsNutritionGivingIngestible) + { + return pawn.foodRestriction.GetCurrentRespectedRestriction(pawn).Allows(thing); + } + else + { + return true; + } + } + /// /// Tries to give the pawn a job related to picking up or dropping an item from their inventory. ///