+-- Add more ingredients here that make a soup.
+local ingredients_list = {
+ "apple", "mushroom", "honey", "pumpkin", "egg", "bread", "meat",
+ "chicken", "carrot", "potato"
+}
+
local cauldron_cbox = {
{0, 0, 0, 16, 16, 0},
{0, 0, 16, 16, 16, 0},
if not objs then return end
local ingredients = {}
- local ingredients_list = { -- Add more ingredients here that make a soup.
- "apple", "mushroom", "honey", "pumpkin", "egg", "bread",
- "meat", "chicken", "carrot", "potato"
- }
-
for _, obj in pairs(objs) do
if obj and obj:get_luaentity() then
local itemstring = obj:get_luaentity().itemstring:match(":([%w_]+)")
end
for _, ing in pairs(ingredients_list) do
- if itemstring and itemstring:match(ing) then
+ if itemstring and itemstring:find(ing) then
ingredients[#ingredients+1] = itemstring
end
end
for k, v in pairs({"axe, pick, shovel",
"chestplate, leggings, helmet",
"sword", "boots"}) do
- if v:match(stack:get_name():match(":(.-)%_")) then
+ if v:find(stack:get_name():match(":(%w+)")) then
enchanting.formspec(pos, k)
end
end
local function allowed(tool)
for item in pairs(minetest.registered_tools) do
- if item:match("enchanted_"..tool) then return true end
+ if item:find("enchanted_"..tool) then return true end
end
return false
end
return inv:is_empty("mailbox") and player and player_name == owner
end,
on_metadata_inventory_put = function(pos, listname, _, stack, player)
- local inv = minetest.get_meta(pos):get_inventory()
- local player_name = player:get_player_name()
local meta = minetest.get_meta(pos)
- local stack_name = stack:get_name().." "..stack:get_count()
+ local inv = meta:get_inventory()
if listname == "drop" and inv:room_for_item("mailbox", stack) then
inv:remove_item("drop", stack)
meta:set_string("giver"..i, meta:get_string("giver"..(i-1)))
meta:set_string("stack"..i, meta:get_string("stack"..(i-1)))
end
- meta:set_string("giver1", player_name)
- meta:set_string("stack1", stack_name)
+
+ meta:set_string("giver1", player:get_player_name())
+ meta:set_string("stack1", stack:get_name().." "..stack:get_count())
end
end,
allow_metadata_inventory_put = function(pos, listname, _, stack, player)
- local player_name = player:get_player_name()
if listname == "drop" then
- local meta = minetest.get_meta(pos)
- local inv = meta:get_inventory()
+ local inv = minetest.get_meta(pos):get_inventory()
if inv:room_for_item("mailbox", stack) then
return -1
else
- minetest.chat_send_player(player_name, "The mailbox is full")
+ minetest.chat_send_player(player:get_player_name(), "The mailbox is full")
end
end
-
return 0
end
})
worktable.craftguide_formspec(meta, pagenum, nil, 1, filter, tab_id)
else
for item in pairs(fields) do
- if item:match(".-:") and minetest.get_craft_recipe(item).items then
+ if item:find(":") and minetest.get_craft_recipe(item).items then
worktable.craftguide_formspec(meta, pagenum, item, 1, filter, tab_id)
end
end