Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xMoved = 0
- zMoved = 0
- dir = 0
- turn = false
- function mob()
- while turtle.attack() do
- turtle.sleep(0.2)
- end
- end
- function w()
- while turtle.detect() do
- turtle.dig()
- end
- while not turtle.detect() and not turtle.forward() do
- turtle.attack()
- end
- turtle.digUp()
- if dir == 0 then
- xMoved = xMoved + 1
- elseif dir == 1 then
- zMoved = zMoved + 1
- elseif dir == 2 then
- xMoved = xMoved - 1
- else zMoved = zMoved - 1
- end
- end
- function a()
- turtle.turnLeft()
- if dir == 0 then
- dir = 3
- elseif dir == 1 then
- dir = 0
- elseif dir == 2 then
- dir = 1
- else dir = 2
- end
- end
- function d()
- turtle.turnRight()
- if dir == 0 then
- dir = 1
- elseif dir == 1 then
- dir = 2
- elseif dir == 2 then
- dir = 3
- else dir = 0
- end
- end
- function home()
- if (zMoved < 0) then
- turn = true
- while not (dir == 1) do
- d()
- end
- while (zMoved < 0) do
- w()
- end
- elseif (zMoved > 0) then
- turn = true
- while not (dir == 3) do
- turtle.up()
- a()
- end
- while (zMoved > 0) do
- w()
- end
- end
- if (xMoved < 0) then
- turn = true
- while not (dir == 0) do
- a()
- end
- while (xMoved < 0) do
- w()
- end
- elseif (xMoved > 0) then
- turn = true
- while not (dir == 2) do
- d()
- end
- while (xMoved > 0) do
- w()
- end
- end
- if turn == true then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- function pos()
- w()
- w()
- w()
- end
- function strip()
- if turtle.detect() == false then
- a()
- w()
- w()
- w()
- d()
- strip()
- end
- end
- function mine()
- w()
- w()
- w()
- d()
- w()
- w()
- d()
- d()
- w()
- w()
- d()
- if turtle.getFuelLevel() == 0 then
- getFuel()
- turtle.select(16)
- turtle.refuel()
- end
- end
- function session()
- i = 0
- while i < 10 do
- i = i+1
- mine()
- turtle.select(16)
- turtle.refuel(4)
- end
- getFuel()
- dropItems()
- end
- function dropItems()
- while turtle.detectUp() do
- turtle.digUp()
- end
- turtle.select(2)
- turtle.placeUp()
- turtle.select(3)
- turtle.dropUp()
- turtle.select(4)
- turtle.dropUp()
- turtle.select(5)
- turtle.dropUp()
- turtle.select(6)
- turtle.dropUp()
- turtle.select(7)
- turtle.dropUp()
- turtle.select(8)
- turtle.dropUp()
- turtle.select(9)
- turtle.dropUp()
- turtle.select(10)
- turtle.dropUp()
- turtle.select(11)
- turtle.dropUp()
- turtle.select(12)
- turtle.dropUp()
- turtle.select(13)
- turtle.dropUp()
- turtle.select(14)
- turtle.dropUp()
- turtle.select(15)
- turtle.dropUp()
- turtle.select(2)
- turtle.digUp()
- end
- function getFuel()
- while turtle.detectUp() do
- turtle.digUp()
- end
- turtle.select(1)
- turtle.placeUp()
- turtle.select(16)
- turtle.suckUp(turtle.getItemSpace(16))
- turtle.digUp()
- if turtle.getItemSpace(16) > 32 then
- home()
- error()
- end
- end
- function plan1()
- getFuel()
- pos()
- strip()
- session()
- session()
- home()
- end
- plan1()
- plan1()
- plan1()
- --pos()
- --strip()
- --session()
- --home()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement