Advertisement
Guest User

replant.lua

a guest
Feb 26th, 2020
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. --declare vars
  2. x=0
  3. z=0
  4. args = {...}
  5. x =9* tonumber(args[1])
  6. z= 5
  7. h = 1+ tonumber(args[2])
  8. canCont = true
  9.  
  10. --this function checks the slot in use for item count
  11. function restock()
  12.  
  13. for sl=1,15 do
  14. turtle.select(1)
  15. --if the count is less than 5 then it asks each slot 2 to 15 to give it blocks up to 64
  16. if turtle.getItemCount() < 5 then
  17. turtle.select(sl)
  18. turtle.transferTo(1)
  19. else end
  20. end
  21.  
  22. --if it is still less than 5 it accesses its ender chest (slot 16) to refuel the entire turtle
  23. turtle.select(1)
  24. if turtle.getItemCount() < 5 then
  25.  
  26. --places ender chest and fills first slot
  27. turtle.select(16)
  28. turtle.place()
  29. turtle.select(1)
  30. turtle.suck(64-turtle.getItemCount())
  31. -- pulls out 14 stacks filling up the rest
  32. for i=1,14 do
  33. turtle.suck(64)
  34. end
  35. turtle.select(16)
  36. turtle.dig()
  37. turtle.select(1)
  38. end
  39.  
  40.  
  41. end
  42.  
  43. function platform()
  44. for i=1,x do
  45. restock()
  46.  
  47. for o=1,z do
  48.  
  49. turtle.placeDown()
  50. if o~=z then turtle.forward() end
  51. end
  52. if math.fmod(i,2) == 1 and i~=x then turtle.turnRight() turtle.forward() turtle.turnRight()
  53. elseif i~=x then turtle.turnLeft() turtle.forward() turtle.turnLeft()
  54. else
  55. end
  56. end
  57. end
  58.  
  59.  
  60. function goDown()
  61. turtle.forward()
  62. for i=1,h do
  63.  
  64. if turtle.down() then
  65.  
  66. else
  67. canCont = false
  68. end
  69.  
  70. end
  71.  
  72. turtle.turnLeft()
  73. turtle.turnLeft()
  74. turtle.forward()
  75.  
  76. end
  77.  
  78.  
  79. repeat
  80.  
  81. platform()
  82. goDown()
  83.  
  84.  
  85.  
  86. until canCont == false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement