blockgame/mods/bg_stoneworking/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

31 lines
1.1 KiB
Lua

local modname = minetest.get_current_modname()
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)
local below_node = minetest.get_node(pos + blockgame.vector.dirs.down)
local stoney_value = minetest.get_item_group(below_node.name, "stoney")
return stoney_value ~= 0 and stoney_value ~= nil
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)
local below_node = minetest.get_node(pos + blockgame.vector.dirs.down)
local stoney_value = minetest.get_item_group(below_node.name, "stoney")
return stoney_value ~= 0 and stoney_value ~= nil
end,
on_success = function (pos, used_node, target_node)
minetest.set_node(pos, {name = modname .. ":bricks"})
end,
})