summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--callbacks.lua8
-rw-r--r--internal.lua8
-rw-r--r--textures/ui_reset_icon.pngbin0 -> 11310 bytes
4 files changed, 17 insertions, 4 deletions
diff --git a/README.md b/README.md
index 6f5e2d4..489ebab 100644
--- a/README.md
+++ b/README.md
@@ -14,9 +14,10 @@ Unified inventory code is licensed under the GNU LGPLv2+.
Licenses for textures:
VanessaE: (WTFPL)
- * ui\_group.png
+ * `ui_group.png`
RealBadAngel: (WTFPL)
* Everything else.
-
+Tango Project: (WTFPL)
+ * `ui_reset_icon.png
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
diff --git a/internal.lua b/internal.lua
index 8319191..42ab722 100644
--- a/internal.lua
+++ b/internal.lua
@@ -179,13 +179,19 @@ function unified_inventory.get_formspec(player, page)
.. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]"
formspec[n+1] = "image_button[12.2,8.1;.8,.8;ui_search_icon.png;searchbutton;]"
.. "tooltip[searchbutton;" ..F("Search") .. "]"
+ formspec[n+2] = "image_button[12.9,8.1;.8,.8;ui_reset_icon.png;searchresetbutton;]"
+ .. "tooltip[searchbutton;" ..F("Search") .. "]"
+ .. "tooltip[searchresetbutton;" ..F("Reset search and display everything") .. "]"
else
formspec[n] = "field[8.5,5.225;2.2,1;searchbox;;"
.. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]"
formspec[n+1] = "image_button[10.3,5;.8,.8;ui_search_icon.png;searchbutton;]"
.. "tooltip[searchbutton;" ..F("Search") .. "]"
+ formspec[n+2] = "image_button[11,5;.8,.8;ui_reset_icon.png;searchresetbutton;]"
+ .. "tooltip[searchbutton;" ..F("Search") .. "]"
+ .. "tooltip[searchresetbutton;" ..F("Reset search and display everything") .. "]"
end
- n = n+2
+ n = n+3
local no_matches = "No matching items"
if draw_lite_mode then
diff --git a/textures/ui_reset_icon.png b/textures/ui_reset_icon.png
new file mode 100644
index 0000000..ec9ef62
--- /dev/null
+++ b/textures/ui_reset_icon.png
Binary files differ