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

better

git-svn-id: http://svn.net-core.org/repos/t-engine4@4242 51575b47-30f0-44d4-a5cc-537603b46e54
parent 7bdd1c58
No related branches found
No related tags found
No related merge requests found
......@@ -238,6 +238,7 @@ end
--- List all available addons
function _M:loadAddons(mod)
local adds = {}
local load = function(dir)
local add_def = loadfile(team and (dir.."/mod/init.lua") or (dir.."/init.lua"))
if add_def then
......@@ -246,14 +247,12 @@ function _M:loadAddons(mod)
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
add.dir = dir
adds[#adds+1] = add
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$"), "")
......@@ -262,6 +261,14 @@ function _M:loadAddons(mod)
elseif short_name:find(".team$") then
end
end end
table.sort(adds, function(a, b) return a.weight < b.weight end)
for i, add in ipairs(adds) do
print("Binding addon", add.long_name)
if add.superload then fs.mount(fs.getRealPath(add.dir).."/superload", "/mod/addons/"..add.short_name.."/superload", false) print(" * with superload") end
if add.overload then fs.mount(fs.getRealPath(add.dir).."/overload", "/", true) print(" * with overload") end
end
end
--- Make a module loadscreen
......
......@@ -28,9 +28,7 @@ _M.talents_types_def = {}
--- Defines actor talents
-- Static!
function _M:loadDefinition(file, env)
local f, err = loadfile(file)
if not f and err then error(err) end
setfenv(f, setmetatable(env or {
local f, err = util.loadfilemods(file, setmetatable(env or {
DamageType = require("engine.DamageType"),
Particles = require("engine.Particles"),
Talents = self,
......@@ -39,6 +37,7 @@ function _M:loadDefinition(file, env)
newTalentType = function(t) self:newTalentType(t) end,
load = function(f) self:loadDefinition(f, getfenv(2)) end
}, {__index=_G}))
if not f and err then error(err) end
f()
end
......
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