Fix replacements

This commit is contained in:
Jean-Patrick Guerrero 2020-07-09 17:15:11 +02:00
parent 9fa0c44cd7
commit fc1141c624

@ -828,7 +828,9 @@ local function get_tooltip(item, info, lang_code)
end end
if info.replace then if info.replace then
local desc = clr("#ff0", get_desc(info.replace, lang_code)) for i = 1, #info.replace do
local rpl = info.replace[i]
local desc = clr("#ff0", get_desc(rpl, lang_code))
if info.cooktime then if info.cooktime then
tooltip = add(S("Replaced by @1 on smelting", desc)) tooltip = add(S("Replaced by @1 on smelting", desc))
@ -838,6 +840,7 @@ local function get_tooltip(item, info, lang_code)
tooltip = add(S("Replaced by @1 on crafting", desc)) tooltip = add(S("Replaced by @1 on crafting", desc))
end end
end end
end
if info.repair then if info.repair then
tooltip = add(S("Repairable by step of @1", clr("#ff0", toolrepair .. "%"))) tooltip = add(S("Repairable by step of @1", clr("#ff0", toolrepair .. "%")))
@ -1011,11 +1014,13 @@ local function get_grid_fs(lang_code, fs, rcp, spacing)
local replace local replace
if rcp.replacements then if rcp.replacements then
replace = {}
label = fmt("%s%s\nR", label ~= "" and "\n" or "", label)
for j = 1, #rcp.replacements do for j = 1, #rcp.replacements do
local replacement = rcp.replacements[j] local replacement = rcp.replacements[j]
if replacement[1] == name then if replacement[1] == name then
label = (label ~= "" and "\n" or "") .. label .. "\nR" replace[#replace + 1] = replacement[2]
replace = replacement[2]
end end
end end
end end