Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local length = 61
- local width = 61
- local function refuel()
- if turtle.getFuelLevel() < 50 then
- local prev = turtle.getSelectedSlot()
- turtle.select(1)
- if not turtle.refuel(4) then
- print('Need more fuel')
- while not turtle.refuel(4) do
- sleep(3)
- end
- end
- turtle.select(prev)
- end
- end
- local function tryBackwards()
- refuel()
- turtle.back()
- end
- local function advance()
- if turtle.getSelectedSlot() == 16 then
- print('Need more materials')
- local empty = true
- while empty do
- for n=2, 16 do
- print (n)
- if turtle.getItemCount(n) > 0 then
- empty = false
- turtle.select(n)
- return
- end
- end
- sleep(3)
- end
- else
- turtle.select(turtle.getSelectedSlot() + 1)
- end
- end
- local function placeBlock()
- for i = 0, 2, 1 do
- if not turtle.place() or turtle.getItemCount() == 0 then
- while turtle.getItemCount() == 0 do
- advance()
- end
- end
- end
- end
- local function turnAround(i)
- if i%2 == 1 then
- turtle.turnRight()
- tryBackwards()
- placeBlock()
- turtle.turnRight()
- else
- turtle.turnLeft()
- tryBackwards()
- placeBlock()
- turtle.turnLeft()
- end
- end
- turtle.select(2)
- for i = 1, length, 1 do
- for j = 1, width-1, 1 do
- refuel()
- tryBackwards()
- placeBlock()
- end
- turnAround(i)
- end
Advertisement
Add Comment
Please, Sign In to add comment