mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-26 12:33:43 +01:00
Fix replacement label
This commit is contained in:
parent
df26d31a2d
commit
efe7434dd4
14
init.lua
14
init.lua
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user