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

Pickaxes can be hotkeyed even with one in inventory

git-svn-id: http://svn.net-core.org/repos/t-engine4@2532 51575b47-30f0-44d4-a5cc-537603b46e54
parent 8d4e9f71
No related branches found
No related tags found
No related merge requests found
......@@ -546,7 +546,14 @@ end
function _M:hotkeyInventory(name)
local find = function(name)
local os = {}
-- Sort invens, use worn first
local invens = {}
for inven_id, inven in pairs(self.inven) do
invens[#invens+1] = {inven_id, inven}
end
table.sort(invens, function(a,b) return (a[2].worn and 1 or 0) > (b[2].worn and 1 or 0) end)
for i = 1, #invens do
local inven_id, inven = unpack(invens[i])
local o, item = self:findInInventory(inven, name, {no_count=true, force_id=true, no_add_name=true})
if o and item then os[#os+1] = {o, item, inven_id, inven} end
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