Add prettier group names in tooltip

This commit is contained in:
pauloue 2020-04-16 02:09:27 +02:00 committed by Jean-Patrick Guerrero
parent 689840d6f5
commit 4823a9dd62
2 changed files with 77 additions and 7 deletions

View File

@ -130,6 +130,41 @@ craftguide.group_stereotypes = {
mesecon_conductor_craftable = "mesecons:wire_00000000_off", mesecon_conductor_craftable = "mesecons:wire_00000000_off",
} }
local GROUP_NAMES = {
coal = S"Any coal",
wool = S"Any wool",
wood = S"Any wood planks",
sand = S"Any sand",
stick = S"Any stick",
stone = S"Any kind of stone block",
vessel = S"Any vessel",
["color_red,flower"] = S"Any red flower",
["color_blue,flower"] = S"Any blue flower",
["color_black,flower"] = S"Any black flower",
["color_white,flower"] = S"Any white flower",
["color_green,flower"] = S"Any green flower",
["color_orange,flower"] = S"Any orange flower",
["color_yellow,flower"] = S"Any yellow flower",
["color_violet,flower"] = S"Any violet flower",
["color_red,dye"] = S"Any red dye",
["color_blue,dye"] = S"Any blue dye",
["color_grey,dye"] = S"Any grey dye",
["color_pink,dye"] = S"Any pink dye",
["color_cyan,dye"] = S"Any cyan dye",
["color_black,dye"] = S"Any black dye",
["color_white,dye"] = S"Any white dye",
["color_brown,dye"] = S"Any brown dye",
["color_green,dye"] = S"Any green dye",
["color_orange,dye"] = S"Any orange dye",
["color_yellow,dye"] = S"Any yellow dye",
["color_violet,dye"] = S"Any violet dye",
["color_magenta,dye"] = S"Any magenta dye",
["color_dark_grey,dye"] = S"Any dark grey dye",
["color_dark_green,dye"] = S"Any dark green dye",
}
local function err(str) local function err(str)
return log("error", str) return log("error", str)
end end
@ -672,15 +707,20 @@ local function get_tooltip(name, info)
local tooltip local tooltip
if info.groups then if info.groups then
local groupstr, c = {}, 0 sort(info.groups)
tooltip = GROUP_NAMES[concat(info.groups, ",")]
for i = 1, #info.groups do if not tooltip then
c = c + 1 local groupstr, c = {}, 0
groupstr[c] = clr("#ff0", info.groups[i])
for i = 1, #info.groups do
c = c + 1
groupstr[c] = clr("#ff0", info.groups[i])
end
groupstr = concat(groupstr, ", ")
tooltip = S("Any item belonging to the group(s): @1", groupstr)
end end
groupstr = concat(groupstr, ", ")
tooltip = S("Any item belonging to the group(s): @1", groupstr)
else else
tooltip = get_desc(name) tooltip = get_desc(name)
end end

View File

@ -14,6 +14,36 @@ Replaced by @1 on burning=
Replaced by @1 on crafting= Replaced by @1 on crafting=
Repairable by step of @1= Repairable by step of @1=
Any item belonging to the group(s): @1= Any item belonging to the group(s): @1=
Any black dye=
Any black flower=
Any blue dye=
Any blue flower=
Any brown dye=
Any coal=
Any cyan dye=
Any dark green dye=
Any dark grey dye=
Any green dye=
Any green flower=
Any grey dye=
Any kind of stone block=
Any magenta dye=
Any orange dye=
Any orange flower=
Any pink dye=
Any red dye=
Any red flower=
Any sand=
Any stick=
Any vessel=
Any violet dye=
Any violet flower=
Any white dye=
Any white flower=
Any wood planks=
Any wool=
Any yellow dye=
Any yellow flower=
Recipe's too big to be displayed (@1x@2)= Recipe's too big to be displayed (@1x@2)=
Shapeless= Shapeless=
Cooking= Cooking=