akihex

starMakerMkII

Aug 24th, 2014
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local args = {...}
  2.  
  3. cAss = peripheral.wrap("bottom")
  4. storage = peripheral.wrap("back")
  5.  
  6. mon = peripheral.find("monitor")
  7.  
  8. cDir = "up"
  9. sDir = "north"
  10.  
  11. cPull = cAss.pullItem
  12. sPull = storage.pullItem
  13. t = turtle
  14. tIC = t.getItemCount
  15.  
  16. local start = os.day() * 24 + os.time()
  17. local now = start + 0.001
  18.  
  19. mon.clear()
  20.  
  21. local count = 0
  22. local amount = 0
  23. local n = 0
  24.  
  25. while true do
  26.   if tIC(1) == 0 then os.pullEvent("turtle_inventory") end
  27.   if tIC(1) == 1 then cPull(cDir,1,1)
  28.   else
  29.     amount = tIC(1)
  30.     count = count + amount
  31.     if n % 10 == 0 then
  32.       n = 1
  33.       mon.setCursorPos(1,1)
  34.       mon.clearLine()
  35.       mon.write(count / (os.day()*24 + os.time() - start))
  36.     else
  37.       n = n + 1
  38.     end  
  39.     sPull(sDir,1,amount - 1)
  40.     cPull(cDir,1,1)
  41.   end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment