Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {}
- config.itemFuel = 80
- config.fuelSlot = 16
- local data = {}
- data.distance = 0
- data.fuelBuff = 0
- function reloadFuelBuff()
- data.fuelBuff = turtle.getItemCount()*config.itemFuel
- end
- function checkInv()
- return turtle.getItemCount(16) > 0
- end
- function checkFuel()
- if(turtle.getFuelLevel() < 10) then
- turtle.refuel(1)
- reloadFuelBuff()
- end
- return turtle.getFuelLevel()+data.fuelBuff > data.distance+5
- end
- function goForward(i)
- if(not turtle.forward()) then
- if(t>=5) then error("Immovable Object") end
- turtle.dig()
- goForward(i and i+1 or 1)
- end
- end
- function finish()
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1,data.distance do
- goForward()
- end
- end
- function digLoop()
- goForward()
- turtle.digDown()
- turtle.digUp()
- end
- function init()
- reloadFuelBuff()
- while checkFuel() and checkInv() do
- digLoop()
- end
- finish()
- end
- print("Ready? Put fuel in the active slot")
- read()
- init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement