mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-26 04:23:44 +01:00
Strip item count in replacement tooltip
This commit is contained in:
parent
95e1aea493
commit
e6d1857799
26
init.lua
26
init.lua
@ -842,7 +842,7 @@ local function get_tooltip(item, info, lang_code)
|
|||||||
|
|
||||||
if info.replace then
|
if info.replace then
|
||||||
for i = 1, #info.replace do
|
for i = 1, #info.replace do
|
||||||
local rpl = info.replace[i]
|
local rpl = match(info.replace[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.cooktime then
|
||||||
@ -1026,17 +1026,25 @@ local function get_grid_fs(lang_code, fs, rcp, spacing)
|
|||||||
local label = groups and "\nG" or ""
|
local label = groups and "\nG" or ""
|
||||||
local replace
|
local replace
|
||||||
|
|
||||||
if rcp.replacements then
|
for j = 1, #(rcp.replacements or {}) 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
|
replace = replace or {}
|
||||||
replace = replace or {}
|
|
||||||
|
|
||||||
if j == 1 then
|
if j == 1 then
|
||||||
label = fmt("%s%s\nR",
|
label = fmt("%s%s\nR", label ~= "" and "\n" or "", label)
|
||||||
label ~= "" and "\n" or "", label)
|
end
|
||||||
|
|
||||||
|
local added
|
||||||
|
|
||||||
|
for _, v in ipairs(replace) do
|
||||||
|
if replacement[2] == v then
|
||||||
|
added = true
|
||||||
|
break
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not added then
|
||||||
replace[#replace + 1] = replacement[2]
|
replace[#replace + 1] = replacement[2]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user