Example #1
0
        internal static void DefineItemMiscGroups2(Action <string, string[], Matcher> addDef)
        {
            addDef("Any Food Ingredient",
                   new string[] { "Any Food" },
                   (item, grps) => {
                foreach (int foodId in grps["Any Food"])
                {
                    IEnumerable <Recipe> recipes = RecipeIdentityHelpers.GetRecipesOfItem(foodId);

                    foreach (Recipe recipe in recipes)
                    {
                        for (int i = 0; i < recipe.requiredItem.Length; i++)
                        {
                            Item recipeItem = recipe.requiredItem[i];
                            if (recipeItem == null || recipeItem.IsAir)
                            {
                                break;
                            }

                            if (recipeItem.type == foodId)
                            {
                                return(true);
                            }
                        }
                    }
                }
                return(false);
            });
        }