Get rid of get_short_description

This commit is contained in:
Jean-Patrick Guerrero 2021-04-06 17:30:25 +02:00
parent 6fe45c0fac
commit e244a82d04

View File

@ -668,11 +668,14 @@ local function get_desc(item)
local def = reg_items[item] local def = reg_items[item]
if def then if not def then
local desc = ItemStack(item):get_short_description() return S("Unknown Item (@1)", item)
end
local desc = def.description
if true_str(desc) then if true_str(desc) then
desc = desc:trim() desc = desc:trim():match("[^\n]*")
if not find(desc, "%u") then if not find(desc, "%u") then
desc = toupper(desc) desc = toupper(desc)
@ -685,9 +688,6 @@ local function get_desc(item)
end end
end end
return S("Unknown Item (@1)", item)
end
local function item_has_groups(item_groups, groups) local function item_has_groups(item_groups, groups)
for i = 1, #groups do for i = 1, #groups do
local group = groups[i] local group = groups[i]
@ -1646,7 +1646,7 @@ local function get_header(fs, data)
fs(fmt("tooltip[nofav;%s]", ES"Cannot mark this item. Bookmark limit reached.")) fs(fmt("tooltip[nofav;%s]", ES"Cannot mark this item. Bookmark limit reached."))
end end
local desc_lim, name_lim = 32, 34 local desc_lim, name_lim = 33, 34
local desc = translate(data.lang_code, get_desc(data.query_item)) local desc = translate(data.lang_code, get_desc(data.query_item))
desc = ESC(desc) desc = ESC(desc)
local tech_name = data.query_item local tech_name = data.query_item
@ -1664,7 +1664,7 @@ local function get_header(fs, data)
tech_name = snip(tech_name, name_lim) tech_name = snip(tech_name, name_lim)
end end
fs("style_type[label;font=bold;font_size=22]") fs("style_type[label;font=bold;font_size=20]")
fs("label", X, Y1, desc) fs("label", X, Y1, desc)
fs("style_type[label;font=mono;font_size=16]") fs("style_type[label;font=mono;font_size=16]")
fs("label", X, Y2, clr("#7bf", tech_name)) fs("label", X, Y2, clr("#7bf", tech_name))