Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inPit = false
- loops = 1
- local function forward(count)
- if count == nil then count = 1 end
- for i = 1, count do
- turtle.forward()
- end
- end
- local function up(count)
- if count == nil then count = 1 end
- for i = 1, count do
- turtle.up()
- end
- end
- local function down(count)
- if count == nil then count = 1 end
- for i = 1, count do
- turtle.down()
- end
- end
- local function turnLeft(count)
- if count == nil then count = 1 end
- for i = 1, count do
- turtle.turnLeft()
- end
- end
- local function turnRight(count)
- if count == nil then count = 1 end
- for i = 1, count do
- turtle.turnRight()
- end
- end
- local function enterPit()
- forward(3)
- down()
- inPit = true
- return true
- end
- local function exitPit()
- turnLeft(2)
- up()
- forward(3)
- turnLeft(2)
- inPit = false
- return true
- end
- local function deposit()
- if inPit then
- exitPit()
- end
- turnLeft()
- turtle.up()
- forward(2)
- for i = 3,16 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.select(1)
- turnRight(2)
- forward(2)
- turtle.down()
- turnLeft()
- return true
- end
- local function refuel(count)
- if count == nil then count = 1 end
- function fuelUp()
- up()
- os.sleep(4)
- down()
- turtle.placeDown()
- turtle.refuel()
- end
- if inPit then
- exitPit()
- end
- deposit()
- forward()
- turnRight()
- turtle.select(2)
- turtle.place()
- turtle.select(1)
- turnLeft()
- forward(2)
- down()
- turtle.digDown()
- os.sleep(25)
- for i = 1, count do
- fuelUp()
- end
- exitPit()
- forward()
- turnRight()
- turtle.dig()
- turtle.select(3)
- turtle.transferTo(2)
- turnRight()
- forward()
- turnRight(2)
- return true
- end
- local function regen()
- if inPit then
- exitPit()
- end
- forward()
- turnRight()
- turtle.select(2)
- turtle.place()
- turtle.select(1)
- os.sleep(25)
- turtle.dig()
- turnRight()
- forward()
- turnRight(2)
- end
- local function digLoopOnce()
- function turnCorner()
- forward()
- turnRight()
- forward()
- end
- turtle.digDown()
- turnLeft()
- turnCorner()
- turtle.digDown()
- turnCorner()
- turtle.digDown()
- turnCorner()
- turtle.digDown()
- turnCorner()
- turnRight()
- end
- local function start()
- if ~inPit then
- enterPit()
- end
- for i = 1,loops do
- if turtle.getFuelLevel() < 20000 then
- exitPit()
- refuel(20)
- enterPit()
- end
- digLoopOnce()
- regen()
- if turtle.getItemCount(16) > 0 then
- exitPit()
- deposit()
- enterPit()
- end
- end
- if inPit then
- exitPit()
- end
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement