update recipes.

add recipe for planting nuts with dirt.

change plank recipe into pummeling log with stone.

add (currently unusable) recipe to pummel leaves into dirt.
This commit is contained in:
trans_soup 2023-10-11 12:04:16 +02:00
parent 6d3412bba6
commit 2ed91bbcc3

View file

@ -1,4 +1,36 @@
local modname = minetest.get_current_modname() local modname = minetest.get_current_modname()
-- plant saplings
-- TODO: when recipes add support for groups, use `dirty` group here instead of specific nodes.
blockgame.crafting.register_stack_recipe("core:grass", modname .. ":nut", {name = modname .. ":sapling"}) blockgame.crafting.register_stack_recipe("core:grass", modname .. ":nut", {name = modname .. ":sapling"})
blockgame.crafting.register_stack_recipe(modname .. ":log", modname .. ":nut", {name = modname .. ":plank"}) blockgame.crafting.register_stack_recipe("core:dirt", modname .. ":nut", {name = modname .. ":sapling"})
-- NOTE: is currently useless, as there's no way to obtain leaves.
blockgame.crafting.register_pummel_recipe({
label = "pummel leaves into dirt",
used_item = modname .. ":leaves",
target_node = modname .. ":leaves",
on_success = function (pos, used_node, target_node)
minetest.set_node(pos, {name = "core:dirt"})
end,
})
blockgame.crafting.register_pummel_recipe({
label = "pummel log into plank",
used_item = "core:stone",
target_node = modname .. ":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,
})