Guest User

miner

a guest
Oct 14th, 2014
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3.  
  4. local function dig()
  5.   for n = 1, 8 do
  6.       repeat until not turtle.digUp()
  7.       turtle.placeDown()
  8.       while not turtle.forward() do
  9.        turtle.dig()
  10.       end
  11.   end
  12. end
  13.  
  14. local function smartForward()
  15.   while not turtle.forward() do
  16.     if turtle.detect() then
  17.       turtle.dig()
  18.     elseif turtle.attack() then
  19.       print("Aggressive life forms detected!")
  20.     else
  21.       print("Impossible to move forward!")
  22.       return false
  23.     end
  24.   end
  25.   return false
  26. end
  27.  
  28. local function smartTorch()
  29.   while not turtle.place() do
  30.     if turtle.detect() then
  31.       turtle.dig()
  32.       y = math.floor(x / 8) - 1
  33.     end
  34.   end
  35. end
  36.      
  37.      
  38. local function torch()
  39.   turtle.placeDown()
  40.   turtle.select(16)
  41.   turtle.turnRight()
  42.   turtle.digUp()
  43.   turtle.dig()
  44.   smartTorch()
  45.   turtle.place()
  46.   turtle.turnLeft()
  47.   turtle.select(1)
  48. end
  49.  
  50. print("How Far?")
  51. x = read()
  52. y = math.floor(x / 8)
  53. w = math.floor(x / 2)
  54. while true do
  55.   for all = 1, y do
  56.  
  57.     smartForward()
  58.            
  59.     dig()
  60.  
  61.     torch()
  62.    
  63.   end
  64.  
  65.    turtle.turnLeft()
  66.    turtle.turnLeft()
  67.   for i = 1, w do
  68.     turtle.forward()
  69.     smartForward()
  70.   end
  71.   turtle.turnRight()
  72.   for z = 3, 14 do
  73.     turtle.select(y)
  74.     turtle.drop()
  75.   end
  76.  
  77.   turtle.turnLeft()
  78.   turtle.forward()
  79.   turtle.turnLeft()
  80.   turtle.forward()
  81.   turtle.forward()
  82.   turtle.forward()
  83.   turtle.turnLeft()
  84. end
Advertisement
Add Comment
Please, Sign In to add comment