init.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --- Modgen import mod
  2. -- writes the mapblocks back to the world
  3. -- hard-dependency- and global-free
  4. -- mod name and path
  5. local modname = minetest.get_current_modname()
  6. local MP = minetest.get_modpath(modname)
  7. local import_mod = {
  8. -- storage
  9. storage = minetest.get_mod_storage()
  10. }
  11. -- local functions/helpers
  12. loadfile(MP .. "/decode.lua")(import_mod)
  13. loadfile(MP .. "/util.lua")(import_mod)
  14. loadfile(MP .. "/load_chunk.lua")(import_mod)
  15. loadfile(MP .. "/register_mapgen.lua")(import_mod)
  16. loadfile(MP .. "/read_manifest.lua")(import_mod)
  17. loadfile(MP .. "/nodename_check.lua")(import_mod)
  18. loadfile(MP .. "/uid_check.lua")(import_mod)
  19. loadfile(MP .. "/localize_nodeids.lua")(import_mod)
  20. loadfile(MP .. "/deserialize.lua")(import_mod)
  21. local manifest = import_mod.read_manifest()
  22. -- check world uid
  23. import_mod.uid_check(manifest)
  24. -- check if the nodes are available in the current world
  25. minetest.register_on_mods_loaded(function()
  26. import_mod.nodename_check(manifest)
  27. end)
  28. -- initialize mapgen
  29. import_mod.register_mapgen(manifest)
  30. if minetest.get_modpath("modgen") then
  31. -- modgen available, make it aware of the loaded import_mod
  32. modgen.register_import_mod(manifest, MP)
  33. end
  34. -- check if the auto-update feature is enabled
  35. if minetest.settings:get_bool("import_mod.auto_update.enabled") then
  36. loadfile(MP .. "/auto_update.lua")(import_mod)
  37. end