Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Turtle.digCorridor = function(length, height, width)
- b = 1
- if height > 2 then
- Turtle.up(true)
- b = 2
- end
- atLeft = true
- for c = 1, length do
- if width > 1 then
- if atLeft then
- Turtle.turnRight()
- else
- Turtle.turnLeft()
- end
- end
- repeat
- restHeight = height - b
- for a = 1, width - 1 do
- if restHeight >= 1 then
- Turtle.digHelperTri1()
- else
- Turtle.digHelperTri2()
- end
- Turtle.forward()
- end
- atLeft = not atLeft
- Turtle.digDown() --- fix for height < 3
- Turtle.digUp(true)--- fix for height < 3
- diff = 0
- if restHeight > 2 then
- diff = 3
- elseif restheight == 2 then
- diff = 2
- end
- if diff > 0 then
- if c % 2 == 1 then
- Turtle.up(diff)
- b = b + diff
- else
- Turtle.down(diff)
- b = b - diff
- end
- end
- if width > 1 then
- Turtle.turnAround()
- end
- until restHeight <= 1
- if atLeft then
- Turtle.turnLeft()
- else
- Turtle.turnRight()
- end
- Turtle.forward(true)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement