SHOW:
|
|
- or go back to the newest paste.
1 | - | -- computercraft tunneling program 1x3 for strip-minning |
1 | + | -- computercraft mine stairs program |
2 | -- options for Enderchest, torches, normal chests and loot-only | |
3 | -- ########## NOT READY ############# | |
4 | ||
5 | local useEnderChest = false -- place a enderchest, dump stuff in it and collect chest? | |
6 | local enderChestSlot = 2 -- slot to place enderchest | |
7 | local useNormalChest = false -- place a chest, dump stuff in it and move on? | |
8 | local normalChestSlot = 3 -- slot to place chests | |
9 | local lootOnly = true -- discard dirt cobble etc? | |
10 | local useTorch = false -- place torches along path? | |
11 | - | local torchSlot = 1 -- turtleslot to put torches |
11 | + | local torchSlot = 1 -- turtle slot to put torches |
12 | local torchInterval = 8 -- place torch every X blocks | |
13 | - | local returnToStart = false -- |
13 | + | local tdepth = 30 -- tunnels for 30 blocks |
14 | - | local tLenght = 30 -- tunnels for 30 blocks |
14 | + | |
15 | torchNeeded = math.floor(tdepth / torchInterval) -- calculating needed torches | |
16 | - | torchNeeded = math.floor(tLenght / torchInterval) -- calculating needed torches |
16 | + | |
17 | ||
18 | shell.run("clear") | |
19 | local temp1 = turtle.getItemDetail(enderChestSlot) | |
20 | local temp2 = turtle.getItemDetail(normalChestSlot) | |
21 | - | if turtle.getItemDetail(enderChestSlot) ~= "ender_chest" then |
21 | + | |
22 | if temp1.name != "ender_chest" then | |
23 | print("no Enderchest found in slot ".. enderChestSlot) | |
24 | - | if turtle.getItemDetail(normalChestSlot) ~= "chest" then |
24 | + | exit() |
25 | end | |
26 | ||
27 | if temp2.name != "chest" then | |
28 | print("no chest found in slot ".. normalChestSlot) | |
29 | exit() | |
30 | else | |
31 | - | for i=0,tLenght do |
31 | + | print("Found " .. temp2.count .. "chests in slot " .. normalChestSlot) |
32 | - | while turtle.digUp() do |
32 | + | |
33 | ||
34 | if turtle.detectDown() then | |
35 | turtle.up() | |
36 | end | |
37 | for i=0,tdepth do | |
38 | turtle.digDown() | |
39 | turtle.down() | |
40 | while turtle.dig() do | |
41 | -- waiting for gravel or sand to fall down | |
42 | - | if turtle.getItemCount(16) ~= 0 then |
42 | + | |
43 | end | |
44 | turtle.forward() | |
45 | turtle.digDown() | |
46 | if turtle.getItemCount(16) != 0 then | |
47 | if useEnderChest then | |
48 | turtle.select(enderChestSlot) | |
49 | - | if info.name ~= "cobblestone" or info.name ~= "dirt" or info.name ~= "gravel" or info.name ~= "sand" then |
49 | + | |
50 | if lootOnly then | |
51 | for slot=4, 16 do | |
52 | info = turtle.getItemDetail(slot) | |
53 | if info.name != "cobblestone" or info.name != "dirt" or info.name != "gravel" or info.name != "sand" then | |
54 | turtle.select(slot) | |
55 | turtle.dropUp() | |
56 | else | |
57 | turtle.select(slot) | |
58 | turtle.dropDown() | |
59 | end | |
60 | end | |
61 | else | |
62 | for slot=4, 16 do | |
63 | - | turtle.digUp() -- pickup enderchest |
63 | + | |
64 | - | for a=1,16 do |
64 | + | |
65 | - | temp1 = turtle.getItemDetail(enderChestSlot) |
65 | + | |
66 | - | if temp1.name == "ender_chest" then |
66 | + | |
67 | - | turtle.select(a) |
67 | + | |
68 | - | turtle.transferTo(enderChestSlot) |
68 | + | |
69 | if lootOnly then | |
70 | for slot=4, 16 do | |
71 | info = turtle.getItemDetail(slot) | |
72 | if info.name != "cobblestone" or info.name != "dirt" or info.name != "gravel" or info.name != "sand" then | |
73 | turtle.select(slot) | |
74 | turtle.dropUp() | |
75 | else | |
76 | - | if info.name ~= "cobblestone" or info.name ~= "dirt" or info.name ~= "gravel" or info.name ~= "sand" then |
76 | + | |
77 | turtle.dropDown() | |
78 | end | |
79 | end | |
80 | else | |
81 | for slot=4, 16 do | |
82 | turtle.select(slot) | |
83 | turtle.dropUp() | |
84 | end | |
85 | end | |
86 | end | |
87 | end | |
88 | if useTorch then | |
89 | if i == torchInterval then | |
90 | - | turtle.digUp() -- pickup chest |
90 | + | |
91 | - | for a=1,16 do |
91 | + | |
92 | - | temp2 = turtle.getItemDetail(normalChestSlot) |
92 | + | if turtle.getItemCount(torchSlot) != 0 then |
93 | - | if temp2.name == "chest" then |
93 | + | |
94 | - | turtle.select(a) |
94 | + | |
95 | - | turtle.transferTo(normalChestSlot) |
95 | + | |
96 | while turtle.getItemCount(torchSlot) < torchNeeded do | |
97 | shell.run("clear") | |
98 | print("Torches needed, Will resume when replenished.") | |
99 | print("Would need " .. torchNeeded .. "torches.") | |
100 | sleep(3) | |
101 | end | |
102 | shell.run("clear") | |
103 | turtle.up() | |
104 | - | if turtle.getItemCount(torchSlot) ~= 0 then |
104 | + | |
105 | end | |
106 | turtle.select(4) | |
107 | end | |
108 | end | |
109 | end |