From 62298213847605f2ccc4b29beaa17f6928d28109 Mon Sep 17 00:00:00 2001 From: Paul Ouellette Date: Sun, 20 Jan 2019 00:06:12 -0500 Subject: [PATCH] Fix shapeless icon and tooltip --- init.lua | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/init.lua b/init.lua index 6bc18a6..4dad705 100644 --- a/init.lua +++ b/init.lua @@ -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)