SHOW:
|
|
- or go back to the newest paste.
1 | local fackelabstand = 8 | |
2 | local fackelzaehler = 0 | |
3 | local invposfackel = 0 | |
4 | local invposchest = 0 | |
5 | local invposcoal = 0 | |
6 | ||
7 | function vor() | |
8 | - | while not turtle.forward() do |
8 | + | while not turtle.forward() do |
9 | - | turtle.dig() |
9 | + | turtle.dig() |
10 | - | end |
10 | + | end |
11 | - | while turtle.detectUp() do |
11 | + | while turtle.detectUp() do |
12 | - | turtle.digUp() |
12 | + | turtle.digUp() |
13 | - | end |
13 | + | end |
14 | - | turtle.digDown() |
14 | + | turtle.digDown() |
15 | - | if turtle.getFuelLevel() < 10 then |
15 | + | if turtle.getFuelLevel() < 10 then |
16 | - | turtle.select(invposcoal) |
16 | + | turtle.select(invposcoal) |
17 | - | turtle.refuel() |
17 | + | turtle.refuel() |
18 | - | turtle.select(1) |
18 | + | turtle.select(1) |
19 | - | end |
19 | + | end |
20 | end | |
21 | ||
22 | function fackel() | |
23 | - | if (fackelzaehler>=fackelabstand) and (invposfackel ~=0) then |
23 | + | if (fackelzaehler>=fackelabstand) and (invposfackel ~=0) then |
24 | - | turtle.turnRight() |
24 | + | turtle.turnRight() |
25 | - | turtle.turnRight() |
25 | + | turtle.turnRight() |
26 | - | turtle.select(invposfackel) |
26 | + | |
27 | - | if turtle.place() then |
27 | + | turtle.select(invposfackel) |
28 | - | fackelzaehler = 0 |
28 | + | if turtle.place() then |
29 | - | if turtle.getItemCount(invposfackel) == 0 then |
29 | + | fackelzaehler = 0 |
30 | - | invposfackel = 0 |
30 | + | if turtle.getItemCount(invposfackel) == 0 then |
31 | - | end |
31 | + | invposfackel = 0 |
32 | - | else |
32 | + | end |
33 | - | fackelzaehler = fackelzaehler-2 |
33 | + | else |
34 | - | end |
34 | + | fackelzaehler = fackelzaehler-2 |
35 | - | turtle.select(1) |
35 | + | end |
36 | - | turtle.turnRight() |
36 | + | turtle.select(1) |
37 | - | turtle.turnRight() |
37 | + | |
38 | - | else |
38 | + | turtle.turnRight() |
39 | - | fackelzaehler = fackelzaehler+1 |
39 | + | turtle.turnRight() |
40 | - | end |
40 | + | else |
41 | fackelzaehler = fackelzaehler+1 | |
42 | end | |
43 | end | |
44 | - | for j=1,laenge do |
44 | + | |
45 | - | vor() |
45 | + | |
46 | - | fackel() |
46 | + | for j=1,laenge do |
47 | - | end |
47 | + | vor() |
48 | fackel() | |
49 | end | |
50 | end | |
51 | - | for q=1,16 do |
51 | + | |
52 | - | if (q ~= invposchest) and (q ~= invposcoal) and (q ~= invposfackel) then |
52 | + | |
53 | - | turtle.select(q) |
53 | + | for q=1,16 do |
54 | - | turtle.drop() |
54 | + | if (q ~= invposchest) and (q ~= invposcoal) and (q ~= invposfackel) then |
55 | - | end |
55 | + | turtle.select(q) |
56 | - | end |
56 | + | turtle.drop() |
57 | end | |
58 | end | |
59 | end | |
60 | - | if (turtle.getItemCount(13)>0) and (invposchest ~= 0) then |
60 | + | |
61 | - | turtle.dig() |
61 | + | |
62 | if (turtle.getItemCount(13)>0) and (invposchest ~= 0) then | |
63 | - | turtle.dig() |
63 | + | turtle.dig() |
64 | - | turtle.select(invposchest) |
64 | + | turtle.down() |
65 | - | turtle.place() |
65 | + | turtle.dig() |
66 | - | abladen() |
66 | + | turtle.select(invposchest) |
67 | turtle.place() | |
68 | - | turtle.select(1) |
68 | + | abladen() |
69 | - | end |
69 | + | turtle.up() |
70 | turtle.select(1) | |
71 | end | |
72 | end | |
73 | - | for k=1,abstand do |
73 | + | |
74 | - | vor() |
74 | + | |
75 | - | fackel() |
75 | + | for k=1,abstand do |
76 | - | end |
76 | + | vor() |
77 | fackel() | |
78 | end | |
79 | - | function drehen() |
79 | + | |
80 | - | if richtung == "r" then |
80 | + | |
81 | - | turtle.turnRight() |
81 | + | function drehen(currentGang) |
82 | - | quer() |
82 | + | if richtung == "r" then |
83 | - | turtle.turnRight() |
83 | + | turtle.turnRight() |
84 | - | richtung = "l" |
84 | + | quer() |
85 | - | else |
85 | + | turtle.turnRight() |
86 | - | turtle.turnLeft() |
86 | + | richtung = "l" |
87 | - | quer() |
87 | + | if currentGang > 0 then |
88 | - | turtle.turnLeft() |
88 | + | write("Gang ") |
89 | - | richtung = "r" |
89 | + | write(currentGang) |
90 | - | end |
90 | + | write(" fertig.\n") |
91 | end | |
92 | else | |
93 | turtle.turnLeft() | |
94 | - | for l=1,16 do |
94 | + | quer() |
95 | - | data = turtle.getItemDetail(l) |
95 | + | turtle.turnLeft() |
96 | - | if data then |
96 | + | richtung = "r" |
97 | - | if data.name == "minecraft:torch" then |
97 | + | if currentGang > 0 then |
98 | - | invposfackel = l |
98 | + | write("Gang ") |
99 | - | elseif data.name == "minecraft:chest" then |
99 | + | write(currentGang) |
100 | - | invposchest = l |
100 | + | write(" fertig.\n") |
101 | - | elseif data.name == "minecraft:coal" then |
101 | + | end |
102 | - | invposcoal = l |
102 | + | end |
103 | - | end |
103 | + | |
104 | - | end |
104 | + | |
105 | - | end |
105 | + | |
106 | for l=1,16 do | |
107 | data = turtle.getItemDetail(l) | |
108 | if data then | |
109 | - | if (invposcoal ~= 0) and (invposcoal ~= 1) then |
109 | + | if data.name == "minecraft:torch" then |
110 | - | turtle.select(invposcoal) |
110 | + | invposfackel = l |
111 | - | if turtle.transferTo(1) then |
111 | + | elseif data.name == "minecraft:chest" then |
112 | - | invposcoal = 1 |
112 | + | invposchest = l |
113 | - | end |
113 | + | elseif data.name == "minecraft:coal" then |
114 | - | end |
114 | + | invposcoal = l |
115 | - | if (invposfackel ~= 0) and (invposfackel ~= 2) then |
115 | + | end |
116 | - | turtle.select(invposfackel) |
116 | + | end |
117 | - | if turtle.transferTo(2) then |
117 | + | end |
118 | - | invposfackel = 2 |
118 | + | |
119 | - | end |
119 | + | |
120 | - | end |
120 | + | |
121 | - | if (invposchest ~= 0) and (invposchest ~= 3) then |
121 | + | if (invposcoal ~= 0) and (invposcoal ~= 1) then |
122 | - | turtle.select(invposchest) |
122 | + | turtle.select(invposcoal) |
123 | - | if turtle.transferTo(3) then |
123 | + | if turtle.transferTo(1) then |
124 | - | invposchest = 3 |
124 | + | invposcoal = 1 |
125 | - | end |
125 | + | end |
126 | - | end |
126 | + | end |
127 | - | turtle.select(1) |
127 | + | if (invposfackel ~= 0) and (invposfackel ~= 2) then |
128 | turtle.select(invposfackel) | |
129 | if turtle.transferTo(2) then | |
130 | invposfackel = 2 | |
131 | - | needed = (laenge+abstand)*anzahl*2 |
131 | + | end |
132 | - | if turtle.getFuelLevel() < needed then |
132 | + | end |
133 | - | if invposcoal == 0 then |
133 | + | if (invposchest ~= 0) and (invposchest ~= 3) then |
134 | - | write("[Fuelcheck] !!!ACHTUNG!!! Treibstoff nicht ausreichend\n") |
134 | + | turtle.select(invposchest) |
135 | - | else |
135 | + | if turtle.transferTo(3) then |
136 | - | diff = needed - turtle.getFuelLevel() |
136 | + | invposchest = 3 |
137 | - | if turtle.getItemCount(invposcoal) >= (diff/80) then |
137 | + | end |
138 | - | turtle.select(invposcoal) |
138 | + | end |
139 | - | while turtle.getFuelLevel() < needed do |
139 | + | turtle.select(1) |
140 | - | turtle.refuel() |
140 | + | |
141 | - | end |
141 | + | |
142 | - | write("[Fuelcheck] Treibstoff nachgefüllt\n") |
142 | + | |
143 | - | else |
143 | + | needed = (laenge+abstand)*anzahl*2 |
144 | - | write("[Fuelcheck] !!!ACHTUNG!!! Treibstoff nicht ausreichend\n") |
144 | + | if turtle.getFuelLevel() < needed then |
145 | - | end |
145 | + | if invposcoal == 0 then |
146 | - | end |
146 | + | write("[Fuelcheck] !!!ACHTUNG!!! Treibstoff nicht ausreichend\n") |
147 | - | else |
147 | + | else |
148 | - | write("[Fuelcheck] Treibstoff ausreichend\n") |
148 | + | diff = needed - turtle.getFuelLevel() |
149 | - | end |
149 | + | if turtle.getItemCount(invposcoal) >= (diff/80) then |
150 | - | write("Abbrechen mit 'x', sonst start... ") |
150 | + | turtle.select(invposcoal) |
151 | - | auswahl = io.read() |
151 | + | while turtle.getFuelLevel() < needed do |
152 | - | if auswahl == "x" then |
152 | + | turtle.refuel() |
153 | - | error() |
153 | + | end |
154 | - | end |
154 | + | write("[Fuelcheck] Treibstoff nachgefüllt\n") |
155 | else | |
156 | write("[Fuelcheck] !!!ACHTUNG!!! Treibstoff nicht ausreichend\n") | |
157 | end | |
158 | end | |
159 | else | |
160 | write("[Fuelcheck] Treibstoff ausreichend\n") | |
161 | end | |
162 | write("Abbrechen mit 'x', sonst start... ") | |
163 | auswahl = io.read() | |
164 | if auswahl == "x" then | |
165 | error() | |
166 | - | --write("Abstand der Gänge: ") |
166 | + | end |
167 | - | --abstand = io.read() |
167 | + | |
168 | - | --abstand = abstand+1 |
168 | + | |
169 | - | abstand = 3 |
169 | + | |
170 | term.clear() | |
171 | write("Im Hauptgang links oder rechts in Kopfhöhe an die Wand setzen\n") | |
172 | write("Fackeln, Kisten, Kohle ins Inventar\n") | |
173 | write("!!!UNTERSTE REIHE BLEIBT FREI!!!\n") | |
174 | ||
175 | write("\nLaenge der Gänge: ") | |
176 | laenge = io.read() | |
177 | ||
178 | write("Abstand der Gänge: ") | |
179 | abstand = io.read() | |
180 | - | invcheck() |
180 | + | abstand = abstand+1 |
181 | - | invsort() |
181 | + | --abstand = 3 |
182 | - | gang() |
182 | + | if abstand <= 0 then |
183 | - | voll() |
183 | + | fackelabstand = (((laenge*2)/100)*70) |
184 | - | invcheck() |
184 | + | |
185 | - | invsort() |
185 | + | |
186 | - | drehen() |
186 | + | |
187 | - | gang() |
187 | + | |
188 | - | voll() |
188 | + | |
189 | - | drehen() |
189 | + | |
190 | write("rechts (r) oder links (l): ") | |
191 | richtung = read() | |
192 | term.clear() | |
193 | fuelcheck() | |
194 | for i=1,anzahl do | |
195 | invcheck() | |
196 | invsort() | |
197 | gang() | |
198 | voll() | |
199 | invcheck() | |
200 | invsort() | |
201 | drehen(0) | |
202 | gang() | |
203 | voll() | |
204 | drehen(i) | |
205 | end |