diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-08-14 19:43:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-14 19:43:08 -0400 |
commit | f6ea3daef7ab6acdf4156e8e8347c3d536bb4fb4 (patch) | |
tree | 6d2f985b7b3de3b8162ffd8427233c6246a45419 /callbacks.lua | |
parent | dba69b1f7116bdb0f4c9be3dafd411db757e14ec (diff) | |
parent | 15f5b8e8042c635d801320a606c214643d178062 (diff) |
Merge pull request #63 from Wuzzy2/search
Improve search and group handling and related usability
Diffstat (limited to 'callbacks.lua')
-rw-r--r-- | callbacks.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/callbacks.lua b/callbacks.lua index e86cac6..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" @@ -153,11 +156,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 |