mtinfo/init.lua
BuckarooBanzay 4691175a30 enhance ui
2021-01-16 21:03:43 +01:00

43 lines
1.2 KiB
Lua

local MP = minetest.get_modpath("mtinfo")
mtinfo = {
basepath = minetest.get_worldpath() .. "/mtinfo"
}
print("[mtinfo] Exporting mtinfo to: " .. mtinfo.basepath)
dofile(MP .. "/common.lua")
dofile(MP .. "/nodes.lua")
dofile(MP .. "/items.lua")
dofile(MP .. "/tools.lua")
dofile(MP .. "/abm.lua")
dofile(MP .. "/lbm.lua")
dofile(MP .. "/recipes.lua")
dofile(MP .. "/textures.lua")
minetest.register_on_mods_loaded(function()
-- workaround for empty translations, defer a globalstep until everything is initialized
minetest.after(0, function()
local start = minetest.get_us_time()
-- export data
mtinfo.export_nodes()
mtinfo.export_lbms()
mtinfo.export_abms()
mtinfo.export_items()
mtinfo.export_recipes()
mtinfo.export_tools()
-- copy static assets
minetest.mkdir(mtinfo.basepath)
minetest.mkdir(mtinfo.basepath .. "/data")
mtinfo.copyrecursive(MP .. "/app/pics", mtinfo.basepath .. "/pics")
mtinfo.copyrecursive(MP .. "/app/js", mtinfo.basepath .. "/js")
mtinfo.copyrecursive(MP .. "/app/css", mtinfo.basepath .. "/css")
mtinfo.copyfile(MP .. "/app/index.html", mtinfo.basepath .. "/index.html")
local diff = minetest.get_us_time() - start
print("[mtinfo] export took " .. diff .. " us")
end)
end)