init.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --local t = os.clock()
  2. local mver_major, mver_minor, mver_patch = 0, 4, 16 -- Minetest 0.4.16 minimum.
  3. local client_version = minetest.get_version().string
  4. local major, minor, patch = client_version:match("(%d+).(%d+).(%d+)")
  5. if (major and minor and patch) and
  6. ((tonumber(major) < mver_major) or
  7. (mver_major == tonumber(major) and tonumber(minor) < mver_minor) or
  8. (mver_minor == tonumber(minor) and tonumber(patch) < mver_patch)) then
  9. minetest.log("error", "[xdecor] Your Minetest client is too old to run this mod. Disabling.")
  10. return
  11. end
  12. xdecor = {}
  13. local modpath = minetest.get_modpath("xdecor")
  14. dofile(modpath.."/handlers/animations.lua")
  15. dofile(modpath.."/handlers/helpers.lua")
  16. dofile(modpath.."/handlers/nodeboxes.lua")
  17. dofile(modpath.."/handlers/registration.lua")
  18. dofile(modpath.."/src/alias.lua")
  19. dofile(modpath.."/src/nodes.lua")
  20. dofile(modpath.."/src/recipes.lua")
  21. local subpart = {
  22. "chess",
  23. "cooking",
  24. "enchanting",
  25. "hive",
  26. "mechanisms",
  27. "rope",
  28. "workbench"
  29. }
  30. for _, name in pairs(subpart) do
  31. local enable = minetest.settings:get_bool("enable_xdecor_"..name)
  32. if enable or enable == nil then
  33. dofile(modpath.."/src/"..name..".lua")
  34. end
  35. end
  36. --print(string.format("[xdecor] loaded in %.2f ms", (os.clock()-t)*1000))