Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --BasicWoodcutLoop
- function cut()
- for i = 0,6 do
- turtle.digUp()
- turtle.up()
- end
- turtle.dig()
- turtle.forward()
- for i = 0,6 do
- turtle.digDown()
- turtle.down()
- end
- turtle.forward()
- end
- --Basic movement loop
- function moveForward()
- for i = 0,5 do
- turtle.forward()
- end
- end
- --Turns and plants sapling
- function plant()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- --Cuts entire column of trees
- function cutColumn()
- for i = 1,treesInColumn do
- cut()
- plant()
- if counter < timesToMove then
- moveForward()
- counter = counter + 1
- end
- end
- counter = 0
- end
- --Updates Faceinit value to current facing (True if facing initial direction, false if opposite)
- function updateFacing()
- if faceInit == true then
- faceInit = false
- else
- faceInit = true
- end
- end
- --Moves between rows to cut the next one
- function moveRows()
- if faceInit == true then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- moveForward()
- if faceInit == true then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- updateFacing()
- end
- --RunTime Loop
- run = true
- faceInit = true
- treesInColumn = 3 -- UPDATE ME TO FIT SIZE OF TREE FARM
- numOfColumns = 3 -- UPDATE ME TO FIZE SIZE OF TREE FARM
- timesToMove = treesInColumn - 1
- counter = 0
- while run == true do
- for i = 1,numOfColumns do
- cutColumn()
- moveRows()
- end
- -- run = false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement