blockgame/mods/bg_woodworking/recipes.lua
trans_soup 7df4ddec1c create woodworking mod and refactor.
move plank registration and recipe out of tree mod into newly created
woodworking mod.

also update plank recipe to require cobblestone instead of stone to be
held while pummeling.
2023-10-11 19:05:38 +02:00

21 lines
657 B
Lua

local modname = minetest.get_current_modname()
blockgame.crafting.register_pummel_recipe({
label = "pummel log into plank",
used_item = "core:cobblestone",
target_node = "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,
})