New function to load mod files

This commit is contained in:
JoseDouglas26 2024-06-07 09:07:17 -03:00
parent b26d4e78a5
commit 0ce870a9de
2 changed files with 18 additions and 3 deletions

View File

@ -18,3 +18,15 @@ end
_G.table.copy = table.copy
_G.table.merge = table.merge
function voxelibre.load_mod_files(modpath)
if not modpath then
return
end
for _, file in pairs(minetest.get_dir_list(modpath, false)) do
if file:sub(-4) == ".lua" and file ~= "init.lua" then
dofile(modpath.."/"..file)
end
end
end

View File

@ -1,4 +1,7 @@
building = {}
building.translator = minetest.get_translator(minetest.get_current_modname())
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
dofile(minetest.get_modpath(minetest.get_current_modname()).."/structural.lua")
building = {}
building.translator = minetest.get_translator(modname)
voxelibre.load_mod_files(modpath)