Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Put 1 Gravel in slot 1
- --Put an ender chest in slot 2
- --Put torches in slot 15
- --Put fuel in slot 16
- --When you start the program put in the lenght of each shaft and how many shafts you want.
- --And it checks for gravel so it doesn't screw up the shafts
- local newDistQ = 0
- local lenght = 0
- local quest = 0
- local mineL = 0
- local shafts = 0
- local shaftsQ = 0
- local newDist = 0
- function fuel()
- if turtle.getFuelLevel() <= 10 then
- turtle.select(16)
- turtle.refuel(1)
- end
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function start()
- clear()
- print("Lenght of each shaft?")
- quest = tonumber(read())
- if quest>50 then --This is because the inventory size
- print("Not more than 50")
- quest = tonumber(read())
- end
- clear()
- print("Number of shafts?")
- print("Only put 2,4,6,8 etc")
- shaftsQ = tonumber(read())
- clear()
- print("Lenght between shafts?")
- newDistQ = tonumber(read())
- mine()
- end
- function isGravel()
- turtle.select(1)
- while turtle.compare() == true do
- turtle.dig()
- sleep(1)
- end
- while turtle.compareUp() == true do
- turtle.digUp()
- sleep(1)
- end
- end
- function newMine()
- print("newMine()")
- newDist = 0
- mineL = mineL + 1
- if mineL%2==0 then
- turtle.turnRight()
- else do
- turtle.turnLeft()
- end
- end
- while newDist ~= newDistQ do
- isGravel()
- turtle.dig()
- isGravel()
- turtle.forward()
- newDist = newDist + 1
- isGravel()
- turtle.digDown()
- turtle.digUp()
- end
- if newDist == newDistQ and mineL%2==0 then
- turtle.turnRight()
- mine()
- end
- if newDist == newDistQ then
- turtle.turnLeft()
- mine()
- end
- end
- function chestDrop()
- shafts = shafts + 1
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(2)
- turtle.place()
- for i=3,14 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(2)
- turtle.dig()
- turtle.turnLeft()
- turtle.turnLeft()
- if shafts == shaftsQ then
- os.reboot()
- end
- newMine()
- end
- function mine()
- lenght = 0
- while lenght ~= quest do
- fuel()
- isGravel()
- turtle.dig()
- isGravel()
- turtle.forward()
- lenght = lenght + 1
- isGravel()
- turtle.digUp()
- turtle.digDown()
- if lenght%10==0 then
- turtle.select(15)
- turtle.placeDown()
- end
- if lenght == quest then
- chestDrop()
- end
- end
- end
- -- ( Main Stuff ) --
- turtle.up()
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement