SHOW:
|
|
- or go back to the newest paste.
1 | refill = function() | |
2 | turtle.select(1) | |
3 | if turtle.getFuelLevel() < 50 then | |
4 | repeat | |
5 | sleep(3) | |
6 | empty() | |
7 | turtle.digUp() | |
8 | turtle.placeUp() | |
9 | turtle.suckUp() | |
10 | turtle.refuel(64) | |
11 | turtle.dropUp() | |
12 | empty() | |
13 | turtle.digUp() | |
14 | until turtle.getFuelLevel() > 50 | |
15 | end | |
16 | end | |
17 | lastempty = function() | |
18 | turtle.digUp() | |
19 | - | for i = 3, 16, 1 |
19 | + | |
20 | turtle.placeUp() | |
21 | for i = 4, 16, 1 | |
22 | do | |
23 | turtle.select(i) | |
24 | turtle.dropUp(64) | |
25 | end | |
26 | turtle.select(2) | |
27 | turtle.digUp() | |
28 | turtle.select(1) | |
29 | end | |
30 | empty = function() | |
31 | if turtle.getItemCount(15) >= 1 then | |
32 | turtle.digUp() | |
33 | - | for i = 3, 16, 1 |
33 | + | |
34 | turtle.placeUp() | |
35 | for i = 4, 16, 1 | |
36 | do | |
37 | turtle.select(i) | |
38 | turtle.dropUp(64) | |
39 | end | |
40 | turtle.select(2) | |
41 | turtle.digUp() | |
42 | turtle.select(1) | |
43 | end | |
44 | end | |
45 | place = function() | |
46 | blockrefill() | |
47 | turtle.select(4) | |
48 | turtle.placeDown() | |
49 | turtle.select(1) | |
50 | end | |
51 | ||
52 | blockrefill = function() | |
53 | if turtle.getItemCount(4) <= 1 then | |
54 | empty() | |
55 | turtle.select(4) | |
56 | turtle.transferTo(16) | |
57 | turtle.select(5) | |
58 | turtle.digUp() | |
59 | turtle.select(3) | |
60 | turtle.placeUp() | |
61 | turtle.select(4) | |
62 | turtle.suckUp(64) | |
63 | turtle.select(3) | |
64 | turtle.digUp() | |
65 | end | |
66 | turtle.select(1) | |
67 | end | |
68 | destroy = function() | |
69 | empty() | |
70 | turtle.digDown() | |
71 | place() | |
72 | turtle.digUp() | |
73 | while turtle.detect() == true do | |
74 | turtle.dig() | |
75 | end | |
76 | end | |
77 | lastdestroy = function() | |
78 | empty() | |
79 | turtle.digUp() | |
80 | turtle.digDown() | |
81 | place() | |
82 | end | |
83 | row = function(distance) | |
84 | for i = 0, distance, 1 | |
85 | do | |
86 | destroy() | |
87 | refill() | |
88 | turtle.forward() | |
89 | end | |
90 | end | |
91 | righthook = function() | |
92 | empty() | |
93 | turtle.turnRight() | |
94 | destroy() | |
95 | refill() | |
96 | turtle.forward() | |
97 | turtle.turnRight() | |
98 | end | |
99 | lefthook = function() | |
100 | empty() | |
101 | turtle.turnLeft() | |
102 | destroy() | |
103 | refill() | |
104 | turtle.forward() | |
105 | turtle.turnLeft() | |
106 | end | |
107 | square = function(Length, Depth) | |
108 | empty() | |
109 | if Length % 2 == 0 then | |
110 | for i = 1, Length, 2 | |
111 | do | |
112 | row(Depth) | |
113 | righthook() | |
114 | row(Depth) | |
115 | lefthook() | |
116 | end | |
117 | row(Depth) | |
118 | righthook() | |
119 | row(Depth) | |
120 | lastdestroy() | |
121 | turtle.turnRight() | |
122 | for i = 0, Length, 1 | |
123 | do | |
124 | refill() | |
125 | turtle.forward() | |
126 | end | |
127 | turtle.turnRight() | |
128 | elseif Length % 2 ~= 0 then | |
129 | for i = 0, Length, 2 | |
130 | do | |
131 | row(Depth) | |
132 | righthook() | |
133 | row(Depth) | |
134 | lefthook() | |
135 | end | |
136 | row(Depth) | |
137 | lastdestroy() | |
138 | turtle.turnLeft() | |
139 | turtle.turnLeft() | |
140 | for i = 0, Depth, 1 | |
141 | do | |
142 | refill() | |
143 | turtle.forward() | |
144 | end | |
145 | turtle.turnRight() | |
146 | for i = 0, Length, 1 | |
147 | do | |
148 | refill() | |
149 | turtle.forward() | |
150 | end | |
151 | turtle.turnRight() | |
152 | elseif Length == 0 then | |
153 | row(Depth) | |
154 | turtle.turnLeft() | |
155 | turtle.turnLeft() | |
156 | for i = 0, Depth, 1 | |
157 | do | |
158 | refill() | |
159 | turtle.forward() | |
160 | end | |
161 | turtle.turnRight() | |
162 | turtle.turnRight() | |
163 | elseif Depth == 0 then | |
164 | turtle.turnRight() | |
165 | row(Length) | |
166 | turtle.turnLeft() | |
167 | turtle.turnLeft() | |
168 | for i = 0, Length, 1 | |
169 | do | |
170 | refill() | |
171 | turtle.forward() | |
172 | end | |
173 | turtle.turnRight() | |
174 | end | |
175 | lastempty() | |
176 | end | |
177 | ||
178 | term.write("Select Depth: ") | |
179 | local depth = read() | |
180 | depth = depth - 2 | |
181 | term.write("Select Length: ") | |
182 | local length = read() | |
183 | length = length - 2 | |
184 | ||
185 | blockrefill() | |
186 | refill() | |
187 | ||
188 | square(length, depth) | |
189 | print("Mining Completed") |