示例#1
0
 public static bool WillEat(this Pawn p, ThingDef food, Pawn getter = null)
 {
     if (!p.RaceProps.CanEverEat(food))
     {
         return(false);
     }
     if (p.foodRestriction != null)
     {
         FoodRestriction currentRespectedRestriction = p.foodRestriction.GetCurrentRespectedRestriction(getter);
         if (currentRespectedRestriction != null && !currentRespectedRestriction.Allows(food) && food.IsWithinCategory(currentRespectedRestriction.filter.DisplayRootCategory.catDef))
         {
             return(false);
         }
     }
     return(true);
 }
示例#2
0
 public static bool WillEat(this Pawn p, Thing food, Pawn getter = null)
 {
     if (!p.RaceProps.CanEverEat(food))
     {
         return(false);
     }
     if (p.foodRestriction != null)
     {
         FoodRestriction currentRespectedRestriction = p.foodRestriction.GetCurrentRespectedRestriction(getter);
         if (currentRespectedRestriction != null && !currentRespectedRestriction.Allows(food) && (food.def.IsWithinCategory(ThingCategoryDefOf.Foods) || food.def.IsWithinCategory(ThingCategoryDefOf.Corpses)))
         {
             return(false);
         }
     }
     return(true);
 }
示例#3
0
 public static bool WillEat(this Pawn p, ThingDef food, Pawn getter = null, bool careIfNotAcceptableForTitle = true)
 {
     if (!p.RaceProps.CanEverEat(food))
     {
         return(false);
     }
     if (p.foodRestriction != null)
     {
         FoodRestriction currentRespectedRestriction = p.foodRestriction.GetCurrentRespectedRestriction(getter);
         if (currentRespectedRestriction != null && !currentRespectedRestriction.Allows(food) && food.IsWithinCategory(currentRespectedRestriction.filter.DisplayRootCategory.catDef))
         {
             return(false);
         }
     }
     if (careIfNotAcceptableForTitle && InappropriateForTitle(food, p, allowIfStarving: true))
     {
         return(false);
     }
     return(true);
 }
示例#4
0
 public static bool WillEat(this Pawn p, Thing food, Pawn getter = null, bool careIfNotAcceptableForTitle = true)
 {
     if (!p.RaceProps.CanEverEat(food))
     {
         return(false);
     }
     if (p.foodRestriction != null)
     {
         FoodRestriction currentRespectedRestriction = p.foodRestriction.GetCurrentRespectedRestriction(getter);
         if (currentRespectedRestriction != null && !currentRespectedRestriction.Allows(food) && (food.def.IsWithinCategory(ThingCategoryDefOf.Foods) || food.def.IsWithinCategory(ThingCategoryDefOf.Corpses)))
         {
             return(false);
         }
     }
     if (careIfNotAcceptableForTitle && InappropriateForTitle(food.def, p, allowIfStarving: true))
     {
         return(false);
     }
     return(true);
 }