blockgame/mods/bg_woodworking/recipe.lua
trans_soup c31d6cf5d0 improve pummeling.
pummeling definition tables now has lists of item id:s and groups, the
same way e.g. ABM:s do, that determine what items are involved in a
recipe.

update existing (in-use) pummel recipes to make use of this.
2023-10-17 14:53:08 +02:00

22 lines
680 B
Lua

local modname = minetest.get_current_modname()
blockgame.crafting.register_pummel_recipe({
name = modname .. ":chop_log",
label = "chop log into plank",
used = {"group:stoney"},
target = {"bg_tree:log"},
check = function (pos, used_node, target_node)
for _, side in pairs(blockgame.vector.sides) do
local output_pos = pos + side
if minetest.get_node(output_pos).name ~= "air" then return false end
end
return true
end,
on_success = function (pos, used_node, target_node)
minetest.remove_node(pos)
for _, side in pairs(blockgame.vector.sides) do
local output_pos = pos + side
minetest.set_node(output_pos, {name = modname .. ":plank"})
end
end,
})