Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- TreeDestroyer
- print("Fuel: ".. turtle.getFuelLevel())
- print("1 - 1x1 tree")
- print("2 - 2x2 tree")
- print("Press a key to start!")
- --DO NOT TOUCH THE CODE BELOW
- function cutUp()
- turtle.digUp()
- turtle.up()
- end
- function cutDown()
- turtle.digDown()
- turtle.down()
- end
- function runOne() --2x2
- height = 0
- heightFromFloor = 0
- -- chop down the first block
- if turtle.dig() then
- turtle.forward()
- else
- turtle.forward()
- while turtle.up()==true do
- heightFromFloor = heightFromFloor + 1
- end
- end
- while turtle.digUp()==true do
- turtle.dig()
- turtle.up()
- height = height + 1 --count height of the tree
- end
- turtle.turnRight(); turtle.dig(); turtle.forward(); turtle.turnLeft() --turn on the top
- for i=1, height do
- cutDown()
- turtle.dig()
- end
- for i=1, heightFromFloor do
- turtle.down()
- end
- print("Jobs done! Current height: " ..height)
- end
- function runOne() --1x1
- height = 0
- heightFromFloor = 1
- -- chop down the first block
- if turtle.dig() then
- turtle.forward()
- else
- turtle.forward()
- while turtle.up()==true do
- heightFromFloor = heightFromFloor + 1
- if heightFromFloor >= 50 then -- dont go higher than 50 blocks
- break
- end
- end
- end
- while turtle.digUp()==true do
- turtle.dig()
- turtle.up()
- height = height + 1 --count height of the tree
- end
- for i=1, height do
- turtle.down()
- end
- for i=1, heightFromFloor do
- turtle.down()
- end
- print("Fuel: ".. turtle.getFuelLevel())
- print("Jobs done! Current height: " ..height)
- end
- function runTwo() --2x2
- height = 0
- heightFromFloor = 1
- -- chop down the first block
- if turtle.dig() then
- turtle.forward()
- else
- turtle.forward()
- turtle.dig()
- while turtle.up()==true do
- heightFromFloor = heightFromFloor + 1
- if heightFromFloor >= 50 then -- dont go higher than 50 blocks
- break
- end
- end
- end
- while turtle.digUp()==true do
- turtle.dig()
- turtle.up()
- height = height + 1 --count height of the tree
- end
- turtle.turnRight(); turtle.dig(); turtle.forward(); turtle.turnLeft() --turn on the top
- for i=1, height do
- cutDown()
- turtle.dig()
- end
- for i=1, heightFromFloor do
- turtle.down()
- end
- print("Fuel: ".. turtle.getFuelLevel())
- print("Jobs done! Current height: " ..height)
- end
- while true do
- local event, char = os.pullEvent("char")
- if char == "s" then
- print("Quit!")
- error()
- elseif char == "1" then -- go
- print("Die, 1x1 tree!")
- runOne()
- break
- elseif char == "2" then
- print("Die, 2x2 tree!")
- runTwo()
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement