Craftguide: Add icon for shapeless recipes

This commit is contained in:
Wuzzy 2017-02-05 23:43:15 +01:00
parent 7c3b41651a
commit 4c1caed41b
3 changed files with 14 additions and 6 deletions

View File

@ -100,21 +100,29 @@ function craftguide:get_recipe(iY, xoffset, tooltip, item, recipe_num, recipes)
recipe_num.." of "..recipes_total.."]"
end
local recipe_type = recipes[recipe_num].type
if recipe_type == "cooking" then
formspec = formspec..
"image["..(xoffset-0.8)..","..(iY+1)..
".5;0.5,0.5;craftguide_furnace.png]"
end
local items = recipes[recipe_num].items
local width = recipes[recipe_num].width
if width == 0 then
local is_shapeless = false
if recipe_type == "normal" and width == 0 then
is_shapeless = true
if #items <= 4 then
width = 2
else
width = min(3, #items)
end
end
if recipe_type == "cooking" then
formspec = formspec..
"image["..(xoffset-0.8)..","..(iY+1)..
".5;0.5,0.5;default_furnace_front_active.png]"
elseif is_shapeless then
formspec = formspec..
"image["..(xoffset-0.8)..","..(iY+1)..
".5;0.5,0.5;craftguide_shapeless.png]"
end
local rows = ceil(maxn(items) / width)
local btn_size, craftgrid_limit = 1, 5

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B