1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2025-06-29 14:50:41 +02:00

reduce texturename repetition via __index

This commit is contained in:
Tim
2015-01-31 14:47:06 +01:00
parent 4dc3f159c9
commit 810ae99008
7 changed files with 41 additions and 61 deletions

View File

@ -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)