forked from minetest-mods/unified_inventory
parent
77c3de08ce
commit
54abad72f0
21
internal.lua
21
internal.lua
@ -223,7 +223,8 @@ function unified_inventory.get_formspec(player, page)
|
|||||||
for y = 0, ui_peruser.pagerows - 1 do
|
for y = 0, ui_peruser.pagerows - 1 do
|
||||||
for x = 0, ui_peruser.pagecols - 1 do
|
for x = 0, ui_peruser.pagecols - 1 do
|
||||||
local name = unified_inventory.filtered_items_list[player_name][list_index]
|
local name = unified_inventory.filtered_items_list[player_name][list_index]
|
||||||
if minetest.registered_items[name] then
|
local item = minetest.registered_items[name]
|
||||||
|
if item then
|
||||||
-- Clicked on current item: Flip crafting direction
|
-- Clicked on current item: Flip crafting direction
|
||||||
if name == unified_inventory.current_item[player_name] then
|
if name == unified_inventory.current_item[player_name] then
|
||||||
local cdir = unified_inventory.current_craft_direction[player_name]
|
local cdir = unified_inventory.current_craft_direction[player_name]
|
||||||
@ -236,12 +237,18 @@ function unified_inventory.get_formspec(player, page)
|
|||||||
-- Default: use active search direction by default
|
-- Default: use active search direction by default
|
||||||
dir = unified_inventory.active_search_direction[player_name]
|
dir = unified_inventory.active_search_direction[player_name]
|
||||||
end
|
end
|
||||||
formspec[n] = "item_image_button["
|
|
||||||
..(8.2 + x * 0.7)..","
|
local button_name = "item_button_" .. dir .. "_"
|
||||||
..(ui_peruser.formspec_y + ui_peruser.page_y + y * 0.7)..";.81,.81;"
|
.. unified_inventory.mangle_for_formspec(name)
|
||||||
..name..";item_button_"..dir.."_"
|
formspec[n] = ("item_image_button[%f,%f;.81,.81;%s;%s;]"):format(
|
||||||
..unified_inventory.mangle_for_formspec(name)..";]"
|
8.2 + x * 0.7, ui_peruser.formspec_y + ui_peruser.page_y + y * 0.7,
|
||||||
n = n+1
|
name, button_name
|
||||||
|
)
|
||||||
|
formspec[n + 1] = ("tooltip[%s;%s \\[%s\\]]"):format(
|
||||||
|
button_name, minetest.formspec_escape(item.description),
|
||||||
|
item.mod_origin or "??"
|
||||||
|
)
|
||||||
|
n = n + 2
|
||||||
list_index = list_index + 1
|
list_index = list_index + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user