Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- startX = 0
- startY = 0
- startZ = 0
- currX = 0
- currY = 0
- currZ = 0
- clearLength = 0
- clearWidth = 0
- clearHeight = 0
- EstFuel = 0
- running = 0
- function UserInputs()
- term.clear()
- term.setCursorPos(1, 1)
- print("Specify the length to clear out")
- clearLength = read()
- print("Specify the width to clear out")
- clearWidth = read()
- print("Specify the heigh to clear out")
- clearHeight = read()
- end
- function StartFuel()
- EstFuel = (clearLength * clearHeight * clearWidth)
- print(EstFuel)
- for i = 1, 16 do
- turtle.select(i)
- turtle.refuel()
- end
- print(turtle.getFuelLevel())
- end
- function MoveForward()
- while not turtle.forward() do
- if turtle.detect() then
- if peripheral.isPresent("front") then
- break
- else
- turtle.dig()
- if turtle.detect() then
- sleep(1)
- turtle.dig()
- end
- end
- else
- turtle.attack()
- end
- end
- end
- function MoveUp()
- while not turtle.up() do
- if turtle.detectUp() then
- turtle.digUp()
- if turtle.detectUp() then
- sleep(1)
- turtle.digUp()
- end
- else
- turtle.attackUp()
- end
- end
- end
- function MoveDown()
- if Bedrock == 0 then
- while not turtle.down() do
- if turtle.detectDown() then
- turtle.digDown()
- print("Dig down: ok")
- if turtle.detectDown() then
- print("Detected something again")
- sleep(1)
- turtle.digDown()
- if turtle.detectDown() then
- Bedrock = 1
- print("Bedrock is found")
- GoHome()
- end
- end
- else
- print("Something is still here, trying to attack")
- turtle.attackDown()
- end
- end
- end
- end
- function DigUp()
- while turtle.detectUp() do
- turtle.digUp()
- if turtle.detectUp() then
- turtle.digUp()
- sleep(1)
- if turtle.detectUp() then
- turtle.attackUp()
- end
- end
- end
- end
- function DigDown()
- while turtle.detectDown() do
- turtle.digDown()
- if turtle.detectDown() then
- turtle.digDown()
- sleep(1)
- turtle.digDown()
- if turtle.detectDown() then
- print("Bedrock underneath, breaking loop")
- Bedrock = 1
- end
- else
- turtle.attackDown()
- end
- end
- end
- UserInputs()
- StartFuel()
- for i = 1, clearHeight/2 do
- for i = 1, clearWidth do
- for i = 1, clearLength do
- DigUp()
- MoveForward()
- currX = currX + 1
- end
- turtle.turnRight()
- DigUp()
- MoveForward()
- currY = currY + 1
- turtle.turnRight()
- for i = 1, clearLength do
- DigUp()
- MoveForward()
- currX = currX - 1
- end
- turtle.turnLeft()
- DigUp()
- MoveForward()
- currY = currY + 1
- turtle.turnLeft()
- end
- turtle.turnLeft()
- for i = 1, clearWidth do
- DigUp()
- MoveForward()
- currY = currY - 1
- end
- DigUp()
- MoveUp()
- DigUp()
- MoveUp()
- turtle.turnRight()
- end
- running = 1
Advertisement
Add Comment
Please, Sign In to add comment