Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. ------------------------------------------------------------------------------
  2. -- Inventory library for computercraft's turtles by Hea3veN
  3. -- Version 0.1
  4. ------------------------------------------------------------------------------
  5. function dropInventoryUp()
  6. statusSetMsg("Dropping all collected blocks")
  7.  
  8. while turtle.detectUp() do
  9. turtle.digUp()
  10. end
  11. turtle.select(2)
  12. turtle.placeUp()
  13. for i=3,16 do
  14. turtle.select(i)
  15. local first = true
  16. while not turtle.dropUp() do
  17. if first then
  18. print("Could not place the items in the chest, waiting for space.")
  19. end
  20. os.sleep(1)
  21. end
  22. end
  23. turtle.select(2)
  24. turtle.digUp()
  25. end
  26.  
  27. function dropInventoryDown()
  28. statusSetMsg("Dropping all collected blocks")
  29.  
  30. while turtle.detectDown() do
  31. turtle.digDown()
  32. end
  33. turtle.select(2)
  34. turtle.placeDown()
  35. for i=3,16 do
  36. turtle.select(i)
  37. local first = true
  38. while not turtle.dropDown() do
  39. if first then
  40. print("Could not place the items in the chest, waiting for space.")
  41. end
  42. os.sleep(1)
  43. end
  44. end
  45. turtle.select(2)
  46. turtle.digDown()
  47. end
  48.  
  49. function inventoryDropState()
  50. turtle.select(2)
  51. while turtle.detectUp() do
  52. if not turtle.digUp() then
  53. return 'end'
  54. end
  55. end
  56. while not turtle.placeUp() do
  57. turtle.attackUp()
  58. os.sleep(0.3)
  59. end
  60. for i=3,16 do
  61. turtle.select(i)
  62. local first = true
  63. while not turtle.dropUp() do
  64. if first then
  65. print("Could not place the items in the chest, waiting for space.")
  66. end
  67. os.sleep(1)
  68. end
  69.  
  70. end
  71. turtle.select(2)
  72. turtle.digUp()
  73.  
  74. return statusGetProgData().nextState
  75. end
  76.  
  77.  
  78. function inventoryIsFull()
  79. for i=3, 16 do
  80. if turtle.getItemCount(i) == 0 then
  81. return false
  82. end
  83. end
  84. return true
  85. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement