SHOW:
|
|
- or go back to the newest paste.
1 | --made by DiamondFireZ | |
2 | --Fuel goes to slot 16 | |
3 | --Torches goes to slot 15 | |
4 | --chests goes to slot 14 | |
5 | ||
6 | function fuelling() | |
7 | if turtle.getFuelLevel() <= 10 then | |
8 | print("Adding Fuel...") | |
9 | turtle.select(16) | |
10 | turtle.refuel(1) | |
11 | turtle.select(1) | |
12 | print("Done.") | |
13 | end | |
14 | end | |
15 | ||
16 | function turnAround() | |
17 | turtle.turnLeft() | |
18 | turtle.turnLeft() | |
19 | end | |
20 | ||
21 | function turnAround2Left() | |
22 | turtle.turnLeft() | |
23 | turtle.dig() | |
24 | if turtle.detect() then | |
25 | for index = 1,5 do | |
26 | turtle.dig() | |
27 | end | |
28 | end | |
29 | turtle.forward() | |
30 | turtle.digUp() | |
31 | turtle.turnLeft() | |
32 | end | |
33 | ||
34 | function nextPlaceLeft() | |
35 | turtle.turnRight() | |
36 | turtle.dig() | |
37 | turtle.forward() | |
38 | turtle.digUp() | |
39 | turtle.dig() | |
40 | turtle.forward() | |
41 | turtle.digUp() | |
42 | turtle.dig() | |
43 | turtle.forward() | |
44 | turtle.digUp() | |
45 | turtle.turnRight() | |
46 | end | |
47 | ||
48 | function turnAround2Right() | |
49 | turtle.turnRight() | |
50 | turtle.dig() | |
51 | if turtle.detect() then | |
52 | for index = 1,5 do | |
53 | turtle.dig() | |
54 | end | |
55 | end | |
56 | turtle.forward() | |
57 | turtle.digUp() | |
58 | turtle.turnRight() | |
59 | end | |
60 | ||
61 | function nextPlaceRight() | |
62 | turtle.turnLeft() | |
63 | turtle.dig() | |
64 | turtle.forward() | |
65 | turtle.digUp() | |
66 | turtle.dig() | |
67 | turtle.forward() | |
68 | turtle.digUp() | |
69 | turtle.dig() | |
70 | turtle.forward() | |
71 | turtle.digUp() | |
72 | turtle.turnLeft() | |
73 | end | |
74 | ||
75 | function tunnelling(givenLenght) | |
76 | local distance = 0 | |
77 | for index = 1,givenLenght do | |
78 | if turtle.detect() then | |
79 | for index = 1,5 do | |
80 | turtle.dig() | |
81 | end | |
82 | end | |
83 | turtle.forward() | |
84 | distance = distance + 1 | |
85 | turtle.digUp() | |
86 | turtle.select(1) | |
87 | fuelling() | |
88 | ||
89 | if distance == 10 then | |
90 | print("Placing torch...") | |
91 | turtle.select(15) | |
92 | turnAround() | |
93 | turtle.place() | |
94 | turnAround() | |
95 | distance = 0 | |
96 | end | |
97 | end | |
98 | end | |
99 | ||
100 | function tunnellingBack(givenLenght) | |
101 | ||
102 | for index = 1,givenLenght do | |
103 | if turtle.detect() then | |
104 | for index = 1,5 do | |
105 | turtle.dig() | |
106 | end | |
107 | end | |
108 | turtle.forward() | |
109 | turtle.digUp() | |
110 | turtle.select(1) | |
111 | fuelling() | |
112 | end | |
113 | ||
114 | end | |
115 | ||
116 | function chestAndDrop() | |
117 | turtle.select(14) | |
118 | turtle.dig() | |
119 | print("Placing chest...") | |
120 | turtle.place() | |
121 | print("Dropping items to chest...") | |
122 | local selected = 0 | |
123 | for index = 1,13 do | |
124 | selected = selected + 1 | |
125 | turtle.select(selected) | |
126 | print(selected) | |
127 | turtle.drop() | |
128 | end | |
129 | turtle.select(1) | |
130 | print("Done!") | |
131 | end | |
132 | ||
133 | ||
134 | print("Starting program...") | |
135 | print("--------------------------") | |
136 | print("Version 0.2 release, build/test 14") | |
137 | print("--------------------------") | |
138 | print("Fuel goes to slot 16") | |
139 | print("Torches goes to slot 15") | |
140 | print("Chests goes to slot 14") | |
141 | print("--------------------------") | |
142 | print("What will be the tunnel lenght?") | |
143 | local lenght = read() | |
144 | print("--------------------------") | |
145 | print("How many tunnels will the turtle make?") | |
146 | local tunnels = read() | |
147 | print("--------------------------") | |
148 | print("Which way the tunnels will go? (left=1/right=2)") | |
149 | local way = read() | |
150 | print("--------------------------") | |
151 | print("Starting to work...") | |
152 | print("--------------------------") | |
153 | fuelling() | |
154 | for index = 1,tunnels do | |
155 | tunnelling(lenght) | |
156 | if way == "1" then | |
157 | turnAround2Left() | |
158 | elseif way == "2" then | |
159 | turnAround2Right() | |
160 | else | |
161 | print("ERR-1. You have not chosen right or left!") | |
162 | return 0 | |
163 | end | |
164 | tunnellingBack(lenght) | |
165 | chestAndDrop() | |
166 | ||
167 | if way == "1" then | |
168 | nextPlaceLeft() | |
169 | elseif way == "2" then | |
170 | nextPlaceRight() | |
171 | else | |
172 | print("ERR-1. You have not chosen right or left!") | |
173 | return 0 | |
174 | end | |
175 | end | |
176 | print("Tunnel's are ready.") | |
177 | print("Program Stopped.") |