Advertisement
Guest User

Mining

a guest
Dec 4th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. c = peripheral.wrap("right")
  2. function fwd()
  3.   while not turtle.forward() do
  4.     turtle.dig()
  5.     turtle.digDown()
  6.     end
  7.  end  
  8. function goBack()
  9.   while not turtle.forward() do
  10.     turtle.attack()
  11.     end
  12. end
  13.  
  14. function Drop()
  15.   turtle.down()
  16.   turtle.select(1)
  17.   turtle.drop()
  18.   turtle.select(2)
  19.   turtle.drop()
  20.   turtle.select(3)
  21.   turtle.drop()
  22.   turtle.select(4)
  23.   turtle.drop()
  24.   turtle.select(5)
  25.   turtle.drop()
  26.   turtle.select(6)
  27.   turtle.drop()
  28.   turtle.select(7)
  29.   turtle.drop()
  30.   turtle.select(8)
  31.   turtle.drop()
  32.   turtle.select(9)
  33.   turtle.drop()
  34.   turtle.select(10)
  35.   turtle.drop()
  36.   turtle.select(11)
  37.   turtle.drop()
  38.   turtle.select(12)
  39.   turtle.drop()
  40.   turtle.select(13)
  41.   turtle.drop()
  42.   turtle.select(14)
  43.   turtle.drop()
  44.   turtle.select(15)
  45.   turtle.drop()
  46.   turtle.select(16)
  47.   turtle.drop()
  48.   turtle.select(1)
  49.   turtle.up()
  50. end  
  51. --MainProgram:
  52.  
  53. term.write("How many blocks forward? :")
  54. blocks = read()
  55. term.write("How many times is it? : ")
  56. times = read()
  57. turtle.up()
  58. for i = 1, times do
  59.   for i = 1, blocks do
  60.      fwd()
  61.      turtle.digDown()
  62.   end
  63. turtle.turnRight()
  64. turtle.turnRight()
  65. for i = 1, blocks do
  66.   goBack()
  67.   end
  68.  
  69. Drop()
  70.  
  71. turtle.turnRight()
  72. turtle.forward()
  73. turtle.forward()
  74. turtle.forward()
  75. turtle.turnRight()
  76. end
  77. term.clear()
  78. term.setCursorPos(14,7)
  79. textutils.slowPrint("Completed!")
  80. c.say("Program: Mining Done!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement