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

crude inventory sorting

git-svn-id: http://svn.net-core.org/repos/t-engine4@156 51575b47-30f0-44d4-a5cc-537603b46e54
parent 46e7392b
No related branches found
No related tags found
No related merge requests found
......@@ -207,4 +207,19 @@ function _M:sortInven(inven)
end
end
end
-- Sort them
table.sort(inven, function(a, b)
local ta, tb = a.type or "", b.type or ""
local sa, sb = a.subtype or "", b.subtype or ""
if ta == tb then
if sa == sb then
return a.name < b.name
else
return sa < sb
end
else
return ta < tb
end
end)
end
......@@ -46,7 +46,7 @@ function _M:timedEffects()
for eff, p in pairs(self.tmp) do
p.dur = p.dur - 1
if p.dur <= 0 then
-- self:removeEffect(eff)
self:removeEffect(eff)
else
if _M.tempeffect_def[eff].on_timeout then
_M.tempeffect_def[eff].on_timeout(self, p)
......@@ -90,7 +90,7 @@ function _M:hasEffect(eff_id)
end
--- Removes the effect
function _M:removeEffecf(eff)
function _M:removeEffect(eff)
local p = self.tmp[eff]
self.tmp[eff] = nil
self.changed = true
......
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