Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- local digDownAmount
- local digDeepAmount
- local stripeAmount
- local chestSlot = 2
- 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 mineToBase(amount)
- turtle.select(1)
- for i = 1, amount do
- while not turtle.down() do
- turtle.digDown()
- end
- turtle.placeUp()
- end
- end
- local function moveToTop(amount)
- turtle.select(1)
- for i = 1, amount do
- while not turtle.up() do
- turtle.digUp()
- end
- turtle.placeDown()
- end
- end
- local function PlaceChest()
- print ("PlaceChest called...")
- turtle.select(chestSlot)
- while true do
- if (turtle.getItemCount(chestSlot) == 1) and (turtle.place()) or (turtle.dig() and turtle.place()) then
- print("Chest successfully placed!")
- break
- else
- print("Chest placing error!")
- sleep(1)
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- local function DigRow()
- turtle.dig()
- while not turtle.forward() do
- sleep(1)
- end
- 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
- while not turtle.forward() do
- if turtle.dig() then
- turtle.forward()
- break
- end
- sleep(1)
- end
- end
- EmptyInventory()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- local function PickUpEnderChest()
- turtle.select(chestSlot)
- local turns = 0
- while true do
- if turtle.detect() then
- turtle.dig()
- break
- end
- turtle.turnRight()
- turns = turns + 1
- if (turns == 4) then
- turns = 0
- print("No chest detected.. waiting")
- sleep(5)
- end
- end
- end
- local function PlaceEnderChest()
- turtle.select(chestSlot)
- while true do
- if not turtle.place() then
- print("Cannot place chest for ending, waiting...")
- sleep(5)
- else
- break
- end
- end
- end
- local function GetChest()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(chestSlot)
- turtle.dig()
- end
- local function MiningLoop(amount)
- for i = 1, amount do
- PlaceChest()
- FirstMining(digDeepAmount)
- GetChest()
- turtle.turnRight()
- for i = 1, 2 do
- turtle.dig()
- turtle.forward()
- end
- turtle.turnLeft()
- end
- end
- PickUpEnderChest()
- mineToBase(digDownAmount)
- MiningLoop(stripeAmount)
- moveToTop(digDownAmount)
- PlaceEnderChest()
- print ("Run successfully!")
Advertisement
Add Comment
Please, Sign In to add comment