Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 0.5
- local isBlock = true
- local totalBlocks = 0
- local onGround = true
- function fuelCheck()
- fuelLevel = turtle.getFuelLevel()
- print("Checking fuel before start...")
- os.sleep(0.5)
- if fuelLevel < 100 then
- os.error("Insufficient fuel in tank.")
- else
- print("Sufficient fuel in tank.")
- end
- end
- function init()
- fuelCheck()
- turtle.dig()
- turtle.forward()
- end
- function fellTree()
- onGround = true
- isBlock = true
- while isBlock or totalBlocks < 5 do
- totalBlocks = totalBlocks + 1
- isBlock = turtle.detectUp()
- turtle.digUp()
- turtle.up()
- end
- if not isBlock then
- repeat
- turtle.down()
- onGround = turtle.detectDown()
- until onGround
- end
- end
- function moveNext()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- end
- init()
- for i = 0, 3, 1 do
- fellTree()
- moveNext()
- end
- print("Total blocks felled/moved: " .. totalBlocks)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement