Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- computercraft mine stairs program
- -- 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 -- turtle slot to put torches
- local torchInterval = 8 -- place torch every X blocks
- local tdepth = 30 -- tunnels for 30 blocks
- torchNeeded = math.floor(tdepth / torchInterval) -- calculating needed torches
- shell.run("clear")
- local temp1 = turtle.getItemDetail(enderChestSlot)
- local temp2 = turtle.getItemDetail(normalChestSlot)
- if temp1.name != "ender_chest" then
- print("no Enderchest found in slot ".. enderChestSlot)
- exit()
- end
- if temp2.name != "chest" then
- print("no chest found in slot ".. normalChestSlot)
- exit()
- else
- print("Found " .. temp2.count .. "chests in slot " .. normalChestSlot)
- end
- if turtle.detectDown() then
- turtle.up()
- end
- for i=0,tdepth do
- turtle.digDown()
- turtle.down()
- 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
- 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
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement