SHOW:
|
|
- or go back to the newest paste.
1 | --MINING A STRIPMINE | |
2 | ||
3 | --Local variables | |
4 | local depth = 5 | |
5 | local turnLeft = true | |
6 | local number_of_tunnel_pairs = 2 | |
7 | local piller_size = 3 | |
8 | ||
9 | --FUNCTIONS | |
10 | --REFUEL WAITING | |
11 | - | u() |
11 | + | |
12 | print("TURTLE NEEDS FUEL in slot 1") | |
13 | while true do | |
14 | sleep(1) | |
15 | if turtle.getFuelLevel() > 1 then | |
16 | break | |
17 | end | |
18 | end | |
19 | end | |
20 | ||
21 | ||
22 | --UPPDATE FUEL | |
23 | local function uppdateFuel(rFL) | |
24 | - | local function u() |
24 | + | |
25 | - | print("u") |
25 | + | |
26 | if turtle.getItemCount() <= 1 then | |
27 | waitForRefueling() --MAKE FUNCTION | |
28 | end | |
29 | turtle.refuel(1) | |
30 | end | |
31 | end | |
32 | ||
33 | ||
34 | --GOING FOREWARD ONCE | |
35 | local function forewardOnce() | |
36 | uppdateFuel(200) | |
37 | while turtle.detect() do | |
38 | turtle.dig() | |
39 | end | |
40 | turtle.forward() | |
41 | if turtle.detectUp() then | |
42 | turtle.digUp() | |
43 | end | |
44 | if turtle.detectDown() then | |
45 | turtle.digDown() | |
46 | end | |
47 | end | |
48 | ||
49 | ||
50 | -- GOING FOREWARD IN A LINE | |
51 | local function forewardLine(Length) | |
52 | current_length = Length | |
53 | while current_length > 0 do | |
54 | forewardOnce() | |
55 | current_length = current_length - 1 | |
56 | end | |
57 | end | |
58 | ||
59 | ||
60 | --TURN AT END OF THE LINE | |
61 | local function turnAtEndOfLine() | |
62 | if turnLeft == true then | |
63 | turtle.turnLeft() | |
64 | else | |
65 | turtle.turnRight() | |
66 | end | |
67 | forewardLine(piller_size + 1) | |
68 | if turnLeft == true then | |
69 | turtle.turnLeft() | |
70 | else | |
71 | turtle.turnRight() | |
72 | end | |
73 | end | |
74 | ||
75 | ||
76 | --DO TUNNEL PAIR | |
77 | local function tunnelPair() | |
78 | forewardLine(depth) | |
79 | turnAtEndOfLine() | |
80 | forewardLine(depth) | |
81 | end | |
82 | ||
83 | ||
84 | --FUNCTION FOR FUNCTION BELLOW !IGNORE! | |
85 | local function turnSync() | |
86 | if turnLeft == true then | |
87 | turtle.turnLeft() | |
88 | else | |
89 | turtle.turnRight() | |
90 | end | |
91 | end | |
92 | ||
93 | ||
94 | --FUNCTION FOR FUNCTION BELOW !IGNORE! | |
95 | local function turnSyncReverse() | |
96 | if turnLeft == true then | |
97 | turtle.turnRight() | |
98 | else | |
99 | turtle.turnLeft() | |
100 | end | |
101 | end | |
102 | ||
103 | ||
104 | --TURN AT FRONT OF LINE | |
105 | local function turnAtFrontOfLine() | |
106 | turnSync() | |
107 | forewardLine(piller_size) | |
108 | turnSyncReverse() | |
109 | forewardOnce() | |
110 | turnSyncReverse() | |
111 | forewardLine(2*piller_size + 1) | |
112 | turnSyncReverse() | |
113 | forewardOnce() | |
114 | ||
115 | --Take away ugly stuff | |
116 | turnSyncReverse() | |
117 | forewardLine(piller_size) | |
118 | ||
119 | N = piller_size | |
120 | while N > 0 do | |
121 | turtle.back() | |
122 | N = N - 1 | |
123 | end | |
124 | ||
125 | turnSync() | |
126 | ||
127 | end | |
128 | ||
129 | ||
130 | --MAIN | |
131 | local function main() | |
132 | current_tunnel_pair = 1 | |
133 | while current_tunnel_pair <= number_of_tunnel_pairs do | |
134 | tunnelPair() | |
135 | turnAtFrontOfLine() | |
136 | current_tunnel_pair = current_tunnel_pair + 1 | |
137 | end | |
138 | end | |
139 | ||
140 | ||
141 | --GETTING INPUT FUNCTION | |
142 | local function askForInput() | |
143 | print("NOT MADE YET") | |
144 | end | |
145 | ||
146 | ||
147 | --RUNNING PROGRAM | |
148 | askForInput() | |
149 | main() |