blockgame/mods/bg_stoneworking/recipe.lua
2023-10-17 15:05:40 +02:00

32 lines
982 B
Lua

local modname = minetest.get_current_modname()
local function is_stoney_below (pos)
local below_node = minetest.get_node(pos + blockgame.vector.dirs.down)
return blockgame.item_matches(below_node.name, {"group:stoney"})
end
blockgame.crafting.register_pummel_recipe({
name = modname .. ":craft_tile",
label = "pummel stone into tile",
used = {"group:stoney"},
target = {"bg_terrain:cobblestone"},
check = function (pos, used_node, target_node)
return is_stoney_below(pos)
end,
on_success = function (pos, used_node, target_node)
minetest.set_node(pos, {name = modname .. ":tile"})
end,
})
blockgame.crafting.register_pummel_recipe({
name = modname .. ":craft_bricks",
label = "pummel tile into bricks",
used = {"group:stoney"},
target = {modname .. ":tile"},
check = function (pos, used_node, target_node)
return is_stoney_below(pos)
end,
on_success = function (pos, used_node, target_node)
minetest.set_node(pos, {name = modname .. ":bricks"})
end,
})