Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local maxLengthX = 15
- local maxLengthY = 15
- local layersToDig = 7
- local function checkFuel()
- if (turtle.getFuelLevel() == 0)
- then
- rednet.open("back")
- rednet.send(48, "Refuel")
- rednet.close("back")
- end
- end
- local function turtleForward()
- checkFuel()
- turtle.forward()
- end
- local function turtleDig()
- checkFuel()
- turtle.dig()
- end
- local function turtleUp()
- checkFuel()
- turtle.up()
- end
- local function turtleDigUp()
- checkFuel()
- turtle.digUp()
- end
- local function turtleDown()
- checkFuel()
- turtle.up()
- end
- local function turtleDigDown()
- checkFuel()
- turtle.digUp()
- end
- local function mineLayer()
- while (turtle.detect())
- do
- turtleDig()
- os.sleep(0.5)
- end
- turtleForward()
- turtle.turnRight()
- local index2 = 0
- while (index2 < maxLengthY)
- do
- local index = 1
- while (index < maxLengthX)
- do
- while (turtle.detect())
- do
- turtleDig()
- os.sleep(0.5)
- end
- turtleForward()
- index = index + 1
- end
- if (index2 ~= maxLengthY - 1)
- then
- while (turtle.detectUp())
- do
- turtleDigUp()
- os.sleep(0.5)
- end
- turtleUp()
- turtle.turnRight()
- turtle.turnRight()
- end
- index2 = index2 + 1
- end
- turtle.turnLeft()
- while (turtle.detect())
- do
- turtleDig()
- os.sleep(0.5)
- end
- turtleForward()
- turtle.turnLeft()
- local index2 = 0
- while (index2 < maxLengthY)
- do
- local index = 1
- while (index < maxLengthX)
- do
- while (turtle.detect())
- do
- turtleDig()
- os.sleep(0.5)
- end
- turtleForward()
- index = index + 1
- end
- if (index2 ~= maxLengthY - 1)
- then
- while (turtle.detectDown())
- do
- turtleDigDown()
- os.sleep(0.5)
- end
- turtleDown()
- turtle.turnRight()
- turtle.turnRight()
- end
- index2 = index2 + 1
- end
- turtle.turnRight()
- end
- local layer = 0
- while (layer < layersToDig)
- do
- mineLayer()
- layer = layer + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement