Advertisement
BlueMarble

Lua CC Simple 2x2 Shaft Down

Jul 28th, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.63 KB | None | 0 0
  1. function slab()
  2.     for i = 0, 3, 1 do
  3.         turtle.turnRight()
  4.         turtle.dig()
  5.         turtle.place()
  6.         turtle.turnLeft()
  7.         turtle.dig()
  8.         turtle.forward()
  9.         turtle.turnRight()
  10.         turtle.dig()
  11.         turtle.place()
  12.         turtle.turnLeft()
  13.         turtle.turnLeft()
  14.     end
  15. end
  16. function update()
  17.     shell.run("pastebin" "get" "YhK59cm5" "blockCheck")
  18.     shell.run("pastebin" "get" "2EkpdDpX" "fuelCheck")
  19. end
  20. function clearCurs()
  21.     term.clear()
  22.     term.setCursorPos(1,1)
  23. end
  24. function doubleCheck()
  25.     shell.run("blockCheck")
  26.     shell.run("fuelCheck")
  27.     turtle.select(1)
  28. end
  29. update()
  30. clearCurs()
  31. print("How deep do you want the shaft to be?")
  32. y = tonumber(read())
  33. clearCurs()
  34. print("Depth goal: "..y)
  35. tbu = 0
  36. for i = 1, 16, 1 do
  37.     turtle.select(i)
  38.     if turtle.compareTo(1) then
  39.         tbu = tbu + turtle.getItemCount()
  40.     end
  41. end
  42. print("Total amount of usable blocks: "..tbu)
  43. print("Maximum amount of blocks to be used: "..(8*y)+4)
  44. print("Calculated amount of fuel to be used: "..((y*5)+(y-1)))
  45. sleep(1)
  46. f = turtle.getFuelLevel()
  47. doubleCheck()
  48. for i = 1, y, 1 do
  49.     turtle.digDown()
  50.     turtle.down()
  51.     slab()
  52.     if (i % 3 == 0) then
  53.         doubleCheck()
  54.     end
  55.     term.clear()
  56.     print("Depth goal: "..y)
  57.     print("Remaining: "..(y - (i-1)))
  58. end
  59. for i = 0, 3, 1 do
  60.     turtle.forward()
  61.     turtle.digDown()
  62.     turtle.placeDown()
  63.     turtle.turnLeft()
  64. end
  65. for i = 1, y, 1 do
  66.     while turtle.detectUp() do
  67.         turtle.digUp()
  68.         sleep(1.5) 
  69.     end
  70.     turtle.up()
  71. end
  72. turtle.turnRight()
  73. turtle.turnRight()
  74. turtle.placeDown()
  75. for i = 1, 16, 1 do
  76.     turtle.select(i)
  77.     turtle.drop()
  78. end
  79. l = turtle.getFuelLevel()
  80. tfu = f - l
  81. print("Total fuel used: "..tfu)
  82. print("Total fuel left: "..l)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement