Fix replacement label

This commit is contained in:
Jean-Patrick Guerrero 2020-07-27 18:22:45 +02:00
parent df26d31a2d
commit efe7434dd4

View File

@ -884,13 +884,13 @@ local function get_tooltip(item, info, lang_code)
end end
if info.replace then if info.replace then
for i = 1, #info.replace do for i = 1, #info.replace.items do
local rpl = match(info.replace[i], "%S+") local rpl = match(info.replace.items[i], "%S+")
local desc = clr("#ff0", get_desc(rpl, lang_code)) local desc = clr("#ff0", get_desc(rpl, lang_code))
if info.cooktime then if info.replace.type == "cooking" then
tooltip = add(S("Replaced by @1 on smelting", desc)) tooltip = add(S("Replaced by @1 on smelting", desc))
elseif info.burntime then elseif info.replace.type == "fuel" then
tooltip = add(S("Replaced by @1 on burning", desc)) tooltip = add(S("Replaced by @1 on burning", desc))
else else
tooltip = add(S("Replaced by @1 on crafting", desc)) tooltip = add(S("Replaced by @1 on crafting", desc))
@ -1073,11 +1073,11 @@ local function get_grid_fs(lang_code, fs, rcp, spacing)
for j = 1, #(rcp.replacements or {}) do for j = 1, #(rcp.replacements or {}) do
local replacement = rcp.replacements[j] local replacement = rcp.replacements[j]
if replacement[1] == name then if replacement[1] == name then
replace = replace or {} replace = replace or {type = rcp.type, items = {}}
local added local added
for _, v in ipairs(replace) do for _, v in ipairs(replace.items) do
if replacement[2] == v then if replacement[2] == v then
added = true added = true
break break
@ -1086,7 +1086,7 @@ local function get_grid_fs(lang_code, fs, rcp, spacing)
if not added then if not added then
label = fmt("%s%s\nR", label ~= "" and "\n" or "", label) label = fmt("%s%s\nR", label ~= "" and "\n" or "", label)
replace[#replace + 1] = replacement[2] replace.items[#replace.items + 1] = replacement[2]
end end
end end
end end