mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 00:19:32 +01:00
Prettify group highlighting in craftguide
This commit is contained in:
parent
0f6bdc9921
commit
06847c38d2
1 changed files with 29 additions and 4 deletions
|
@ -50,6 +50,26 @@ local group_stereotypes = {
|
|||
mesecon_conductor_craftable = "mesecons:wire_00000000_off",
|
||||
}
|
||||
|
||||
local group_names = {
|
||||
shulker_box = "Any shulker box",
|
||||
wool = "Any wool",
|
||||
wood = "Any wood planks",
|
||||
tree = "Any wood",
|
||||
sand = "Any sand",
|
||||
sandstone = "Any sandstone (yellow)",
|
||||
redsandstone = "Any red sandstone",
|
||||
carpet = "Any carpet",
|
||||
dye = "Any dye",
|
||||
water_bucket = "Any water bucket",
|
||||
flower = "Any flower",
|
||||
mushroom = "Any mushroom",
|
||||
wood_slab = "Any wooden slab",
|
||||
wood_stairs = "Any wooden stairs",
|
||||
coal = "Any coal",
|
||||
quartz_block = "Any kind of quartz block",
|
||||
stonebrick = "Any stone bricks"
|
||||
}
|
||||
|
||||
function craftguide:group_to_item(item)
|
||||
if item:sub(1,6) == "group:" then
|
||||
local itemsub = item:sub(7)
|
||||
|
@ -107,24 +127,29 @@ function craftguide:get_tooltip_raw(item, recipe_type, cooktime, groups)
|
|||
return tooltip.."Unknown Item ("..item..")]"
|
||||
end
|
||||
if groups then
|
||||
local gcol = "#FFAAFF"
|
||||
local groupstr
|
||||
if #groups == 1 then
|
||||
groupstr = "Any item belonging to the " .. colorize(groups[1]) .. " group"
|
||||
if group_names[groups[1]] then
|
||||
groupstr = group_names[groups[1]]
|
||||
else
|
||||
groupstr = "Any item belonging to the " .. groups[1] .. " group"
|
||||
end
|
||||
else
|
||||
groupstr = "Any item belonging to the following groups: "
|
||||
for i=1, #groups do
|
||||
groupstr = groupstr .. colorize(groups[i])..
|
||||
groupstr = groupstr .. groups[i]..
|
||||
(groups[i+1] and " and " or "")
|
||||
end
|
||||
end
|
||||
tooltip = tooltip..groupstr
|
||||
tooltip = tooltip..core.colorize(gcol, groupstr)
|
||||
end
|
||||
tooltip = tooltip .. item_desc
|
||||
if recipe_type == "cooking" then
|
||||
tooltip = tooltip.."\nCooking time: "..
|
||||
colorize(cooktime)
|
||||
end
|
||||
if fueltime > 0 then
|
||||
if fueltime > 0 and not groups then
|
||||
tooltip = tooltip.."\nBurning time: "..
|
||||
colorize(fueltime)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue