public override bool Matches(Thing t) { if (!t.def.IsIngestible) { return(false); } CompIngredients ingredients = t.TryGetComp <CompIngredients>(); if (ingredients != null) { foreach (var ingredient in ingredients.ingredients) { CompProperties_FoodGroup foodGroup = ingredient.GetCompProperties <CompProperties_FoodGroup>(); if (foodGroup != null) { return(foodGroup.foodGroup == FoodGroup.Fruit); } } } else { CompProperties_FoodGroup foodGroup = t.def.GetCompProperties <CompProperties_FoodGroup>(); if (foodGroup != null) { return(foodGroup.foodGroup == FoodGroup.Fruit); } } return(false); }
public override bool AlwaysMatches(ThingDef def) { CompProperties_FoodGroup foodGroup = def.GetCompProperties <CompProperties_FoodGroup>(); if (foodGroup != null) { return(foodGroup.foodGroup == FoodGroup.Fruit); } return(false); }