Advertisement
SythsGod

3x3 Grid Miner

Feb 15th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 0 0
  1. -- Made and Coded By SythsGod
  2.    
  3. function detect()
  4.     local inFront = turtle.detect()
  5.  
  6.     if inFront then
  7.         turtle.dig()
  8.     end
  9. end
  10.  
  11. function mineStartUp()
  12.     turtle.select(1)
  13.     detect()
  14.     turtle.forward()
  15. end
  16.  
  17. function detectUp()
  18.     local onTop = turtle.detectUp()
  19.  
  20.     if onTop then
  21.         turtle.digUp()
  22.         turtle.up()
  23.     end
  24. end
  25.  
  26. function detectDown()
  27.     local onBottom = turtle.detectDown()
  28.    
  29.     if onBottom then
  30.         turtle.digDown()
  31.         turtle.down()
  32.     end
  33. end
  34.  
  35. function digging()
  36.     turtle.turnLeft()
  37.     detect()
  38.     turtle.turnRight()
  39.     turtle.turnRight()
  40.     detect()
  41.     detectUp()
  42.     turtle.up()
  43.     detect()
  44.     turtle.turnLeft()
  45.     turtle.turnLeft()
  46.     detect()
  47.     turtle.down()
  48.     detectDown()
  49.     turtle.down()
  50.     detect()
  51.     turtle.turnRight()
  52.     turtle.turnRight()
  53.     detect()
  54.     turtle.turnLeft()
  55.     turtle.up()
  56. end
  57.  
  58. function moveToNextGridSection()
  59.     detect()
  60.     turtle.forward()
  61. end
  62.  
  63. function autoStore()
  64.    
  65.  
  66. print "How far?"
  67. local _Amount = tonumber(io.read())
  68. print "Should I place a torch? (Y/N)"
  69. local _TorchTime = io.read()
  70.  
  71. mineStartUp()
  72.  
  73. local _Counter = 0
  74.  
  75. for i = 1, _Amount do
  76.     digging()
  77.  
  78.     _Counter = _Counter + 1
  79.    
  80.     if _TorchTime == "Y" then
  81.         _TimeForATorch = true
  82.     else
  83.         _TimeForATorch = false
  84.     end
  85.    
  86.     if _Counter == 5 then
  87.         turtle.select(16)
  88.         turtle.placeDown()
  89.         print "Torch Placed!"
  90.         turtle.select(1)
  91.     end
  92.    
  93.     local
  94.  
  95.     moveToNextGridSection()
  96. end
  97.  
  98. turtle.turnLeft()
  99. turtle.turnLeft()
  100.  
  101. for b = 1, _Amount do
  102.     turtle.forward()
  103. end
  104.  
  105. turtle.forward()
  106.  
  107. turtle.turnRight()
  108. turtle.turnRight()
  109.  
  110. print "Finished!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement