diff --git a/default.lua b/default.lua index b941fd7..d787590 100644 --- a/default.lua +++ b/default.lua @@ -9,4 +9,4 @@ stripped_tree.register_strippable_trunk("default:pine_tree", "default:pine_wood" -- Register axes local axe_types = {"axe_wood", "axe_stone", "axe_bronze", "axe_steel", "axe_mese", "axe_diamond"} -if stripped_tree.axes_strip_trees then stripped_tree.register_axes(mod_name, axe_types) end +stripped_tree.register_axes(mod_name, axe_types) diff --git a/ethereal.lua b/ethereal.lua index 0dcf8dc..ceb6781 100644 --- a/ethereal.lua +++ b/ethereal.lua @@ -13,4 +13,4 @@ stripped_tree.register_strippable_trunk("ethereal:palm_trunk", "ethereal:palm_wo -- Register axes local axe_types = {"axe_crystal"} -if stripped_tree.axes_strip_trees then stripped_tree.register_axes(mod_name, axe_types) end +stripped_tree.register_axes(mod_name, axe_types) diff --git a/functions.lua b/functions.lua index a4d3593..bb51613 100644 --- a/functions.lua +++ b/functions.lua @@ -95,21 +95,21 @@ function stripped_tree.maybe_strip_trunk(pos, player, tool, wear) end -- Function to override axes -if stripped_tree.axes_strip_trees then - function stripped_tree.register_axes(mod_n, axe_types) - for _, axe_name in ipairs(axe_types) do - core.override_item( - mod_n .. ":" .. axe_name, { - on_place = function(itemstack, user, pointed_thing) - if pointed_thing.type ~= "node" then return end +function stripped_tree.register_axes(mod_n, axe_types) + if stripped_tree.axes_strip_trees ~= true then return end - local pos = pointed_thing.under + for _, axe_name in ipairs(axe_types) do + core.override_item( + mod_n .. ":" .. axe_name, { + on_place = function(itemstack, user, pointed_thing) + if pointed_thing.type ~= "node" then return end - -- TODO: Add wear to the axe, but it should depend on the material maybe? - stripped_tree.maybe_strip_trunk(pos, user, itemstack) - end, - } - ) - end + local pos = pointed_thing.under + + -- TODO: Add wear to the axe, but it should depend on the material maybe? + stripped_tree.maybe_strip_trunk(pos, user, itemstack) + end, + } + ) end end diff --git a/moreores.lua b/moreores.lua index 4ae1870..4b52e76 100644 --- a/moreores.lua +++ b/moreores.lua @@ -1,4 +1,4 @@ -- Register axes local axe_types = {"axe_mithril", "axe_silver"} -if stripped_tree.axes_strip_trees then stripped_tree.register_axes("moreores", axe_types) end +stripped_tree.register_axes("moreores", axe_types)