Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local stripLength = 33
- local count = 0
- local line = 0
- if not #args == 1 then
- print("Usage: smine <mines>")
- return
- end
- function strip()
- count = 0
- for i=1,stripLength do
- count = count + 1
- checkInv()
- while not turtle.forward() do turtle.dig() end
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.2)
- end
- while turtle.detectDown() do
- turtle.digDown()
- sleep(0.2)
- end
- if line%8 == 0 then
- if i%8 == 0 then
- turtle.select(16)
- while not turtle.forward() do turtle.dig() end
- while turtle.detectDown() do
- turtle.digDown()
- sleep(0.2)
- end
- if not turtle.back() then
- turtle.turnLeft()
- turtle.turnLeft()
- while not turtle.forward do turtle.dig() end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- turtle.down()
- if not turtle.detectDown() then
- turtle.select(1)
- turtle.placeDown()
- turtle.select(16)
- end
- turtle.up()
- turtle.placeDown()
- turtle.select(1)
- end
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,stripLength do
- while not turtle.forward() do turtle.dig() end
- end
- end
- function checkFuel(count)
- if turtle.getFuelLevel() <= count then
- print("Error: Low fuel")
- for i=1,14 do
- turtle.select(i)
- turtle.refuel()
- end
- turtle.select(1)
- if turtle.getFuelLevel() <= count then
- turtle.turnLeft()
- turtle.turnLeft()
- print("returning")
- print(count)
- for i=0,count do
- turtle.forward()
- end
- emptyInv()
- turtle.turnRight()
- end
- end
- end
- function checkInv()
- isFull = true
- for i=1,14 do
- if turtle.getItemCount(i) == 0 then
- isFull = false
- end
- end
- if isFull == true then
- turtle.select(15)
- while not turtle.placeDown() do turtle.digDown() end
- for i=1,14 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.select(15)
- turtle.digDown()
- sleep(0.2)
- turtle.select(1)
- end
- end
- function emptyInv()
- turtle.select(15)
- while not turtle.placeDown() do turtle.digDown() end
- for i=1,14 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.select(15)
- turtle.digDown()
- sleep(0.2)
- turtle.select(1)
- end
- for x=1,args[1] do
- turtle.turnLeft()
- strip()
- strip()
- turtle.turnRight()
- if line%8 == 0 then
- turtle.select(16)
- turtle.placeDown()
- turtle.select(1)
- end
- while not turtle.forward() do turtle.dig() end
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.2)
- end
- while turtle.detectDown() do
- turtle.digDown()
- end
- line = line + 1
- print("Mined " .. x .. ", " .. args[1]-x .. " left to go.")
- end
- emptyInv()
Advertisement
Add Comment
Please, Sign In to add comment