Fix repeated clicks of same item not toggling usages mode

This commit is contained in:
Paul Ouellette 2019-01-02 00:35:21 -05:00
parent 4bca02f0db
commit 1034fd7c0e
1 changed files with 12 additions and 9 deletions

View File

@ -102,7 +102,7 @@ local function get_fueltime(item)
end end
local function reset_datas(data) local function reset_datas(data)
data.show_usage = nil data.show_usage = false
data.filter = "" data.filter = ""
data.input = nil data.input = nil
data.pagenum = 1 data.pagenum = 1
@ -647,11 +647,16 @@ local function get_fields(player, ...)
end end
if item ~= data.input then if item ~= data.input then
data.show_usage = nil data.show_usage = false
else
data.show_usage = not data.show_usage
end end
if not progressive_mode and (is_fuel and no_recipes) or if not progressive_mode and (is_fuel and no_recipes) then
(not data.show_usage and item == data.input) then data.show_usage = true
end
if data.show_usage then
data.usages = get_item_usages(item) data.usages = get_item_usages(item)
if is_fuel then if is_fuel then
@ -663,8 +668,8 @@ local function get_fields(player, ...)
} }
end end
if next(data.usages) then if not next(data.usages) then
data.show_usage = true data.show_usage = false
end end
elseif progressive_mode then elseif progressive_mode then
@ -680,7 +685,6 @@ local function get_fields(player, ...)
data.input = item data.input = item
data.recipes_item = recipes data.recipes_item = recipes
data.rnum = 1 data.rnum = 1
data.show_usage = data.show_usage
show_fs(player, player_name) show_fs(player, player_name)
end end
@ -854,7 +858,6 @@ if not progressive_mode then
end end
end end
data.show_usage = data.show_usage
data.input = node_name data.input = node_name
data.recipes_item = recipes data.recipes_item = recipes
@ -884,4 +887,4 @@ for x = 1, 6 do
recipe = cr[x] recipe = cr[x]
}) })
end end
]] ]]