ravneravn

serum filler

Nov 18th, 2013
61
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. p = peripheral.wrap("front")
  2. t = peripheral.wrap("top")
  3. rednet.open("right")
  4.  
  5. function checkChest()
  6. t.condense()
  7. data = t.getStackInSlot(0)
  8. if data then
  9. turtle.select(1)
  10. turtle.suckUp(1)
  11. turtle.drop()
  12. checkSerum()
  13. end
  14. end
  15.  
  16. function pullSerum()
  17. turtle.select(1)
  18. turtle.suck()
  19. turtle.turnRight()
  20. turtle.turnRight()
  21. turtle.drop()
  22. rednet.send(puller, "serum")
  23. turtle.turnRight()
  24. turtle.turnRight()
  25. end
  26.  
  27. function checkSerum()
  28. data = p.getStackInSlot(2)
  29. if data then
  30. while data.dmg ~= 0 do
  31. sleep(5)
  32. data = p.getStackInSlot(2)
  33. print(data.dmg)
  34. end
  35. pullSerum()
  36. end
  37. end
  38.  
  39. --------------
  40. while true do
  41. event, sid, mes, dis = os.pullEvent("rednet_message")
  42. if mes == "id" then
  43. puller = sid
  44. print(puller)
  45. break
  46. end
  47. end
  48.  
  49. while true do
  50. checkChest()
  51. sleep(5)
  52. end
RAW Paste Data