Advertisement
Guest User

clearLand

a guest
Aug 22nd, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.91 KB | None | 0 0
  1. local fuelSlot = 1
  2. local depth = 190
  3. local width = 150
  4. local height = 9
  5. local success = false
  6.  
  7. function checkFuel(slot)
  8.   while turtle.getFuelLevel() == 0 do
  9.     turtle.select(fuelSlot)
  10.   if turtle.getItemCount(fuelSlot) == 0 then
  11.    fuelSlot = fuelSlot + 1
  12.  end
  13.  if fuelSlot == 16 then
  14.       term.clear()
  15.       print("Fuel slot ("..fuelSlot..") is empty....")
  16.       print("Insert Fuel and")
  17.       print("Press any key to continue...")
  18.       os.pullEvent("key")
  19.    fuelSlot = 1
  20.   end
  21.     turtle.refuel(1)
  22.   end
  23.   term.clear()
  24.   print("Fuel OK!")
  25. end
  26. function digForward(distance)
  27.   for i = 1, distance, 1 do
  28.     turtle.dig()
  29.     checkFuel(fuelSlot)
  30.     while turtle.forward() == false do
  31.       term.clear()
  32.       print("Clear obstruction...")
  33.    turtle.dig()
  34.     end
  35.   turtle.turnRight()
  36.   turtle.select(16)
  37.   turtle.place()
  38.   turtle.turnLeft()
  39.   end
  40. end
  41. function moveBack(distance)
  42.   for i = 1, distance, 1 do
  43.     checkFuel(fuelSlot)
  44.  if turtle.back() == false then
  45.       term.clear()
  46.       print("Clear obstruction...")
  47.    turtle.turnRight()
  48.    turtle.turnRight()
  49.    digForward(1)
  50.    turtle.turnRight()
  51.    turtle.turnRight()
  52.     end
  53.   end
  54. end
  55. function moveUp(distance)
  56.   for i = 1, distance, 1 do
  57.     checkFuel(fuelSlot)
  58.     while turtle.up() == false do
  59.       term.clear()
  60.       print("Clear obstruction...")
  61.    turtle.digUp()
  62.     end
  63.   end
  64. end
  65. function moveDown(distance)
  66.   for i = 1, distance, 1 do
  67.     checkFuel(fuelSlot)
  68.     while turtle.down() == false do
  69.       term.clear()
  70.       print("Clear obstruction...")
  71.    turtle.digDown()
  72.     end
  73.   end
  74. end
  75.  
  76. --start program
  77.  
  78. for a = 1, width, 1 do
  79.   for b = 1, height, 1 do
  80.     digForward(depth+1)
  81.     term.clear()
  82.     print(a * 100 / width .. "% Complete...")
  83.     moveBack(depth+1)
  84.     moveUp(1)
  85.   end
  86.   moveDown(height)
  87.   turtle.turnRight()
  88.   digForward(1)
  89.   turtle.turnLeft()
  90.   term.clear()
  91.   print(a * 100 / width .. "% Complete...")
  92. end
  93. turtle.turnLeft()
  94. digForward(width)
  95. turtle.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement