Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- build(10)
- function build(size)
- while true do
- placeLevel(size)
- turtle.up()
- turtle.up()
- turtle.up()
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- function placeLevel(size)
- local right = true
- for i = 0, size do
- line(size, endTurn(right))
- right = not right
- end
- end
- function endTurn(right)
- if right then
- return function()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- end
- else
- return function()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- end
- function line(size, last)
- for i = 0, size-1 do
- placeAnd(turtle.forward)
- end
- placeAnd(last)
- end
- function placeAnd(action)
- findBuildMaterial(4)
- turtle.placeDown()
- action()
- end
- function findBuildMaterial(id)
- local number = turtle.getSelectedSlot()
- local selected = turtle.getItemDetail(number)
- if selected.id == id and number > 0 then
- return
- end
- for i = id+1, 16 do
- selected = turtle.getItemDetail(i)
- local amount = turtle.getItemAmount(i)
- if selected.id == id then
- turtle.select(i)
- return
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement