fixed search again

This commit is contained in:
Alexander Weber 2017-03-02 13:38:54 +01:00
parent 040bc5a266
commit 352aba2786
3 changed files with 5 additions and 3 deletions

View File

@ -381,6 +381,7 @@ local function crafting_callback(state)
local search_string = state:get("search"):getText()
if search_string ~= "" and search_string ~= state.param.survival_search_string then
local filtered_list = ui_tools.search_in_list(cache.get_revealed_items(player), search_string, player)
state.param.survival_search_string = search_string
state.param.crafting_grouped_items = cache.get_list_grouped(filtered_list)
update_group_selection(state, true)
end

View File

@ -115,9 +115,10 @@ local function creative_callback(state)
state:onInput(function(state, fields, player)
local search_string = state:get("search"):getText()
if search_string ~= (state.param.creative_search_string or "") then
local filtered_list = ui_tools.search_in_list(state.param.creative_grouped_items_all, search_string, player)
local filtered_list = ui_tools.search_in_list(state.param.creative_grouped_items_all, search_string)
state.param.creative_grouped_items = cache.get_list_grouped(filtered_list)
filtered_list = ui_tools.search_in_list(state.param.creative_grouped_items_material_all, search_string, player)
filtered_list = ui_tools.search_in_list(state.param.creative_grouped_items_material_all, search_string)
state.param.creative_search_string = search_string
state.param.creative_grouped_material_items = filtered_list
update_group_selection(state, 0)
end

View File

@ -107,7 +107,7 @@ function ui_tools.search_in_list(list, search_string, playername)
end
end
end
if smart_inventory.doc_items_mod then
if smart_inventory.doc_items_mod and playername then
for _, entry in ipairs(filtered_list) do
if entry.recipes then
local valid_recipes = {}