From 2a516ac22b2ee4381404870950492be83d7ebe5e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 6 Aug 2016 23:31:53 +0200 Subject: Add seperate button for resetting search --- callbacks.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'callbacks.lua') diff --git a/callbacks.lua b/callbacks.lua index e86cac6..be5c055 100644 --- a/callbacks.lua +++ b/callbacks.lua @@ -153,11 +153,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) if fields.searchbutton then unified_inventory.apply_filter(player, unified_inventory.current_searchbox[player_name], "nochange") - unified_inventory.current_searchbox[player_name] = "" unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name]) minetest.sound_play("paperflip2", {to_player=player_name, gain = 1.0}) + elseif fields.searchresetbutton then + unified_inventory.apply_filter(player, "", "nochange") + unified_inventory.current_searchbox[player_name] = "" + unified_inventory.set_inventory_formspec(player, + unified_inventory.current_page[player_name]) + minetest.sound_play("click", + {to_player=player_name, gain = 0.1}) end -- alternate buttons -- cgit v1.2.3 From 40f8b4d9cf5273ee2830a91fa87418a795163692 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 7 Aug 2016 00:14:02 +0200 Subject: Update search field when clicking on group item --- callbacks.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'callbacks.lua') diff --git a/callbacks.lua b/callbacks.lua index be5c055..ad6de0a 100644 --- a/callbacks.lua +++ b/callbacks.lua @@ -120,6 +120,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) if string.sub(clicked_item, 1, 6) == "group:" then minetest.sound_play("click", {to_player=player_name, gain = 0.1}) unified_inventory.apply_filter(player, clicked_item, new_dir) + unified_inventory.current_searchbox[player_name] = clicked_item + unified_inventory.set_inventory_formspec(player, + unified_inventory.current_page[player_name]) return end if new_dir == "recipe" -- cgit v1.2.3