mtinfo/textures.lua

27 lines
798 B
Lua
Raw Normal View History

2020-01-06 13:31:18 +01:00
local count = 0
2020-02-20 12:37:23 +01:00
local size = 0
2021-02-10 07:54:51 +01:00
function mtinfo.export_textures()
for _, modname in ipairs(minetest.get_modnames()) do
local modpath = minetest.get_modpath(modname)
local destination_path = mtinfo.basepath .. "/textures"
minetest.mkdir(destination_path)
if modpath then
local texturepath = modpath .. "/textures"
local dir_list = minetest.get_dir_list(texturepath)
for _, filename in pairs(dir_list) do
count = count + 1
size = size + mtinfo.copyfile(texturepath .. "/" .. filename, destination_path .. "/" .. filename)
end
end
end
print("[mtinfo] exported " .. count .. " textures (" .. size .. " bytes)")
local data = {
count = count,
size = size
}
mtinfo.export_json(mtinfo.basepath.."/data/textures.js", data, "mtinfo.textures")
2020-01-06 13:31:18 +01:00
end