From 78c81f5da6a531bc545d1afd37ffa92513c1e37e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 2 Dec 2024 03:52:09 +0100 Subject: [PATCH] Soup: Add ingredient blacklist --- src/cooking.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/cooking.lua b/src/cooking.lua index ed370a3..3e25a3a 100644 --- a/src/cooking.lua +++ b/src/cooking.lua @@ -24,13 +24,28 @@ local function set_infotext(meta, node) end end --- Add more ingredients here that make a soup. +-- HACKY list of soup ingredients. +-- The cauldron will check if any of these strings are contained in the itemname +-- after the ":". local ingredients_list = { "apple", "mushroom", "honey", "pumpkin", "egg", "bread", "meat", "chicken", "carrot", "potato", "melon", "rhubarb", "cucumber", "corn", "beans", "berries", "grapes", "tomato", "wheat" } +-- List of items that can never be soup ingredients. Overwrites anything else. +local non_ingredients = { + -- xdecor + "xdecor:bowl_soup", + -- Minetest Game: default + "default:apple_mark", "default:blueberry_bush_leaves_with_berries", + -- Minetest Game: farming + "farming:seed_wheat", + "farming:wheat_1", "farming:wheat_2", "farming:wheat_3", "farming:wheat_4", + "farming:wheat_5", "farming:wheat_6", "farming:wheat_7", "farming:wheat_8", +} +local non_ingredients_keyed = table.key_value_swap(non_ingredients) + cauldron.cbox = { {0, 0, 0, 16, 16, 0}, {0, 0, 16, 16, 16, 0}, @@ -169,6 +184,9 @@ end -- Checks if the given item can be used as ingredient for the soup local function is_ingredient(itemstring) + if non_ingredients_keyed[itemstring] then + return false + end local basename = itemstring:match(":([%w_]+)") if not basename then return false