Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- numitems = 9
- squaresize = 16
- function isWoodAbove()
- for i=1,numitems do
- turtle.select(i)
- if turtle.compareUp() then
- return true
- end
- end
- return false
- end
- function isWoodInFront()
- for i=1,numitems do
- turtle.select(i)
- if turtle.compare() then
- return true
- end
- end
- return false
- end
- function killTree()
- print("killtree starting")
- up = 0
- turtle.dig()
- turtle.forward()
- for i=1,math.huge() do
- if turtle.detectUp() and isWoodAbove() then
- turtle.digUp()
- turtle.up()
- up=up+1
- else
- for i=1,up do
- turtle.down()
- end
- up=0
- break
- end
- end
- print("killtree ending")
- end
- function moveForward()
- while not turtle.detectDown() do
- turtle.down()
- for i=1,numitems do
- turtle.select(i)
- if turtle.compareDown() then
- turtle.digDown()
- end
- end
- end
- if turtle.detect() then
- if isWoodInFront() then
- killTree()
- else
- while turtle.detect() do
- turtle.up()
- if isWoodAbove() then
- turtle.digUp()
- end
- end
- end
- end
- turtle.forward()
- end
- --starts here
- print("starting")
- turnR = true
- turtle.dig()
- turtle.forward()
- for i=1,squaresize do
- for i=1,squaresize do
- moveForward()
- end
- if turnR then
- turtle.turnRight()
- moveForward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- moveForward()
- turtle.turnLeft()
- end
- turnR = not turnR
- end
Advertisement
Add Comment
Please, Sign In to add comment