Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function quarry(width, length, y)
- local row = 0
- local blocks = 0
- local levels = 1
- local turned = false
- local width = width
- local length = length - 1
- local y1 = y + 1
- local y = y
- local x = 0
- local z = 0
- local xt = 0
- local zt = 0
- while(y > 5) do
- turtle.digUp()
- turtle.up()
- if(levels > 1) then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- while(width > z) do
- while(length > x) do
- turtle.dig()
- turtle.forward()
- x = x + 1
- blocks = blocks + 1
- print("Blocks mined: " , blocks)
- if(turtle.getFuelLevel() < 10) then
- turtle.refuel()
- end
- if(turtle.getItemCount(16) > 1) then
- if((row + 1) % 2 == 0) then
- xt = length - x
- else
- xt = x
- end
- if(levels % 2 == 0) then
- zt = (width - 1)- z
- else
- zt = z
- end
- x2 = xt
- y2 = y
- z2 = zt
- print("(", zt,",", xt, ")")
- while(y < y1) do
- turtle.down()
- y = y + 1
- end
- if(turned == true) then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- while(xt > 0) do
- turtle.forward()
- xt = xt - 1
- end
- turtle.turnRight()
- while(zt > 0) do
- turtle.forward()
- zt = zt - 1
- end
- turtle.turnLeft()
- for I = 16,2,-1 do
- turtle.select(I)
- turtle.drop()
- end
- turtle.turnLeft()
- while(z2 > zt) do
- turtle.forward()
- zt = zt + 1
- end
- turtle.turnLeft()
- while(x2 > xt) do
- turtle.forward()
- xt = xt + 1
- end
- while(y2 < y) do
- turtle.up()
- y = y - 1
- end
- if(turned == false) then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- end
- x = 0
- z = z + 1
- row = row + 1
- if(row % 2 == 0 and z < width and levels % 2 > 0) then
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- blocks = blocks + 1
- turtle.turnLeft()
- turned = true
- else if(row % 2 > 0 and z < width and levels % 2 > 0) then
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- blocks = blocks + 1
- turtle.turnRight()
- turned = false
- else if(row % 2 == 0 and z < width and levels % 2 == 0) then
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- blocks = blocks + 1
- turtle.turnRight()
- turned = true
- else if(row % 2 > 0 and z < width and levels % 2 == 0) then
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- blocks = blocks + 1
- turtle.turnLeft()
- turned = false
- end
- end
- end
- end
- end
- y = y - 1
- z = 0
- levels = levels + 1
- local heightReport = "I have gone ", y, " levels down out of ", y1, " levels"
- rednet.send(3, heightReport)
- end
- end
- rednet.open("left")
- local sender, width, protocol = rednet.receive("quarry")
- local sender2, length, protocol2 = rednet.receive("quarry")
- local sender3, height, protocol3 = rednet.receive("quarry")
- local sender4, confirm, protocol4 = rednet.receive("quarry")
- if(confirm == "Y") then
- turtle.refuel()
- rednet.send(3, 'Starting...')
- quarry(width,length,height)
- rednet.send(3, 'Complete!')
- else
- rednet.send(3, 'Canceled')
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement