Advertisement
rabidfungi

Dig Shaft

Jul 18th, 2025 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | Gaming | 0 0
  1. --Dig Shaft
  2.  
  3. -- Dig 1x3 Function digIt
  4. function digIt()
  5.     while turtle.detect() do
  6.       turtle.dig()
  7.       os.sleep(0.5)
  8.     end
  9.     turtle.forward()
  10.     while turtle.detectDown() or turtle.detectUp() do
  11.       turtle.digUp()
  12.       turtle.digDown()
  13.     end
  14.   end
  15.  
  16.   -- Place torch behind
  17.   function placeTorch()
  18.     turtle.down()
  19.     turtle.back()
  20.     turtle.right()
  21.     turtle.right()
  22.     turtle.select(16)
  23.     turtle.placeForward()
  24.     turtle.right()
  25.     turtle.right()
  26.     turtle.forward()
  27.     turtle.up()
  28.   end
  29.  
  30.   --set everything to 0
  31.   local run = 0
  32.   local y = 0
  33.   local z = 0
  34.  
  35.   --Enter length
  36.   term.write("Branch length: ")
  37.   run = read()
  38.  
  39.   for x = 1, run do
  40.     y = x - 1
  41.     z = y % 10
  42.     if z == 1 then
  43.       placeTorch()
  44.     end
  45.     digIt()
  46.   end
  47.  
  48.   -- Place final torch mid wall
  49.   turtle.down()
  50.   turtle.turnRight()
  51.   turtle.turnRight()
  52.   turtle.select(16)
  53.   turtle.placeUp()
  54.  
  55.   --Return to start
  56.   for x = 1, run do
  57.     turtle.forward()
  58.   end
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement