This resulted in a black screen with only a mouse cursor and nothing else because the relevant code seems not to have been touched for quite some time.
The following changes in engine/module.lua made this work:
Code: Select all
function _M:createModule(short_name, incompatible)
local dir = "/modules/"..short_name
-- MNI: fixed, path+added cache
local init_exists=fs.exists(dir.."/mod/init.lua")
local zip_file=short_name:find(".team$")
print("Creating module", short_name, ":: (as dir)", init_exists, ":: (as team)", zip_file, "")
-- MNI: changed, use cache
if init_exists then
local mod = self:loadDefinition(dir, nil, incompatible)
if mod and mod.short_name then
return mod
end
-- MNI: changed, use cache
elseif zip_file then
...
end
function _M:loadDefinition(dir, team, incompatible)
-- MNI: fixed, path is the same no matter if zipped or not
local mod_def=loadfile(dir.."/mod/init.lua")
-- print("Loading module definition from", dir.."/mod/init.lua")
if mod_def then
...
mod.load = function(mode)
if mode == "setup" then
core.display.setWindowTitle(mod.long_name)
self:setupWrite(mod)
if not team then
-- MNI: fixed, only mount base dir as with zipped
fs.mount(fs.getRealPath(dir), "/", false)
-- MNI: added, in case further dirs are supposed to load as well
for i, t in ipairs(mod.teams or {}) do
local base=dir:gsub("/[^/]+$","/")
local new_dir=base..t[1]:
gsub(".team$",""):
gsub("#name#",mod.short_name):
gsub("#version#",("%d.%d.%d"):
format(mod.version[1],mod.version[2],mod.version[3]))
if fs.exists(new_dir) then
print("Mounting additional dir:",new_dir)
fs.mount(fs.getRealPath(new_dir),t[3],false)
end
end
else
...
end