Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local atGen=true
- local atChest=false
- minFuel=64
- local function checkFuel()
- if turtle.getFuelLevel() < minFuel then
- print("Refueling!")
- turtle.select(16)
- while turtle.getFuelLevel() < minFuel do
- turtle.refuel(1)
- os.sleep(0.1)
- end
- else
- print("Fuel sufficient!")
- end
- end
- local function goToChest()
- checkFuel()
- if atGen==true then
- turtle.turnLeft()
- turtle.turnLeft()
- print("Starting first forward...")
- os.sleep(1)
- for i=1,28,1 do turtle.forward() end
- os.sleep(1)
- print("Turning right...")
- turtle.turnRight()
- os.sleep(1)
- print("Starting second forward...")
- for i=1,9,1 do turtle.forward() end
- turtle.down()
- print("Finished at chest!")
- atGen=false
- atChest=true
- else
- print("Error, already at chest or not at gen!")
- end
- end
- local function goToGen()
- checkFuel()
- if atChest==true then
- turtle.up()
- turtle.turnLeft()
- turtle.turnLeft()
- print("Starting first forward...")
- os.sleep(1)
- for i=1,9,1 do turtle.forward() end
- os.sleep(1)
- print("Turning left...")
- turtle.turnLeft()
- os.sleep(1)
- print("Starting second forward...")
- for i=1,28,1 do turtle.forward() end
- print("Finished at gen!")
- atChest=false
- atGen=true
- else
- print("Error, already at gen or not at chest!")
- end
- end
- local turtleSuck=1
- local function suckWood()
- while true do
- turtle.select(turtleSuck)
- turtle.suck()
- if turtle.suck()==false then
- turtleSuck = turtleSuck+1
- end
- if turtleSuck==15 then
- turtleSuck=1
- return false
- end
- end
- end
- local function dropWood()
- print("Dropping wood!")
- while true do
- turtle.select(turtleSuck)
- turtle.dropDown()
- if turtle.dropDown()==false then
- turtleSuck = turtleSuck+1
- end
- if turtleSuck==16 then
- turtleSuck=1
- return false
- end
- end
- end
- goToChest()
- suckWood()
- goToGen()
- dropWood()
- print("RefuelGen finished!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement