Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("left")
- local allowMine = false
- local length = 20
- local width = 20
- local right = true
- local diggedDown = 0
- local diggedX = 0
- local diggedZ = 0
- modem.open(3)
- function getCommands()
- end
- function goBackChest()
- turtle.turnRight()
- turtle.turnRight()
- for i=0, diggedX do
- turtle.forward()
- end
- if right then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- for j=0, diggedZ do
- turtle.forward()
- end
- for y=0, diggedDown do
- turtle.up()
- end
- if turtle.detect() do
- for z=1,16 do
- turtle.select(z)
- turtle.drop()
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- for y=0, diggedDown do
- turtle.down()
- end
- right = true
- mine()
- end
- function detectFullInv()
- if turtle.getItemCount(16) ~= 0 then
- goBackChest()
- end
- end
- function sendInfo()
- count = 0
- for i=1,17 do
- data = turtle.getItemDetail(i)
- if data then
- count = count + data.count
- end
- end
- end
- modem.transmit(3, 1, count)
- detectFullInv()
- end
- function mine()
- if not allowMine then return 1 end
- turtle.digDown()
- sendInfo()
- os.sleep(1)
- turtle.down()
- diggedDown = diggedDown + 1
- os.sleep(1)
- for i=1,length do
- for j=1, width do
- turtle.dig()
- sendInfo()
- os.sleep(1)
- turtle.forward()
- diggedX = diggedX + 1
- os.sleep(1)
- end
- diggedX = 0
- if right then
- turtle.turnRight()
- right = false
- os.sleep(1)
- turtle.dig()
- sendInfo()
- os.sleep(1)
- turtle.forward()
- diggedZ = diggedZ + 1
- os.sleep(1)
- turtle.turnRight()
- os.sleep(1)
- else
- turtle.turnLeft()
- right = true
- os.sleep(1)
- turtle.dig()
- sendInfo()
- os.sleep(1)
- turtle.forward()
- diggedZ = diggedZ + 1
- os.sleep(1)
- turtle.turnLeft()
- os.sleep(1)
- end
- end
- diggedZ = 0
- mine()
- end
- allowMine = true
- mine()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement