Dimencia

Untitled

Mar 22nd, 2021
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. -- BaseBuilding Turtle
  2.  
  3. -- Digs out rooms 16x16x4, with a staircase spiraling along the edges
  4. -- Should always be started at the top-left corner of the area to dig...
  5.  
  6. -- No idea how I'm gonna get the stars to work, but the main part should be really easy
  7.  
  8. local startZ = nil
  9. local startX = nil
  10. local startY = nil
  11.  
  12.  
  13. turtle.select(1)
  14. turtle.refuel()
  15. turtle.select(2)
  16.  
  17. while(true) do
  18. for spacing=1,2 do
  19. for z=1,4 do
  20. if startZ then z = startZ startZ = nil end
  21. for x=1,16 do -- Same, always already in the first one
  22. if startX then x = startX startX = nil end
  23. for y=1,16 do -- We're always inside the first one
  24. if startY then y = startY startY = nil end
  25. turtle.dig()
  26. turtle.suck()
  27. turtle.forward()
  28. if not turtle.detectDown() and z == 4 then turtle.placeDown() end -- Make sure the floors are filled in
  29. if not turtle.detectUp() and z == 1 then turtle.placeUp() end -- And the ceilings, which are 1 below the floors
  30. end
  31. -- Reached the end on this side, turn (right/left)...
  32. if x < 16 then
  33. if x%2 == 1 then turtle.turnRight() else turtle.turnLeft() end
  34. turtle.dig()
  35. turtle.forward()
  36. if x%2 == 1 then turtle.turnRight() else turtle.turnLeft() end
  37. end
  38. -- Ready to iterate again
  39. end
  40. -- We've cleared out a 16x16 area on this level.
  41. -- And we are currently in the last block we broke...
  42. -- So the staircase is to our left. But, for everything except z==1
  43. -- We need to do a 180 and go to the opening
  44. if z > 1 then
  45. turtle.turnLeft()
  46. turtle.turnLeft()
  47. for i=2,z do
  48. turtle.forward()
  49. end
  50. turtle.turnRight()
  51. turtle.forward() -- There should already be nothing there
  52. turtle.turnLeft()
  53. else
  54. turtle.turnLeft()
  55. turtle.dig()
  56. turtle.forward()
  57. turtle.turnLeft()
  58. end
  59. -- Both situations leave us facing to where we need to dig and go down
  60. turtle.dig()
  61. turtle.forward()
  62. turtle.digUp()
  63. turtle.digDown()
  64. turtle.down()
  65. if z < 4 then
  66. -- Figure out how to get back to our starting point.
  67. turtle.turnLeft()
  68. turtle.dig()
  69. turtle.forward()
  70. turtle.turnLeft()
  71. for temp=1,z do -- We will be [z] blocks from the edge on this side
  72. turtle.dig()
  73. turtle.forward()
  74. end
  75. turtle.turnRight()
  76. -- And a full 16 blocks from the next edge
  77. for temp=1,16 do
  78. turtle.dig()
  79. turtle.forward()
  80.  
  81. end
  82. turtle.turnRight() -- And it's ready to iterate again
  83. end
  84. end
  85. -- We have successfully dug 16x16x4
  86. -- And are on our stairwell area, on the 5th block into the stairwell
  87. -- Continue the stairwell down to 8
  88. for temp=5,8 do -- This works for both halves
  89. turtle.dig()
  90. turtle.forward()
  91. turtle.digUp()
  92. turtle.digDown()
  93. turtle.down()
  94. end
  95. -- Get back to the starting position
  96. turtle.turnLeft()
  97. turtle.dig()
  98. turtle.forward()
  99. turtle.turnLeft()
  100. -- We are on block 8 and want to be on block 1
  101. for temp=8,1,-1 do
  102. turtle.dig()
  103. turtle.forward()
  104. end
  105. turtle.turnRight()
  106. -- And we're ready to iterate again
  107. end
  108. end
Advertisement
Add Comment
Please, Sign In to add comment