ToLazyToThink

emptylast

Oct 3rd, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1.  
  2. function drop()
  3.     while turtle.getItemCount(1) > 0 do
  4.      turtle.dropUp()
  5.      if turtle.getItemCount(1) > 0 then
  6.        sleep(1)
  7.      else
  8.        return true
  9.      end
  10.    end
  11.    return false
  12. end
  13.  
  14. function main()
  15.   drop()
  16.   while true do
  17.      local chest = peripheral.wrap("bottom")
  18.      local dropped = false
  19.      for i=23,26 do
  20.        local itemInfo = chest.getStackInSlot(i)
  21.        if itemInfo ~= nil and (itemInfo['qty'] * 1) > 0 then
  22.          chest.pushIntoSlot('up', i, 64, 0)
  23.          dropped = drop() or dropped
  24.        end
  25.      end
  26.      if dropped then
  27.        sleep(1)
  28.      end
  29.   end
  30. end
  31.  
  32. main()
Advertisement
Add Comment
Please, Sign In to add comment