mirror of
https://github.com/minefaco/stripped_tree.git
synced 2024-08-20 04:54:08 +02:00
commit
882e5f08d4
17
init.lua
17
init.lua
@ -22,12 +22,12 @@ for _, name in ipairs(trunk_names) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Register tree bark
|
--Register tree bark
|
||||||
|
|
||||||
minetest.register_craftitem(":default:tree_bark", {
|
minetest.register_craftitem(":default:tree_bark", {
|
||||||
description = "Tree bark",
|
description = "Tree bark",
|
||||||
inventory_image = "tree_bark.png",
|
inventory_image = "tree_bark.png",
|
||||||
groups = {not_in_creative_inventory = 1}
|
groups = {not_in_creative_inventory = 1}
|
||||||
})
|
})
|
||||||
|
--register bark as fuel
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:tree_bark",
|
recipe = "default:tree_bark",
|
||||||
@ -40,7 +40,6 @@ local axe_types = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, axe_name in ipairs(axe_types) do
|
for _, axe_name in ipairs(axe_types) do
|
||||||
|
|
||||||
minetest.override_item("default:axe_" .. axe_name, {
|
minetest.override_item("default:axe_" .. axe_name, {
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
on_place = function(itemstack, user, pointed_thing)
|
||||||
|
|
||||||
@ -66,14 +65,16 @@ for _, axe_name in ipairs(axe_types) do
|
|||||||
minetest.swap_node(pos, {name = "default:stripped_"..n, param2 = old_node.param2})
|
minetest.swap_node(pos, {name = "default:stripped_"..n, param2 = old_node.param2})
|
||||||
itemstack:add_wear(65535 / 299) -- 300 uses
|
itemstack:add_wear(65535 / 299) -- 300 uses
|
||||||
|
|
||||||
if not creative_mode then
|
if not creative_mode then
|
||||||
local inv = user:get_inventory()
|
local inv = user:get_inventory()
|
||||||
if inv:room_for_item("main", "default:tree_bark") then
|
--check for room in inv, if not, drop item
|
||||||
inv:add_item("main", {name="default:tree_bark"})
|
if inv:room_for_item("main", "default:tree_bark") then
|
||||||
else
|
inv:add_item("main", {name="default:tree_bark"})
|
||||||
minetest.add_item(pos, "default:tree_bark")
|
else
|
||||||
end
|
minetest.add_item(pos, "default:tree_bark")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user