M0n5t3r

ClearCube

Apr 19th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. -- Clears a x by y by z area
  2.  
  3. function refuel()
  4.         turtle.select(1)
  5.         turtle.refuel(64)
  6. end
  7.  
  8. function clear()
  9.         term.clear()
  10.         term.setCursorPos(1,1)
  11. end
  12.  
  13. function clearLine()
  14.         for i = 1, depth do
  15.                 turtle.dig()
  16.                 turtle.forward()
  17.         end
  18.        
  19.         for i = 1, depth do
  20.                 turtle.back()
  21.         end
  22. end
  23.  
  24. function clearWall()
  25.         for i = 1, height do
  26.                 turtle.digUp()
  27.                 clearLine()
  28.                 turtle.up()
  29.         end
  30.  
  31.         for i = 1, height do
  32.                 turtle.down()
  33.         end
  34. end
  35.  
  36. function clearCube()
  37.         for i = 1, width do
  38.                 clearWall()
  39.                 turtle.turnRight()
  40.                 turtle.dig()
  41.                 turtle.forward()
  42.                 turtle.turnLeft()
  43.         end
  44.  
  45.         turtle.turnLeft()
  46.  
  47.         for i = 1, width+1 do
  48.                 turtle.forward()
  49.         end
  50.  
  51.         turtle.turnRight()
  52. end
  53.                
  54.  
  55.  
  56. term.write("Insert depth: ")
  57. depth = tonumber(read())
  58. print(" ")
  59.  
  60. term.write("Insert width: ")
  61. width = tonumber(read())
  62. print(" ")
  63.  
  64. term.write("Insert height: ")
  65. height = tonumber(read())
  66. print(" ")
  67.  
  68. refuel()
  69. clearCube()
Add Comment
Please, Sign In to add comment