Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Made by Xmarks
- -- https://www.youtube.com/channel/UCA6oAnFqdDcc0sa6H8G5DSA
- -- Program originally designed to Chop-down a 2x2 Tree, like RedWood
- -- Redundancy digging going down for trees sprouting additional
- -- wood-blocks around the main 2x2 area, like Jungle Trees
- -- Program Digs everything in a 10x10 area going down
- -- Returns to Origin, and drops items in slots 2-to-14
- -- *****************************************
- -- Fuel goes to 1
- -- Wood Block for comparison goes to slot 15
- -- Tree-sapplings go to slot 16
- -- *****************************************
- local function checkFuel()
- if turtle.getFuelLevel() < 20 then
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- local function move()
- checkFuel()
- local moved = 0
- while moved < 1 do
- if turtle.forward() then
- moved = moved + 1
- elseif turtle.detect() then
- turtle.dig()
- if turtle.forward() then
- moved = moved + 1
- end
- elseif turtle.attack() then
- if turtle.forward() then
- moved = moved + 1
- end
- end
- end
- end
- local function moveUp()
- checkFuel()
- local moved = 0
- while moved < 1 do
- if turtle.up() then
- moved = moved + 1
- elseif turtle.detectUp() then
- turtle.digUp()
- if turtle.up() then
- moved = moved + 1
- end
- elseif turtle.attackUp() then
- if turtle.up() then
- moved = moved + 1
- end
- end
- end
- end
- local function moveDown()
- checkFuel()
- local moved = 0
- while moved < 1 do
- if turtle.down() then
- moved = moved + 1
- elseif turtle.detectDown() then
- turtle.digDown()
- if turtle.down() then
- moved = moved + 1
- end
- elseif turtle.attackDown() then
- if turtle.down() then
- moved = moved + 1
- end
- end
- end
- end
- local height = 0
- local function fellUp()
- move()
- print('digging upwards until no more blocks detected')
- while turtle.detectUp() do
- turtle.dig()
- moveUp()
- height = height + 1
- end
- print('Dug up to a Height of ' .. height)
- end
- local heightDown = 0
- local function obliterate()
- print('Going top-left corner of a 10 by 10 area')
- for i = 0,4 do
- move()
- end
- turtle.turnLeft()
- for i = 0,3 do
- move()
- end
- print('Digging everything in a 10 by 10 area, until reached initial location - 1')
- while heightDown < height do
- print('Digging Down. Current heightDown is ' .. heightDown)
- if heightDown % 2 == 0 then
- print('Digging area from top-left corner to bottom-left corner')
- turtle.turnLeft()
- turtle.turnLeft()
- for y = 0,9 do
- if y % 2 == 0 then
- for xright = 0,8 do
- move()
- end
- turtle.turnRight()
- move()
- turtle.turnRight()
- elseif y % 2 == 1 then
- for xleft = 0,8 do
- move()
- end
- turtle.turnLeft()
- move()
- turtle.turnLeft()
- end
- end
- turtle.turnLeft()
- move()
- turtle.turnLeft()
- elseif heightDown % 2 == 1 then
- print('Digging Area from bottom-left corner to top-left corner')
- turtle.turnRight()
- turtle.turnRight()
- for y = 0,9 do
- if y % 2 == 0 then
- for xright = 0,8 do
- move()
- end
- turtle.turnLeft()
- move()
- turtle.turnLeft()
- elseif y % 2 == 1 then
- for xleft = 0,8 do
- move()
- end
- turtle.turnRight()
- move()
- turtle.turnRight()
- end
- end
- turtle.turnRight()
- move()
- turtle.turnRight()
- end
- heightDown = heightDown + 1
- moveDown()
- end
- print(heightDown)
- if heightDown % 2 == 0 then
- print('Rearched the end of digging. Starting to the top-left corner, going back to Origin')
- turtle.turnLeft()
- for originy = 0,4 do
- move()
- end
- turtle.turnLeft()
- for originx = 0,4 do
- move()
- end
- turtle.turnLeft()
- turtle.dig()
- elseif heightDown % 2 == 1 then
- print('Reached the end of digging. Starting from the bottom-left corner, going back to Origin')
- turtle.turnRight()
- for originy = 0,3 do
- move()
- end
- turtle.turnRight()
- for originx = 0,4 do
- move()
- end
- turtle.turnLeft()
- turtle.dig()
- end
- end
- local function replant()
- print('Replanting seeds')
- turtle.select(16)
- turtle.place()
- turtle.turnLeft()
- move()
- turtle.turnRight()
- turtle.place()
- turtle.turnRight()
- turtle.place()
- turtle.turnRight()
- move()
- print('Dropping all blocks in slots 2-to-14 into the chest')
- for slot = 2,14 do
- turtle.select(slot)
- turtle.drop()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(16)
- turtle.place()
- end
- while true do
- turtle.select(15)
- if turtle.compare() then
- fellUp()
- obliterate()
- replant()
- -- Reset Heights
- height = 0
- heightDown = 0
- else
- turtle.suck()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement