X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=init.lua;h=6509446404bbb74fa88deab44a302dd7de646bcd;hb=5e4704ad2afea8c1b4cb70ddaceb0c8844866a20;hp=293a02762b8188649be0a06735f43646a92347cb;hpb=720cdff72ce39d5511854d5b942a05dd3c6a201c;p=xdecor.git diff --git a/init.lua b/init.lua index 293a027..6509446 100644 --- a/init.lua +++ b/init.lua @@ -1,22 +1,47 @@ --local t = os.clock() + +local mver_major, mver_minor, mver_patch = 0, 4, 16 -- Minetest 0.4.16 minimum. + +local client_version = minetest.get_version().string +local major, minor, patch = client_version:match("(%d+).(%d+).(%d+)") + +if (major and minor and patch) and + ((tonumber(major) < mver_major) or + (mver_major == tonumber(major) and tonumber(minor) < mver_minor) or + (mver_minor == tonumber(minor) and tonumber(patch) < mver_patch)) then + minetest.log("error", "[xdecor] Your Minetest client is too old to run this mod. Disabling.") + return +end + xdecor = {} local modpath = minetest.get_modpath("xdecor") +dofile(modpath.."/handlers/animations.lua") dofile(modpath.."/handlers/helpers.lua") dofile(modpath.."/handlers/nodeboxes.lua") dofile(modpath.."/handlers/registration.lua") -dofile(modpath.."/chess.lua") -dofile(modpath.."/cooking.lua") -dofile(modpath.."/craftitems.lua") -dofile(modpath.."/enchanting.lua") -dofile(modpath.."/hive.lua") -dofile(modpath.."/itemframe.lua") -dofile(modpath.."/mailbox.lua") -dofile(modpath.."/nodes.lua") -dofile(modpath.."/recipes.lua") -dofile(modpath.."/rope.lua") -dofile(modpath.."/sitting.lua") -dofile(modpath.."/worktable.lua") -dofile(modpath.."/xwall.lua") ---print(string.format("xdecor loaded in %.2f ms", (os.clock()-t)*1000)) +dofile(modpath.."/src/alias.lua") +dofile(modpath.."/src/nodes.lua") +dofile(modpath.."/src/recipes.lua") + +local subpart = { + "chess", + "cooking", + "enchanting", + "hive", + "itemframe", + "mailbox", + "mechanisms", + "rope", + "workbench" +} + +for _, name in pairs(subpart) do + local enable = minetest.settings:get_bool("enable_xdecor_"..name) + if enable or enable == nil then + dofile(modpath.."/src/"..name..".lua") + end +end + +--print(string.format("[xdecor] loaded in %.2f ms", (os.clock()-t)*1000))