summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlockMen <nmuelll@web.de>2015-04-13 17:40:50 +0200
committerBlockMen <nmuelll@web.de>2015-04-13 17:40:50 +0200
commit35c8616cbd6aaf0ff7b6693ca8b877f0af52ab40 (patch)
tree91194ecb283f66094151f17464c16c67ad6707a9
parenta803879c1e125a16bfb6d8e777a1524e1cfc42a2 (diff)
Scroll empty slots aswell (fixes #23)
-rw-r--r--itemwheel.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/itemwheel.lua b/itemwheel.lua
index 2e98241..0c5fd01 100644
--- a/itemwheel.lua
+++ b/itemwheel.lua
@@ -22,10 +22,11 @@ local function update_wheel(player)
-- get the displayed items
local inv = player:get_inventory()
local item = hb[name].item
+ local index = hb[name].index
local item2 = player:get_wielded_item():get_name()
-- update all items when wielded has changed
- if item and item2 and item ~= item2 or item == "wheel_init" then
+ if item and item2 and item ~= item2 or item == "wheel_init" or (index and index ~= i) then
local items = {}
items[1] = inv:get_stack("main", i1):get_name() or nil
items[2] = item2
@@ -96,6 +97,7 @@ local function update_wheel(player)
-- update wielded buffer
if hb[name].id[2] ~= nil then
hb[name].item = item2
+ hb[name].index = i
end
end
@@ -104,6 +106,7 @@ minetest.register_on_joinplayer(function(player)
hb[name]= {}
hb[name].id = {}
hb[name].item = "wheel_init"
+ hb[name].index = 1
minetest.after(0.1, function()