Advertisement
Spatzenhirn123

Excavate Room

Feb 9th, 2022 (edited)
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. local args = {...}
  2. height = args[1]
  3. width = args[2]
  4. length = args[3]
  5. --length step 2
  6. --hight step 3
  7.  
  8. local x=0
  9. local y=0
  10. local z=0
  11.  
  12. function dig()
  13.         while turtle.detect() do
  14.             turtle.dig()
  15.             os.sleep(0.5)
  16.         end
  17. end
  18. function digUp()
  19.         while turtle.detectUp() do
  20.             turtle.digUp()
  21.             os.sleep(0.5)
  22.         end
  23. end
  24. function up()
  25.         while turtle.up()==false do
  26.             turtle.digUp()
  27.             os.sleep(0.5)
  28.         end
  29. end
  30. function down()
  31.         while turtle.down()==false do
  32.             turtle.digDown()
  33.             os.sleep(0.5)
  34.         end
  35. end
  36. function forward()
  37.     while turtle.forward()==false do
  38.         os.sleep(1)
  39.         dig()
  40.     end
  41. end
  42. function clear()
  43.     dig()
  44.     forward()
  45.     digUp()
  46.     turtle.digDown()
  47. end
  48. -------------
  49. for x=1,length,1 do
  50.     z=0+height
  51.     while z>0 do
  52.         turtle.turnLeft()
  53.         for y=1,width-1,1 do
  54.             clear()
  55.         end
  56.         turtle.turnRight()
  57.         turtle.turnRight()
  58.         z=z-3
  59.         if z>0 then
  60.             up()
  61.             up()
  62.             up()
  63.             digUp()
  64.         end
  65.         for y=1,width-1,1 do
  66.             clear()
  67.         end
  68.         turtle.turnLeft()  
  69.         z=z-3  
  70.         if z>0 then
  71.             up()
  72.             up()
  73.             up()
  74.             digUp()
  75.         end
  76.     end
  77.     z=0+height-3
  78.     while z>0 do
  79.         down()
  80.         down()
  81.         down()
  82.         z=z-3
  83.     end
  84.     clear()
  85. end
  86.  
  87.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement