Skip to content
Snippets Groups Projects
Commit 7bdd1c58 authored by dg's avatar dg
Browse files

addon support! (not compressed yet)

git-svn-id: http://svn.net-core.org/repos/t-engine4@4241 51575b47-30f0-44d4-a5cc-537603b46e54
parent 71f12326
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,6 @@ end
function _M:newBirthDescriptor(t)
assert(t.name, "no birth name")
assert(t.type, "no birth type")
print("==============**************************", t.name)
t.short_name = t.short_name or t.name
t.short_name = t.short_name:upper():gsub("[ ]", "_")
t.display_name = t.display_name or t.name
......
......@@ -236,6 +236,34 @@ function _M:listVaultSavesForCurrent()
return lss
end
--- List all available addons
function _M:loadAddons(mod)
local load = function(dir)
local add_def = loadfile(team and (dir.."/mod/init.lua") or (dir.."/init.lua"))
if add_def then
local add = {}
setfenv(add_def, add)
add_def()
if engine.version_string(add.version) == engine.version_string(mod.version) and add.for_module == mod.short_name then
print("Binding addon", add.long_name)
if add.superload then fs.mount(fs.getRealPath(dir).."/superload", "/mod/addons/"..add.short_name.."/superload", false) print(" * with superload") end
if add.overload then fs.mount(fs.getRealPath(dir).."/overload", "/", true) print(" * with overload") end
end
end
end
local adds = {}
for i, short_name in ipairs(fs.list("/addons/")) do if short_name:find("^"..mod.short_name.."%-") then
local dir = "/addons/"..short_name
print("Checking addon", short_name, ":: (as dir)", fs.exists(dir.."/init.lua"), ":: (as teaa)", short_name:find(".teaa$"), "")
if fs.exists(dir.."/init.lua") then
load(dir)
elseif short_name:find(".team$") then
end
end end
end
--- Make a module loadscreen
function _M:loadScreen(mod)
core.display.forceRedraw()
......@@ -390,6 +418,8 @@ function _M:instanciate(mod, name, new_game, no_reboot)
end
end
self:loadAddons(mod)
profile:addStatFields(unpack(mod.profile_stats_fields or {}))
profile:setConfigsBatch(true)
profile:loadModuleProfile(mod.short_name, mod)
......
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment