Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function turtleBuildTower(height)
- local directions = {1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 3, 1, 1, 4, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 3, 1, 1, 4, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 3, 1, 1, 4, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 3, 1, 1, 4, 1, 1, 10}
- local count = 0
- for _ in pairs(directions) do count = count + 1 end
- for i = 1, height do
- for i = 1, count do
- if directions[i] == 1 then
- addForward()
- else
- turnTurtle(directions[i])
- end
- end
- end
- end
- function addForward()
- local invi = checkInvi()
- while not turtle.forward() do
- turtle.dig()
- end
- while turtle.detectDown() do
- turtle.digDown()
- end
- if invi ~= false then
- turtle.select(invi)
- turtle.placeDown()
- else
- while not turtle.placeDown() do
- print(turtle.placeDown())
- end
- end
- end
- function turnTurtle(turn)
- if turn == 2 then
- turtle.turnLeft()
- while not turtle.forward() do
- turtle.dig()
- end
- turtle.turnRight()
- elseif turn == 3 then
- while not turtle.forward() do
- turtle.dig()
- end
- turtle.turnLeft()
- elseif turn == 4 then
- turtle.turnRight()
- while not turtle.forward() do
- turtle.dig()
- end
- turtle.turnLeft()
- elseif turn == 10 then
- turtle.turnRight()
- while not turtle.forward() do
- turtle.dig()
- end
- turtle.turnLeft()
- while not turtle.up() do
- turtle.digUp()
- end
- end
- end
- function checkInvi()
- for i = 1,16 do
- turtle.getItemCount(i)
- if turtle.getItemCount(i) > 0 then
- return i
- else
- return false
- end
- end
- end
- turtleBuildTower(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement