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:
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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, {
|
||||||
@@ -111,5 +112,4 @@ if stripped_tree.axes_strip_trees then
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user