Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- A simple program that will mine out trees from top to bottom.
- ]]
- local isBig = false
- function treeLoop()
- local height = 0
- --Basic going up code
- while turtle.compareUp() do
- height = height+1
- turtle.digUp()
- if isBig then turtle.dig() end
- turtle.up()
- end
- if isBig then
- --A quick adjustment if the tree is a 2x2
- turtle.turnRight()
- turtle.fForward()
- turtle.turnLeft()
- end
- --Here is where we bring him down
- for i=1,height do
- turtle.digDown()
- if isBig then turtle.dig() end
- turtle.down()
- end
- --A little pizzazz
- if isBig then
- --Just going to bring him back to start pos
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- end
- --And he's done!
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- end
- function fuelCheck()
- if turtle.getFuelLevel() < 99 then
- return false
- else
- return true
- end
- end
- function startup()
- turtle.fForward()
- turtle.select(1)
- if turtle.compare() then
- isBig = true
- print("We've got a big'un!")
- end
- treeLoop()
- end
- --Execution Code
- if fuelCheck() then
- startup()
- print("Finished! Any key to continue...")
- read()
- else
- print("Not enough fuel to continue, please refuel and retry. Any key to continue...")
- read()
- end
Advertisement
Add Comment
Please, Sign In to add comment