Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CHEST = peripheral.wrap("front")
- local CHEST_SIZE = 27
- local MAX_SB = 1728
- local SLOT_COUNT = 16
- function getListSize(list)
- l_Size = 0
- for i = 1, CHEST_SIZE, 1 do
- listSlot = list[i]
- if (listSlot ~= nil) then
- l_Size = l_Size + 1
- end
- end
- return l_Size
- end
- function getChestSlots(list)
- slots = {}
- slotPos = 1
- for i = 1, CHEST_SIZE, 1 do
- chestSlot = list[i]
- if (chestSlot ~= nil) then
- table.insert(slots, slotPos, i)
- slotPos = slotPos + 1
- end
- end
- return slots
- end
- function getTotalAmount(chestList)
- t_sb = 0
- listSize = getListSize(chestList)
- chestSlots = getChestSlots(chestList)
- chestSlotsSize = getListSize(chestSlots)
- for i = 1, chestSlotsSize, 1 do
- t_sb = t_sb + chestList[chestSlots[i]].count
- end
- return t_sb
- end
- -- MAIN
- while true do
- listSize = getListSize(CHEST.list())
- t_sb = getTotalAmount(CHEST.list())
- --print("List size: " .. listSize)
- --print("Total stone bricks: " .. t_sb)
- if(t_sb < MAX_SB) then
- for slot = 1, SLOT_COUNT, 1 do
- turtle.select(slot)
- turtle.drop()
- turtle.suckUp()
- end
- end
- end
Add Comment
Please, Sign In to add comment