mirror of
https://github.com/minetest-mods/i3.git
synced 2024-12-27 11:20:40 +01:00
Fix tooltips for output with meta
This commit is contained in:
parent
7a48b93719
commit
5915ab20f7
13
init.lua
13
init.lua
@ -1291,7 +1291,7 @@ local function is_fav(favs, query_item)
|
||||
return fav, i
|
||||
end
|
||||
|
||||
local function get_tooltip(item, info)
|
||||
local function get_tooltip(item, info, pos)
|
||||
local tooltip
|
||||
|
||||
if info.groups then
|
||||
@ -1364,6 +1364,10 @@ local function get_tooltip(item, info)
|
||||
end
|
||||
end
|
||||
|
||||
if pos then
|
||||
return fmt("tooltip", pos.x, pos.y, ITEM_BTN_SIZE, ITEM_BTN_SIZE, ESC(tooltip))
|
||||
end
|
||||
|
||||
return fmt("tooltip[%s;%s]", item, ESC(tooltip))
|
||||
end
|
||||
|
||||
@ -1407,6 +1411,7 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
||||
local count = item:get_count()
|
||||
local bt_s = ITEM_BTN_SIZE * 1.2
|
||||
local _name = fmt("_%s", name)
|
||||
local pos
|
||||
|
||||
if meta:get_string("color") ~= "" or meta:get_string("palette_index") ~= "" then
|
||||
local rcp_usg = is_recipe and "rcp" or "usg"
|
||||
@ -1416,8 +1421,10 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
||||
fs(fmt("list[detached:i3_output_%s;main;%f,%f;1,1;]", rcp_usg, X + 0.11, Y))
|
||||
fs("button", X + 0.11, Y, ITEM_BTN_SIZE, ITEM_BTN_SIZE, _name, "")
|
||||
|
||||
local inv = minetest.get_inventory({type = "detached", name = fmt("i3_output_%s", rcp_usg)})
|
||||
local inv = minetest.get_inventory {type = "detached", name = fmt("i3_output_%s", rcp_usg)}
|
||||
inv:set_stack("main", 1, item)
|
||||
|
||||
pos = {x = X + 0.11, y = Y}
|
||||
else
|
||||
fs("image", X, Y - 0.11, bt_s, bt_s, PNG.slot)
|
||||
|
||||
@ -1448,7 +1455,7 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
||||
}
|
||||
|
||||
if next(infos) then
|
||||
fs(get_tooltip(_name, infos))
|
||||
fs(get_tooltip(_name, infos, pos))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user