]> git.lizzy.rs Git - xdecor.git/commitdiff
Crafting guide : better output shaping
authorkilbith <jeanpatrick.guerrero@gmail.com>
Sun, 3 Jan 2016 18:03:54 +0000 (19:03 +0100)
committerkilbith <jeanpatrick.guerrero@gmail.com>
Sun, 3 Jan 2016 18:03:54 +0000 (19:03 +0100)
worktable.lua

index 9be5a1468fa640a6842880645adb060ecb5671e1..38f689e69ba3f248b4f788a6958beaf8bd78bfb6 100644 (file)
@@ -81,14 +81,17 @@ function worktable.craft_output_recipe(pos, start_i, pagenum, stackname, recipe_
                        inv:set_stack("item_craft_input", 1, stackname)
                end
 
-               if stack_type == "cooking" then
-                       formspec = formspec..[[ list[context;craft_output_recipe;5,6.3;1,1;]
-                                               image[4.25,5.9;0.5,0.5;default_furnace_fire_fg.png] ]]
+               if stack_type == "cooking" or table.maxn(stack_items) == 1 then
+                       if stack_type == "cooking" then
+                               formspec = formspec.."image[4.25,5.9;0.5,0.5;default_furnace_fire_fg.png]"
+                       end
+                       formspec = formspec.."list[context;craft_output_recipe;5,6.3;1,1;]"
                else
                        if stack_width == 0 then
                                formspec = formspec.."list[context;craft_output_recipe;5,5.3;3,3;]"
                        else
-                               formspec = formspec.."list[context;craft_output_recipe;5,5.3;"..stack_width..",3;]"
+                               formspec = formspec.."list[context;craft_output_recipe;5,5.3;"..stack_width..
+                                               ","..math.ceil(table.maxn(stack_items) / stack_width)..";]"
                        end
                end