Fix bad loading of enchanting

This commit is contained in:
Wuzzy 2024-12-02 18:34:23 +01:00
parent d6942aa43b
commit 1923b6acde

View File

@ -12,6 +12,7 @@ dofile(modpath .. "/handlers/registration.lua")
dofile(modpath .. "/src/nodes.lua") dofile(modpath .. "/src/nodes.lua")
dofile(modpath .. "/src/recipes.lua") dofile(modpath .. "/src/recipes.lua")
-- Load modules that can be enabled and disabled by settings
local subpart = { local subpart = {
"chess", "chess",
"cooking", "cooking",
@ -24,16 +25,20 @@ local subpart = {
-- Workbench MUST be loaded after all other subparts that register nodes -- Workbench MUST be loaded after all other subparts that register nodes
-- last for the default 'cut node' registrations to work -- last for the default 'cut node' registrations to work
"workbench", "workbench",
-- Enchanted tools registered last because they depend on previous
-- subparts
"enchanted_tools",
} }
for _, name in ipairs(subpart) do for _, name in ipairs(subpart) do
local enable = minetest.settings:get_bool("enable_xdecor_" .. name) local enable = minetest.settings:get_bool("enable_xdecor_" .. name, true)
if enable or enable == nil then if enable then
dofile(modpath .. "/src/" .. name .. ".lua") dofile(modpath .. "/src/" .. name .. ".lua")
end end
end end
--print(string.format("[xdecor] loaded in %.2f ms", (os.clock()-t)*1000)) -- Special case: enchanted tools. This code is split from enchanting to
-- deal with loading order.
-- Enchanted tools registered last because they depend on previous
-- subparts
local enable_enchanting = minetest.settings:get_bool("enable_xdecor_enchanting", true)
if enable_enchanting then
dofile(modpath .. "/src/enchanted_tools.lua")
end