Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local INsets = args[1]
- local INstripLength = args[2]
- local INstripInterval = args[3]
- function checkInv()
- if turtle.getItemCount(10)>0 then
- turtle.turnRight()
- turtle.dig()
- while turtle.detect()==true do
- turtle.dig()
- sleep(0.5)
- end
- turtle.select(13)
- turtle.place()
- for i = 1,10 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(13)
- turtle.dig()
- turtle.turnLeft()
- turtle.select(1)
- end
- end
- function checkFuel()
- if turtle.getFuelLevel()<50 then
- turtle.select(14)
- turtle.refuel(20000)
- end
- end
- function mine(blocks)
- for i = 1,blocks do
- turtle.dig()
- while not turtle.forward() do
- turtle.dig()
- sleep(0.25)
- end
- turtle.digUp()
- checkInv()
- checkFuel()
- end
- end
- function placeTorch()
- turtle.select(15)
- if turtle.getItemCount()==0 then
- turtle.select(16)
- end
- if turtle.getItemCount()>0 then
- turtle.turnRight()
- turtle.placeUp()
- turtle.turnLeft()
- end
- end
- function mineTorch(length)
- for i = 1,length,10 do
- turtle.select(1)
- mine(10)
- placeTorch()
- end
- end
- function moveForward(blocks)
- for i = 1,blocks do
- turtle.forward()
- while not turtle.forward() do
- turtle.dig()
- sleep(0.5)
- turtle.forward()
- end
- end
- end
- function changeLane(direction)
- if direction=="L" then
- turtle.turnLeft()
- mine(INstripInterval-1)
- placeTorch()
- mine(1)
- turtle.turnLeft()
- end
- if direction=="R" then
- turtle.turnRight()
- mine(INstripInterval-1)
- placeTorch()
- mine(1)
- turtle.turnRight()
- end
- end
- function strip(sets, stripLength, stripInterval)
- for i = 1,sets do
- if i~=1 then
- mine(stripInterval-1)
- placeTorch()
- mine(1)
- end
- mine(stripInterval-1)
- placeTorch()
- mine(1)
- turtle.turnRight()
- mineTorch(stripLength)
- changeLane("L")
- mineTorch(stripLength*2)
- changeLane("L")
- mineTorch(stripLength)
- turtle.turnLeft()
- end
- end
- print("miner_v2.lua init complete")
- print("strip length = ", INstripLength)
- print("sets = ", INsets)
- print("strip interval = ", INstripInterval)
- strip(INsets, INstripLength, INstripInterval)
Add Comment
Please, Sign In to add comment