Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- BaseBuilding Turtle
- -- Digs out rooms 16x16x4, with a staircase spiraling along the edges
- -- Should always be started at the top-left corner of the area to dig...
- -- No idea how I'm gonna get the stars to work, but the main part should be really easy
- local startZ = nil
- local startX = nil
- local startY = nil
- turtle.select(1)
- turtle.refuel()
- turtle.select(2)
- while(true) do
- for spacing=1,2 do
- for z=1,4 do
- if startZ then z = startZ startZ = nil end
- for x=1,16 do -- Same, always already in the first one
- if startX then x = startX startX = nil end
- for y=1,16 do -- We're always inside the first one
- if startY then y = startY startY = nil end
- turtle.dig()
- turtle.suck()
- turtle.forward()
- if not turtle.detectDown() and z == 4 then turtle.placeDown() end -- Make sure the floors are filled in
- if not turtle.detectUp() and z == 1 then turtle.placeUp() end -- And the ceilings, which are 1 below the floors
- end
- -- Reached the end on this side, turn (right/left)...
- if x < 16 then
- if x%2 == 1 then turtle.turnRight() else turtle.turnLeft() end
- turtle.dig()
- turtle.forward()
- if x%2 == 1 then turtle.turnRight() else turtle.turnLeft() end
- end
- -- Ready to iterate again
- end
- -- We've cleared out a 16x16 area on this level.
- -- And we are currently in the last block we broke...
- -- So the staircase is to our left. But, for everything except z==1
- -- We need to do a 180 and go to the opening
- if z > 1 then
- turtle.turnLeft()
- turtle.turnLeft()
- for i=2,z do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.forward() -- There should already be nothing there
- turtle.turnLeft()
- else
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- end
- -- Both situations leave us facing to where we need to dig and go down
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- turtle.down()
- if z < 4 then
- -- Figure out how to get back to our starting point.
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- for temp=1,z do -- We will be [z] blocks from the edge on this side
- turtle.dig()
- turtle.forward()
- end
- turtle.turnRight()
- -- And a full 16 blocks from the next edge
- for temp=1,16 do
- turtle.dig()
- turtle.forward()
- end
- turtle.turnRight() -- And it's ready to iterate again
- end
- end
- -- We have successfully dug 16x16x4
- -- And are on our stairwell area, on the 5th block into the stairwell
- -- Continue the stairwell down to 8
- for temp=5,8 do -- This works for both halves
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- turtle.down()
- end
- -- Get back to the starting position
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- -- We are on block 8 and want to be on block 1
- for temp=8,1,-1 do
- turtle.dig()
- turtle.forward()
- end
- turtle.turnRight()
- -- And we're ready to iterate again
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment