Guest User

miner

a guest
Oct 14th, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.18 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3.  
  4. local function dig()
  5.   turtle.dig()    --1
  6.   turtle.digUp()
  7.   turtle.placeDown()
  8.   turtle.forward()
  9.   turtle.digUp()
  10.   turtle.placeDown()
  11.   turtle.dig()   --2
  12.   turtle.digUp()
  13.   turtle.placeDown()
  14.   turtle.forward()
  15.   turtle.digUp()
  16.   turtle.placeDown()
  17.   turtle.dig()   --3
  18.   turtle.digUp()
  19.   turtle.placeDown()
  20.   turtle.forward()
  21.   turtle.digUp()
  22.   turtle.placeDown()
  23.   turtle.dig()   --4
  24.   turtle.digUp()
  25.   turtle.placeDown()
  26.   turtle.forward()
  27.   turtle.digUp()
  28.   turtle.placeDown()
  29.   turtle.dig()   --5
  30.   turtle.digUp()
  31.   turtle.placeDown()
  32.   turtle.forward()
  33.   turtle.digUp()
  34.   turtle.placeDown()
  35.   turtle.dig()   --6
  36.   turtle.digUp()
  37.   turtle.placeDown()
  38.   turtle.forward()
  39.   turtle.digUp()
  40.   turtle.placeDown()
  41.   turtle.dig()   --7
  42.   turtle.digUp()
  43.   turtle.placeDown()
  44.   turtle.forward()
  45.   turtle.digUp()
  46.   turtle.placeDown()
  47.   turtle.dig()   --8
  48.   turtle.digUp()
  49.   turtle.placeDown()
  50.   turtle.forward()
  51.   turtle.digUp()
  52.   turtle.placeDown()
  53. end
  54.  
  55. local function smartForward()
  56.   while not turtle.forward() do
  57.     if turtle.detect() then
  58.       turtle.dig()
  59.     elseif turtle.attack() then
  60.       print("Aggressive life forms detected!")
  61.     else
  62.       print("Impossible to move forward!")
  63.       return false
  64.     end
  65.   end
  66.   return false
  67. end
  68.  
  69. local function smartTorch()
  70.   while not turtle.place() do
  71.     if turtle.detect() then
  72.       turtle.dig()
  73.       y = x % 8 - 1
  74.     end
  75.   end
  76. end
  77.      
  78.      
  79. local function torch()
  80.   turtle.select(16)
  81.   turtle.turnRight()
  82.   turtle.digUp()
  83.   turtle.dig()
  84.   smartTorch()
  85.   turtle.place()
  86.   turtle.turnLeft()
  87.   turtle.select(1)
  88. end
  89.  
  90. print("How Far?")
  91. x = read()
  92. y = x % 8
  93. while true do
  94.   for all = 1, y do
  95.  
  96.     smartForward()
  97.    
  98.     torch()
  99.    
  100.     dig()
  101.    
  102.     torch()
  103.    
  104.   end
  105.  
  106.    turtle.turnLeft()
  107.    turtle.turnLeft()
  108.   for i = 1, x*0.50 do
  109.     turtle.forward()
  110.     smartForward()
  111.   end
  112.   turtle.turnRight()
  113.   for z = 3, 14 do
  114.     turtle.select(y)
  115.     turtle.drop()
  116.   end
  117.  
  118.   turtle.turnLeft()
  119.   turtle.forward()
  120.   turtle.turnLeft()
  121.   turtle.forward()
  122.   turtle.forward()
  123.   turtle.forward()
  124.   turtle.turnLeft()
  125. end
Advertisement
Add Comment
Please, Sign In to add comment