Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- local digDownAmount
- local digDeepAmount
- local stripeAmount
- if not (#tArgs == 3) then
- print ("You need exactly three parameter!")
- return
- else
- digDownAmount = tonumber(tArgs[1])
- digDeepAmount = tonumber(tArgs[2])
- stripeAmount = tonumber(tArgs[3])
- end
- local function forward()
- while not turtle.forward() do
- if not turtle.dig() then
- turtle.attack()
- sleep(0.5)
- end
- end
- end
- local fucntion up()
- while not turtle.up() do
- if not turtle.digUp() then
- turtle.attackUp()
- sleep(0.5)
- end
- end
- end
- local function down()
- while not turtle.down() do
- if not turtle.digDown() then
- turtle.attackDown()
- sleep(0.5)
- end
- end
- end
- local function FindChest()
- local turns = 0
- local chestFound = false
- while not ChestFound do
- for i = 1, 4 do
- if turtle.detect() then
- print("Chest found... starting mine operation!")
- ChestFound = true
- break
- else
- turtle.turnRight()
- end
- end
- print("No Chest found.. place a chest near turtle to start mining")
- sleep(3)
- end
- end
- local function mineToBase(amount)
- turtle.select(1)
- for i = 1, amount do
- down()
- turtle.placeUp()
- end
- end
- local function moveToTop(amount)
- turtle.select(1)
- for i = 1, amount do
- up()
- turtle.placeDown()
- end
- end
- local function DigRow()
- turtle.dig()
- forward()
- turtle.digDown()
- turtle.digUp()
- end
- local function EmptyInventory()
- for i = 1, 16 do
- turtle.select(i)
- turtle.drop()
- end
- end
- local function FirstMining(amount)
- for i = 1, amount do
- DigRow()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, amount do
- forward()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- local function MiningLoop(amount)
- for i = 1, amount do
- FirstMining(digDeepAmount)
- turtle.turnRight()
- for i = 1, 2 do
- turtle.dig()
- forward()
- end
- turtle.turnLeft()
- end
- turtle.turnLeft()
- for i = 1, amount * 3 do
- forward()
- end
- turtle.turnRight()
- end
- FindChest()
- mineToBase(digDownAmount)
- MiningLoop(stripeAmount)
- moveToTop(digDownAmount)
- EmptyInventory()
- print ("Run successfully!")
Advertisement
Add Comment
Please, Sign In to add comment