SHOW:
|
|
- or go back to the newest paste.
1 | - | -- Strip mining turtle program. |
1 | + | --Hill Hollow Script |
2 | - | -- Luke *********, Ryszard ********. 13/12/12 |
2 | + | |
3 | - | -- updated by AzrylAero 5/3/2013 |
3 | + | |
4 | mainshaft torches must be placed in slot 15 | |
5 | tunnel torches must be placed in slot 16.]] | |
6 | ||
7 | -- Create the function for refueling | |
8 | function checkFuel() | |
9 | if turtle.getFuelLevel() <= 10 then | |
10 | turtle.select(14) | |
11 | turtle.refuel(1) | |
12 | turtle.select(1) | |
13 | end --if | |
14 | end --checkFuel() | |
15 | ||
16 | -- Create the turnAround function | |
17 | function turnAround() | |
18 | turtle.turnRight() | |
19 | turtle.turnRight() | |
20 | end --turnAround() | |
21 | ||
22 | -- Go to the next tunnel | |
23 | function digNext(torchCounter) | |
24 | turtle.turnRight() | |
25 | turtle.dig() | |
26 | turtle.forward() | |
27 | turtle.digUp() | |
28 | turtle.dig() | |
29 | turtle.forward() | |
30 | turtle.digUp() | |
31 | if torchCounter == 2 then | |
32 | ||
33 | turnAround() | |
34 | turtle.select(15) | |
35 | turtle.place() | |
36 | turnAround() | |
37 | print("Placing mainshaft torch") | |
38 | end | |
39 | turtle.turnLeft() | |
40 | print("turn Right") | |
41 | print("Next Tunnel") | |
42 | end | |
43 | ||
44 | ||
45 | --Dig Next End | |
46 | ||
47 | -- Digs the tunnel for the given length | |
48 | function tunnel(givenLength) | |
49 | local distance = 0 | |
50 | for index = 1,givenLength do | |
51 | turtle.dig() | |
52 | if turtle.forward() then | |
53 | distance = distance + 1 | |
54 | end --if | |
55 | turtle.digUp() | |
56 | turtle.moveUp() | |
57 | turtle.digUp() | |
58 | turtle.moveUp() | |
59 | turtle.digUp() | |
60 | turtle.moveUp() | |
61 | turtle.digUp() | |
62 | turtle.moveUp() | |
63 | turtle.moveDown(4) | |
64 | turtle.select(1) | |
65 | turtle.placeDown() | |
66 | ||
67 | -- Places a torch every 10 blocks | |
68 | if distance == 10 then | |
69 | turtle.select(16) | |
70 | print("Placing tunnel torch...") | |
71 | turnAround() | |
72 | turtle.place() | |
73 | turnAround() | |
74 | distance = 0 | |
75 | checkFuel() | |
76 | end --if | |
77 | end --for | |
78 | ||
79 | -- Sends the turtle back to the start | |
80 | turtle.up() | |
81 | for index = 1,givenLength do | |
82 | turtle.back() | |
83 | end --for | |
84 | turtle.down() | |
85 | end --tunnel() | |
86 | ||
87 | -- Main script | |
88 | print("Input tunnel length:") | |
89 | local length = read() | |
90 | print("Tunnel quantity") | |
91 | local quantity = read() | |
92 | local torchNext = 0 | |
93 | print("starting excavation...") | |
94 | checkFuel() | |
95 | -- Tunnel loop | |
96 | for index=1,quantity do | |
97 | if torchNext == 3 then | |
98 | torchNext = 0 | |
99 | end | |
100 | tunnel(length) | |
101 | checkFuel() | |
102 | digNext(torchNext) | |
103 | torchNext = torchNext + 1 | |
104 | end | |
105 | print("The tunnel(s) has been excavated!") |