Advertisement
Helium

automated fell

Apr 22nd, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. -- user input
  2.  
  3. inputarg = {...}
  4. if inputarg[1] == "" then
  5.     print "Please enter a valid argument"
  6. end
  7.  
  8. cycle = inputarg[1]
  9.  
  10. -- Actions
  11.  
  12. function start()
  13.     turtle.dig()
  14.     turtle.forward()
  15. end
  16.  
  17. function column()
  18.     while turtle.digUp() do
  19.         turtle.dig()
  20.         turtle.up()
  21.     end
  22.     while not turtle.detectDown() do
  23.         turtle.down()
  24.     end
  25. end
  26.  
  27. function switch()
  28.     turtle.turnRight()
  29.     turtle.dig()
  30.     turtle.forward()
  31.     turtle.turnLeft()
  32. end
  33.  
  34. function replant()
  35.     turtle.forward()
  36.     turtle.select(15)
  37.     turtle.place()
  38.     turtle.back()
  39.     turtle.place()
  40.     turtle.turnLeft()
  41.     turtle.forward()
  42.     turtle.turnRight()
  43.     turtle.forward()
  44.     turtle.place()
  45.     turtle.back()
  46.     turtle.place()
  47. end
  48.  
  49. function grow()
  50.     turtle.select(16)
  51.     while turtle.place() ~= false do
  52.         turtle.place()
  53.         sleep(1)
  54.     end
  55. end
  56.  
  57. -- Chest operations
  58.  
  59. function dump()
  60.     turtle.turnLeft()
  61.     turtle.turnLeft()
  62.     for slots = 1,14 do
  63.         turtle.select(slots)
  64.         turtle.drop()
  65.     end
  66.     turtle.turnRight()
  67.     turtle.turnRight()
  68. end
  69.  
  70. -- main
  71.  
  72. function cutdown()
  73.     start()
  74.     column()
  75.     switch()
  76.     column()
  77.     turtle.back()
  78. end
  79.  
  80. function process()
  81.     replant()
  82.     dump()
  83.     grow()
  84. end
  85.    
  86. function cycleFull()
  87.     cutdown()
  88.     process()
  89. end
  90.  
  91. -- operated
  92.  
  93. print "\n\nOperation started"
  94.  
  95. for re = 1, cycle do
  96.     cycleFull()
  97. end
  98. print "Operation Complete"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement