Make the register_axes function always available

It’s still a no-op if the required setting is disabled, but it removes some strain from the Lua interpreter by being
unconditionally available.
This commit is contained in:
2025-12-09 14:49:03 +01:00
parent 8a2d735aa6
commit a4f537f625
4 changed files with 17 additions and 17 deletions

View File

@@ -9,4 +9,4 @@ stripped_tree.register_strippable_trunk("default:pine_tree", "default:pine_wood"
-- Register axes -- Register axes
local axe_types = {"axe_wood", "axe_stone", "axe_bronze", "axe_steel", "axe_mese", "axe_diamond"} 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)

View File

@@ -13,4 +13,4 @@ stripped_tree.register_strippable_trunk("ethereal:palm_trunk", "ethereal:palm_wo
-- Register axes -- Register axes
local axe_types = {"axe_crystal"} 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)

View File

@@ -95,8 +95,9 @@ function stripped_tree.maybe_strip_trunk(pos, player, tool, wear)
end end
-- Function to override axes -- Function to override axes
if stripped_tree.axes_strip_trees then
function stripped_tree.register_axes(mod_n, axe_types) function stripped_tree.register_axes(mod_n, axe_types)
if stripped_tree.axes_strip_trees ~= true then return end
for _, axe_name in ipairs(axe_types) do for _, axe_name in ipairs(axe_types) do
core.override_item( core.override_item(
mod_n .. ":" .. axe_name, { mod_n .. ":" .. axe_name, {
@@ -112,4 +113,3 @@ if stripped_tree.axes_strip_trees then
) )
end end
end end
end

View File

@@ -1,4 +1,4 @@
-- Register axes -- Register axes
local axe_types = {"axe_mithril", "axe_silver"} 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)