summaryrefslogtreecommitdiff
path: root/internal.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-07 02:14:46 +0200
committerWuzzy <almikes@aol.com>2016-08-07 02:14:46 +0200
commit7bba35a911116024d242b900a095c379cdc56539 (patch)
tree30a0a1a1bc092a221a4b9206829eba59b95ccc39 /internal.lua
parent7d039147e71bcc4e947be0f3bfb38707790263fb (diff)
Flip craft mode when clicking current item in list
Diffstat (limited to 'internal.lua')
-rw-r--r--internal.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal.lua b/internal.lua
index b99cf72..b9a3bfc 100644
--- a/internal.lua
+++ b/internal.lua
@@ -206,6 +206,18 @@ function unified_inventory.get_formspec(player, page)
for x = 0, ui_peruser.pagecols - 1 do
local name = unified_inventory.filtered_items_list[player_name][list_index]
if minetest.registered_items[name] then
+ -- Clicked on current item: Flip crafting direction
+ if name == unified_inventory.current_item[player_name] then
+ local cdir = unified_inventory.current_craft_direction[player_name]
+ if cdir == "recipe" then
+ dir = "usage"
+ elseif cdir == "usage" then
+ dir = "recipe"
+ end
+ else
+ -- Default: use active search direction by default
+ dir = unified_inventory.active_search_direction[player_name]
+ end
formspec[n] = "item_image_button["
..(8.2 + x * 0.7)..","
..(ui_peruser.formspec_y + ui_peruser.page_y + y * 0.7)..";.81,.81;"