summaryrefslogtreecommitdiff
path: root/autocrafter.lua
diff options
context:
space:
mode:
authorTim <t4im@users.noreply.github.com>2015-01-31 14:47:06 +0100
committerTim <t4im@users.noreply.github.com>2015-01-31 14:47:06 +0100
commit810ae99008667209508f553e6b08e53e63bf1029 (patch)
treee7252426166658fc833b7e5d956d9eadd2935d15 /autocrafter.lua
parent4dc3f159c9114d65571122909e252167579dc90b (diff)
downloadpipeworks-810ae99008667209508f553e6b08e53e63bf1029.tar
pipeworks-810ae99008667209508f553e6b08e53e63bf1029.tar.gz
pipeworks-810ae99008667209508f553e6b08e53e63bf1029.tar.bz2
pipeworks-810ae99008667209508f553e6b08e53e63bf1029.tar.xz
pipeworks-810ae99008667209508f553e6b08e53e63bf1029.zip
reduce texturename repetition via __index
Diffstat (limited to 'autocrafter.lua')
-rw-r--r--autocrafter.lua11
1 files changed, 2 insertions, 9 deletions
diff --git a/autocrafter.lua b/autocrafter.lua
index 89559ba..d3a4ccd 100644
--- a/autocrafter.lua
+++ b/autocrafter.lua
@@ -153,15 +153,8 @@ local function on_output_change(pos, inventory, stack)
if not input.items or input.type ~= "normal" then return end
local items, width = normalize(input.items), input.width
local item_idx, width_idx = 1, 1
- for i = 1, 9 do
- if width_idx <= width then
- inventory:set_stack("recipe", i, items[item_idx])
- item_idx = item_idx + 1
- else
- inventory:set_stack("recipe", i, ItemStack(""))
- end
- width_idx = (width_idx < 3) and (width_idx + 1) or 1
- end
+ inventory:set_width("recipe", 3)
+ inventory:set_list("recipe", items)
-- we'll set the output slot in after_recipe_change to the actual result of the new recipe
end
after_recipe_change(pos, inventory)