blockgame/mods/bg_woodworking/recipe.lua

23 lines
680 B
Lua
Raw Normal View History

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,
})