Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Program for a Quarry
- --Clearing Console
- function clearConsole()
- term.clear()
- term.setCursorPos(1, 1)
- end
- --Refueling
- function checkFuel()
- local fuelLevel = turtle.getFuelLevel()
- if fuelLevel == "unlimited" or fuelLevel > 10 then
- return
- end
- clearConsole()
- print("Low on fuel - Refueling")
- --Refuel from Inventory
- for slot = 1, 16 do
- turtle.select(slot)
- if turtle.getFuelLimit() then
- break
- end
- end
- turtle.select(1) --Select default slot
- end
- --Quarry Area
- function quarry(length, width)
- for i = 1, length do
- for j = 1, width do
- checkFuel() --Check before movement
- turtle.dig()
- turtle.forward()
- end
- if i < length then
- if i % 2 == 1 then
- turtle.turnRight()
- checkFuel()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- checkFuel()
- turtle.dig()
- turtle.forward()
- turnLeft()
- end
- end
- end
- end
- --Inventory emptying
- function ClearInventory()
- clearConsole()
- checkFuel()
- turtle.turnLeft()
- turtle.turnLeft() --Rotating to Place Chest
- turtle.select(2)
- turtle.place()
- for slot = 3, 16 do
- turtle.select(slot)
- turtle.drop()
- end
- turtle.select(1)
- turtle.turnRight()
- turtle.turnRight()
- end
- --Interface
- clearConsole()
- print("Mining Program")
- print("--------------")
- clearConsole()
- --Width, Length
- write("Width ?: ")
- local width = tonumber(read())
- write("Length ?: ")
- local lenght = tonumber(read())
- --Quarry Area
- quarry(lenght, width)
- print("Completed Task")
Advertisement
Add Comment
Please, Sign In to add comment