Fix shapeless icon and tooltip

This commit is contained in:
Paul Ouellette 2019-01-20 00:06:12 -05:00
parent 21e4ec8700
commit 6229821384
1 changed files with 14 additions and 9 deletions

View File

@ -174,11 +174,12 @@ local function get_recipe_fs(data, iY)
local recipe = data.recipes[data.rnum]
local width = recipe.width
local xoffset = data.iX / 2.15
local cooktime, shapeless
local cooktime
if recipe.type == "cooking" then
cooktime, width = width, 1
elseif width == 0 then
shapeless = true
width = min(3, #recipe.items)
end
@ -234,27 +235,31 @@ local function get_recipe_fs(data, iY)
end
end
local custom_recipe = craftguide.craft_types[recipe_type]
if recipe_type == "cooking" or custom_recipe or
(recipe_type == "normal" and width == 0) then
local custom_recipe = craftguide.craft_types[recipe.type]
local icon = recipe_type == "cooking" and "furnace" or "shapeless"
if custom_recipe or shapeless or recipe.type == "cooking" then
local icon = custom_recipe and custom_recipe.icon or
shapeless and "shapeless" or "furnace"
if not custom_recipe then
icon = "craftguide_" .. icon .. ".png^[resize:16x16"
end
fs[#fs + 1] = fmt("image[%f,%f;%f,%f;%s]",
rightest + 1.2,
iY + (sfinv_only and 2.2 or 1.7),
0.5,
0.5,
custom_recipe and custom_recipe.icon or
"craftguide_" .. icon .. ".png^[resize:16x16")
icon)
local tooltip = custom_recipe and custom_recipe.description or
shapeless and S("Shapeless") or S("Cooking")
fs[#fs + 1] = fmt("tooltip[%f,%f;%f,%f;%s]",
rightest + 1.2,
iY + (sfinv_only and 2.2 or 1.7),
0.5,
0.5,
custom_recipe and custom_recipe.description or
recipe.type:gsub("^%l", string.upper))
tooltip)
end
local arrow_X = rightest + (s_btn_size or 1.1)