Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function clear()
- term.clear()
- term.setCursorPos(1, 1)
- end
- local setupDone = true
- local currY = 0
- local startY = 0
- local workY = 0
- local size = 0
- clear()
- print("Size?")
- print("")
- write(" ")
- size = read()
- size = tonumber(size)
- if not size then
- clear()
- print("That wasn't a number, idiot.")
- setupDone = false
- else
- if size < 3 then
- clear()
- print("Too small! I'm no mining well, asshole.")
- setupDone = false
- else
- clear()
- print("My current Y coordinate?")
- print("")
- write(" ")
- currY = read()
- currY = tonumber(currY)
- if not currY then
- clear()
- print("That wasn't a number, idiot.")
- setupDone = false
- else
- startY = currY
- end
- end
- end
- local function dig()
- while turtle.detect() == true do
- turtle.dig()
- end
- if turtle.getFuelLevel() > 30 then
- turtle.forward()
- else
- if turtle.getItemCount(1) > 1 then
- turtle.select(1)
- turtle.refuel(1)
- turtle.forward()
- else
- clear()
- print("Out of usable fuel. Stoping.")
- print("Now crashing the program!")
- print("")
- exit()
- end
- end
- end
- local function row()
- for i = 1, size-1 do
- dig()
- end
- end
- local function layer()
- if size % 2 == 0 then
- for i = 1, (size/2)-1 do
- row()
- turtle.turnLeft()
- dig()
- turtle.turnLeft()
- row()
- turtle.turnRight()
- dig()
- turtle.turnRight()
- end
- row()
- turtle.turnLeft()
- dig()
- turtle.turnLeft()
- row()
- turtle.turnLeft()
- row()
- turtle.turnRight()
- else
- for i = 1, (size-1)/2 do
- row()
- turtle.turnLeft()
- dig()
- turtle.turnLeft()
- row()
- turtle.turnRight()
- dig()
- turtle.turnRight()
- end
- row()
- turtle.turnRight()
- row()
- turtle.turnRight()
- row()
- end
- end
- local function mine()
- clear()
- workY = currY
- while workY > 1 do
- turtle.digDown()
- turtle.down()
- currY = currY-1
- workY = currY
- print("Working on Y = "..workY)
- layer()
- while currY < startY do
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- currY = currY+1
- end
- for i = 2, 16 do
- turtle.select(i)
- turtle.drop(turtle.getItemCount(i))
- end
- turtle.turnLeft()
- turtle.turnLeft()
- if workY == 1 then
- print("Done")
- else
- while currY > workY do
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.down()
- currY = currY-1
- end
- end
- end
- end
- if setupDone == true then
- mine()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement