Support moretrees added!

This commit is contained in:
minefaco 2020-11-09 09:10:05 -05:00 committed by GitHub
parent 7ec025b04c
commit 8b332e61e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -41,36 +41,33 @@ function chisel_tree.register_axes(mod_name,axe_types)
end end
local node = minetest.get_node(pos).name local node = minetest.get_node(pos).name
local mod_name, node_name = unpack(node:split(":"))
local has_stripped = minetest.registered_nodes[mod_name..":".."stripped_"..node_name]
for _, n in ipairs(trunk_names) do
local tree = mod_name..":"..n if has_stripped then
if tree==node then local old_node = minetest.get_node(pos)
local old_node = minetest.get_node(pos) minetest.swap_node(pos, {name = mod_name..":".."stripped_"..node_name, param2 = old_node.param2})
minetest.swap_node(pos, {name = mod_name..":".."stripped_"..n, param2 = old_node.param2}) itemstack:add_wear(65535 / 299) -- 300 uses
itemstack:add_wear(65535 / 299) -- 300 uses minetest.chat_send_all(mod_name)
minetest.chat_send_all(node_name)
if not creative_mode then if not creative_mode then
local inv = user:get_inventory() local inv = user:get_inventory()
--check for room in inv, if not, drop item --check for room in inv, if not, drop item
if inv:room_for_item("main", "default:tree_bark") then if inv:room_for_item("main", "default:tree_bark") then
inv:add_item("main", {name="default:tree_bark"}) inv:add_item("main", {name="default:tree_bark"})
else else
minetest.add_item(pos, "default:tree_bark") minetest.add_item(pos, "default:tree_bark")
end end
end
return itemstack
end end
return itemstack
end
end
end, end,
}) })
end end
end end
--register alias to support old tool --register alias to support old tool
minetest.register_alias("chisel_tree:chisel", "default:axe_steel") minetest.register_alias("chisel_tree:chisel", "default:axe_steel")