Advertisement
TinaTheDerpy

tunnel

Sep 10th, 2023
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | Gaming | 0 0
  1. local x = 1
  2.  
  3. function df()     -- Dig forward on block
  4.    turtle.dig()
  5.    turtle.forward()
  6.    turtle.digUp()
  7.    turtle.digDown()
  8. end
  9.  
  10. function line()   -- Dig a line x blocks long
  11.    for i = 1,x do
  12.       df()
  13.    end
  14. end
  15.  
  16. function leftAround()   --turn around to the left
  17.    turtle.turnLeft()
  18.    df()
  19.    turtle.turnLeft()
  20. end
  21.  
  22. function rightAround()    --turn around to the right
  23.    turtle.turnRight()
  24.    df()
  25.    turtle.turnRight()
  26. end
  27.  
  28. function reverse()        --does a full 180 in the same block
  29.    turtle.turnLeft()
  30.    turtle.turnLeft()
  31. end
  32.  
  33. function layer()      --digs a plane 3 blocks wide
  34.    line()
  35.    leftAround()
  36.    line()
  37.    rightAround()
  38.    line()
  39. end
  40.  
  41. function round()     --moves one layer down and does a 180
  42.    turtle.down()
  43.    reverse()
  44. end
  45.  
  46.  
  47. -- Main Function --
  48.  
  49. term.write("Depth = ")  --gets x from the user
  50. x = tonumber(read())
  51.  
  52. layer()                 --hard coded tunnel
  53.  
  54. round()
  55. for i = 1,x do           --returns to the beginning of the tunnel
  56.    turtle.forward()
  57. end
  58. turtle.turnLeft()
  59. turtle.forward()
  60. turtle.turnRight()
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement