Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- width = 0;
- length = 0;
- height = 0;
- depth = 0;
- fuel = turtle.getFuelLevel();
- range = 999999;
- -- get size
- while (height == 0) do
- io.write("\nHow high would you like to mine?\n")
- height = io.read()
- range = (((width * (length - 1)) * height) + height);
- print(range);
- end
- while (width == 0) do
- io.write("\nhow wide would you like the hole to be?\n")
- width = io.read()
- end
- while (length == 0) do
- io.write("\nHow long would you like the hole to be?\n")
- io.write("\n(Minimum length of 2)\n")
- length = io.read()
- end
- -- dig funcs to lower code written
- function digF() --dig forward & move
- turtle.dig()
- turtle.forward()
- end
- function layerup(depth) -- dig up & move
- turtle.digUp()
- turtle.up()
- depth = depth + 1;
- return depth;
- end
- function digL(width)
- turtle.turnLeft()
- digF()
- turtle.turnLeft()
- for i=1, (width - 1) do
- digF()
- end
- end
- function digR(width)
- turtle.turnRight()
- digF()
- turtle.turnRight()
- for i=1, (width - 1) do
- digF()
- end
- end
- -- troubleshooting code, pls ignore
- function layer0(width, length)
- digL(width)
- digR(width)
- end
- function layer1(width, length)
- digR(width)
- digL(width)
- end
- -- initialize, runs once at start
- digF()
- turtle.turnRight()
- for i=1, (width - 1) do
- digF()
- end
- -- main digging function, it all comes together
- print("\nMining a hole: \n", width, " blocks wide\n")
- print(length, " blocks deep\n", height, " blocks high")
- sheight = height + 0
- while (depth < height) do
- if ((length - 1)%2 == 1) then
- for i=1, ((length)/2) do
- layer0(width, length)
- end
- digL(width)
- end
- depth = layerUp(depth);
- end
- -- MC, RTB
- print("\nMission complete, returning!\n")
- for i=1, depth do
- turtle.down()
- end
Advertisement
Add Comment
Please, Sign In to add comment