Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- computercraft tunneling program 1x3 for strip-minning
- -- options for Enderchest, torches, normal chests and loot-only
- -- ########## NOT READY #############
- local useEnderChest = false -- place a enderchest, dump stuff in it and collect chest?
- local enderChestSlot = 2 -- slot to place enderchest
- local useNormalChest = false -- place a chest, dump stuff in it and move on?
- local normalChestSlot = 3 -- slot to place chests
- local lootOnly = true -- discard dirt cobble etc?
- local useTorch = false -- place torches along path?
- local torchSlot = 1 -- turtleslot to put torches
- local torchInterval = 8 -- place torch every X blocks
- local returnToStart = false --
- local tLenght = 30 -- tunnels for 30 blocks
- torchNeeded = math.floor(tLenght / torchInterval) -- calculating needed torches
- shell.run("clear")
- if turtle.getItemDetail(enderChestSlot) ~= "ender_chest" then
- print("no Enderchest found in slot ".. enderChestSlot)
- end
- if turtle.getItemDetail(normalChestSlot) ~= "chest" then
- print("no chest found in slot ".. normalChestSlot)
- end
- if turtle.detectDown() then
- turtle.up()
- end
- for i=0,tLenght do
- while turtle.digUp() do
- -- waiting for gravel or sand to fall down
- sleep(.2)
- end
- while turtle.dig() do
- -- waiting for gravel or sand to fall down
- sleep(.2)
- end
- turtle.forward()
- turtle.digDown()
- if turtle.getItemCount(16) ~= 0 then
- if useEnderChest then
- turtle.select(enderChestSlot)
- turtle.placeUp()
- if lootOnly then
- for slot=4, 16 do
- info = turtle.getItemDetail(slot)
- if info.name ~= "cobblestone" or info.name ~= "dirt" or info.name ~= "gravel" or info.name ~= "sand" then
- turtle.select(slot)
- turtle.dropUp()
- else
- turtle.select(slot)
- turtle.dropDown()
- end
- end
- else
- for slot=4, 16 do
- turtle.select(slot)
- turtle.dropUp()
- end
- end
- turtle.digUp() -- pickup enderchest
- for a=1,16 do
- temp1 = turtle.getItemDetail(enderChestSlot)
- if temp1.name == "ender_chest" then
- turtle.select(a)
- turtle.transferTo(enderChestSlot)
- end
- end
- else if useNormalChest then
- turtle.select(normalChestSlot)
- if lootOnly then
- for slot=4, 16 do
- info = turtle.getItemDetail(slot)
- if info.name ~= "cobblestone" or info.name ~= "dirt" or info.name ~= "gravel" or info.name ~= "sand" then
- turtle.select(slot)
- turtle.dropUp()
- else
- turtle.select(slot)
- turtle.dropDown()
- end
- end
- else
- for slot=4, 16 do
- turtle.select(slot)
- turtle.dropUp()
- end
- end
- turtle.digUp() -- pickup chest
- for a=1,16 do
- temp2 = turtle.getItemDetail(normalChestSlot)
- if temp2.name == "chest" then
- turtle.select(a)
- turtle.transferTo(normalChestSlot)
- end
- end
- end
- end
- if useTorch then
- if i == torchInterval then
- torchInterval = torchInterval+torchInterval
- turtle.select(torchSlot)
- if turtle.getItemCount(torchSlot) ~= 0 then
- turtle.placeDown()
- else
- turtle.down()
- while turtle.getItemCount(torchSlot) < torchNeeded do
- shell.run("clear")
- print("Torches needed, Will resume when replenished.")
- print("Would need " .. torchNeeded .. "torches.")
- sleep(3)
- end
- shell.run("clear")
- turtle.up()
- print("here we go again.")
- end
- turtle.select(4)
- end
- end
- end
- end
- if returnToStart then
- for I=0,tLength do
- turtle.back()
- end
- print("Done, returned to start!")
- else
- print("Done, take me away!")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement