1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-05 10:00:26 +01:00

add button to hide/show craftguide, the text search field prevents closing inventory if you do not click outside the field before

This commit is contained in:
crabman77 2015-11-29 16:42:07 +01:00
parent ea4fc7f70c
commit d676da66a7
3 changed files with 21 additions and 0 deletions

View File

@ -56,6 +56,16 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return
end
if fields.hidebutton then --MFF crabman(29/11/2015) hide guide, textfield bug
if not unified_inventory.hidden_guide[player_name] then
unified_inventory.hidden_guide[player_name] = true
else
unified_inventory.hidden_guide[player_name] = false
end
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
return
end
-- always take new search text, even if not searching on it yet
if fields.searchbox
and fields.searchbox ~= unified_inventory.current_searchbox[player_name] then

View File

@ -22,6 +22,7 @@ unified_inventory = {
filtered_items_list = {},
pages = {},
buttons = {},
hidden_guide = {}, --MFF crabman(29/11/2015) hide guide, textfield bug
-- Homepos stuff
home_pos = {},

View File

@ -134,6 +134,16 @@ function unified_inventory.get_formspec(player, page)
return table.concat(formspec, "")
end
if not unified_inventory.hidden_guide[player_name] then --MFF crabman(29/11/2015) hide guide, textfield bug
formspec[n] = "image_button[13.2,0.1;.8,.8;ui_on_icon.png;hidebutton;]"
.. "tooltip[hidebutton;" ..S("Hide guide") .. "]"
n = n+1
else
formspec[n] = "image_button[13.2,0.1;.8,.8;ui_off_icon.png;hidebutton;]"
.. "tooltip[hidebutton;" ..S("Show guide") .. "]"
return table.concat(formspec, "")
end
-- Controls to flip items pages
local start_x = 9.2