Fix tooltip

This commit is contained in:
Jean-Patrick Guerrero 2019-10-15 15:30:52 +02:00
parent b12502a7da
commit 77dbe040b8

View File

@ -637,12 +637,10 @@ local function get_tooltip(name, info)
groupstr = concat(groupstr, ", ") groupstr = concat(groupstr, ", ")
tooltip = S("Any item belonging to the group(s): @1", groupstr) tooltip = S("Any item belonging to the group(s): @1", groupstr)
else
return fmt("tooltip[%s;%s]", name, ESC(tooltip)) tooltip = get_desc(name)
end end
tooltip = get_desc(name)
local function add(str) local function add(str)
return fmt("%s\n%s", tooltip, str) return fmt("%s\n%s", tooltip, str)
end end
@ -825,7 +823,7 @@ local function get_grid_fs(fs, rcp, spacing)
for j = 1, #replacements do for j = 1, #replacements do
local replacement = replacements[j] local replacement = replacements[j]
if replacement[1] == name then if replacement[1] == name then
label = "\nR" label = (label ~= "" and "\n" or "") .. label .. "\nR"
replace = replacement[2] replace = replacement[2]
end end
end end
@ -833,7 +831,7 @@ local function get_grid_fs(fs, rcp, spacing)
fs[#fs + 1] = fmt(FMT.item_image_button, fs[#fs + 1] = fmt(FMT.item_image_button,
X, Y + (sfinv_only and 0.7 or 0), X, Y + (sfinv_only and 0.7 or 0),
btn_size, btn_size, item, name, ESC(label)) btn_size, btn_size, item, item, ESC(label))
local infos = { local infos = {
unknown = not reg_items[name] or nil, unknown = not reg_items[name] or nil,
@ -844,7 +842,7 @@ local function get_grid_fs(fs, rcp, spacing)
} }
if next(infos) then if next(infos) then
fs[#fs + 1] = get_tooltip(name, infos) fs[#fs + 1] = get_tooltip(item, infos)
end end
if CORE_VERSION >= 510 and not large_recipe then if CORE_VERSION >= 510 and not large_recipe then