Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- layer = 1
- line = 1
- torch = 1
- room = 0
- function fuel()
- if turtle.getFuelLevel() < 250 then
- turtle.digUp()
- turtle.select(13)
- turtle.placeUp()
- turtle.select(12)
- turtle.dropDown()
- turtle.suckUp()
- turtle.refuel()
- turtle.suckDown()
- turtle.select(13)
- turtle.digUp()
- turtle.select(1)
- end
- end
- function drop()
- turtle.digUp()
- turtle.select(14)
- turtle.placeUp()
- for i = 1,12 do
- turtle.select(i)
- turtle.dropUp()
- end
- turtle.select(14)
- turtle.digUp()
- turtle.select(1)
- end
- function inv()
- for i = 1,12 do
- if turtle.getItemCount(i) == 0 then
- room = room + 1
- end
- end
- if room == 0 then
- drop()
- else room = 0
- end
- end
- function forward()
- while not turtle.forward() do
- inv()
- if not turtle.dig() then
- turtle.attack()
- end
- end
- end
- function up()
- while not turtle.up() do
- inv()
- turtle.digUp()
- end
- end
- function down()
- while not turtle.down() do
- inv()
- turtle.digDown()
- end
- end
- function updown()
- inv()
- turtle.digUp()
- inv()
- turtle.digDown()
- end
- function left()
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- updown()
- end
- function right()
- turtle.turnRight()
- forward()
- turtle.turnRight()
- updown()
- end
- function deployAnchor()
- forward()
- inv()
- turtle.digDown()
- turtle.select(15)
- turtle.placeDown()
- turtle.select(1)
- right()
- forward()
- updown()
- end
- function grabAnchor()
- turtle.select(15)
- inv()
- turtle.digDown()
- turtle.select(1)
- end
- function placeTorch()
- down()
- if turtle.detectDown() then
- up()
- turtle.select(16)
- turtle.placeDown()
- turtle.select(1)
- else
- up()
- end
- end
- function goStart()
- for i = 1,2 do
- turtle.turnLeft()
- for i = 1,6 do
- forward()
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- if layer == 1 then
- grabAnchor()
- end
- end
- function row()
- for i = 1,6 do
- forward()
- updown()
- torch = torch + 1
- if torch == 4 and line == 4 and layer == 1 then
- placeTorch()
- end
- end
- torch = 1
- if line == 1 and layer == 1 then
- deployAnchor()
- line = line + 1
- elseif line < 7 then
- if (line % 2) == 0 then
- left()
- line = line + 1
- else
- right()
- line = line + 1
- end
- else
- goStart()
- line = 1
- end
- end
- function chunck()
- for i = 1,7 do
- row()
- end
- layer = layer + 1
- end
- function layerUp()
- for i = 1,3 do
- up()
- end
- inv()
- turtle.digUp()
- end
- while true do
- fuel()
- while layer ~= 4 do
- chunck()
- if layer ~= 4 then
- layerUp()
- else
- inv()
- turtle.digUp()
- for i = 1,7 do
- forward()
- end
- for i = 1,6 do
- down()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment