feline-dis

Untitled

Jan 2nd, 2021 (edited)
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. local slotCount = 16
  2.  
  3. function init()
  4. if lookForChest() == false then return end
  5. while true do
  6. getItems()
  7. -- should have full inv of tiny dry rubber
  8. turnAround()
  9. arrangeItems()
  10. turtle.craft()
  11. turtle.select(1)
  12. local count = turtle.getItemCount()
  13. turtle.drop(count)
  14. turnAround()
  15. end
  16. end
  17.  
  18. function lookForChest()
  19. local success, item = turtle.inspect()
  20. local turns = 0
  21. while item == nil or item.name ~= 'quark:custom_chest' do
  22. if turns >= 4 then
  23. print('no chest around turtle')
  24. return false
  25. end
  26. print(turns)
  27. turtle.turnLeft()
  28. turns = turns + 1
  29. end
  30. return true
  31. end
  32.  
  33. function getItems() while (checkForAllFullStacks() == false) do turtle.suck() end end
  34.  
  35. function arrangeItems()
  36. turtle.select(4)
  37. turtle.transferTo(10)
  38. turtle.select(8)
  39. turtle.transferTo(11)
  40. end
  41.  
  42. function turnAround()
  43. turtle.turnLeft()
  44. turtle.turnLeft()
  45. end
  46.  
  47. function checkForAllFullStacks()
  48. local full = true
  49. for slot = 1, 9, 1 do
  50. local count = turtle.getItemCount(slot)
  51.  
  52. if count < 64 then full = false end
  53. end
  54. return full
  55. end
  56.  
  57. init()
  58.  
Add Comment
Please, Sign In to add comment