Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Turtle digger program
- -- version 1.1
- -- author mac
- len = arg[1]
- DIG_TIMEOUT = 0.15
- TRASH = {
- "minecraft:gravel",
- "minecraft:cobblestone",
- "minecraft:granite",
- "minecraft:diorite",
- "minecraft:andesite",
- "minecraft:dirt"
- }
- fuelLevel = turtle.getFuelLevel()
- doDropTrash = 0
- if arg[2] == "1" then
- doDropTrash = 1
- end
- if len == nil then
- print("Must define len by using param")
- return
- end
- if fuelLevel < 1*len then
- print("Not enough fel for that length you need a ", 5*len, "current",fuelLevel)
- return
- end
- function dropTrash()
- for i = 1,16 do
- a,b = turtle.getItemDetail(i)
- if a ~= nil then
- for block = 1,6 do
- if a.name == TRASH[block] then
- turtle.select(i)
- turtle.dropDown()
- end
- end
- end
- end
- turtle.select(1)
- end
- function checkInventory()
- while turtle.getItemCount(16) > 0 do
- print("Full inventory, please clear")
- sleep(10)
- end
- end
- function sdig()
- checkInventory()
- while turtle.detect() do
- sleep(DIG_TIMEOUT)
- turtle.dig()
- end
- end
- function sdigUp()
- checkInventory()
- while turtle.detectUp() do
- sleep(DIG_TIMEOUT)
- turtle.digUp()
- end
- end
- function digUpAndDown()
- checkInventory()
- sdigUp()
- turtle.digDown()
- end
- for i = 0,len do
- print("progress ",i ," of ", len)
- sdig()
- turtle.forward()
- digUpAndDown()
- if i % 5 == 0 and doDropTrash == 1 then
- dropTrash()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement