SHOW:
|
|
- or go back to the newest paste.
1 | --Written by rahph. | |
2 | --Send nukes I mean nudes | |
3 | --Anyway, config | |
4 | local sV = "Release 1.14" | |
5 | local tape0 = peripheral.wrap("tape_drive_3") | |
6 | local tape1 = peripheral.wrap("tape_drive_0") | |
7 | local tape2 = peripheral.wrap("tape_drive_2") | |
8 | - | local lowestVolume = 0 |
8 | + | |
9 | - | local defaultVolume = 0.5 |
9 | + | local floor = peripheral.wrap("monitor_17") |
10 | - | local highestVolume = 1 |
10 | + | |
11 | - | local lowestSpeed = 0.25 |
11 | + | local oldwrite = nil |
12 | - | local defaultSpeed = 1 |
12 | + | local oldbg = nil |
13 | - | local highestSpeed = 2 |
13 | + | local oldfg = nil |
14 | local lampConnected = 0 | |
15 | local function rewrite() | |
16 | oldwrite = mon.write | |
17 | oldbg = mon.setBackgroundColor | |
18 | oldfg = mon.setTextColor | |
19 | mon.write = function(text) oldwrite(text) sleep(0.05) end | |
20 | mon.setBackgroundColor = function(col) oldbg(col) sleep(0.05) end | |
21 | - | objloc.tape[1]["volume"] = {} |
21 | + | mon.setTextColor = function(col) oldfg(col) sleep(0.05) end |
22 | - | objloc.tape[1]["volume"]["up"] = {} |
22 | + | |
23 | - | objloc.tape[1]["volume"]["down"] = {} |
23 | + | local function play(id) |
24 | - | objloc.tape[1]["speed"] = objloc.tape[1]["volume"] |
24 | + | if id == 1 then tape0.play() end |
25 | - | objloc.tape[2] = objloc.tape[1] |
25 | + | if id == 2 then tape1.play() end |
26 | - | objloc.tape[3] = objloc.tape[1] |
26 | + | if id == 3 then tape2.play() end |
27 | - | objloc.tape[4] = objloc.tape[1] |
27 | + | if id == 4 then tape3.play() end |
28 | end | |
29 | local err = {} | |
30 | err["mt"] = {} | |
31 | err["lt"] = {} | |
32 | function errorReport() | |
33 | ||
34 | mon.setTextScale(0.5) | |
35 | x,y = mon.getSize() | |
36 | mon.setPaletteColor(colors.blue,0x0000FF) | |
37 | mon.setPaletteColor(colors.white,0xFFFFFF) | |
38 | mon.clear() | |
39 | mon.setBackgroundColor(colors.blue) | |
40 | mon.clear() | |
41 | mon.setTextColor(colors.white) | |
42 | mon.setCursorPos(1,2) | |
43 | mon.setPaletteColor(colors.gray,0x99AAB5) | |
44 | mon.setTextColor(colors.gray) | |
45 | for i=1,x do mon.write("\127") end | |
46 | - | mon.write(" DISCO CONTROLL ") |
46 | + | mon.setCursorPos(1,1) |
47 | for i=1,x do mon.write("\127") end | |
48 | mon.setCursorPos(1,3) | |
49 | for i=1,x do mon.write("\127") end | |
50 | mon.setTextColor(colors.white) | |
51 | mon.setCursorPos((x-16)/2+1,2) | |
52 | mon.write(" DISCO CONTROL! ") | |
53 | mon.setCursorPos(3,4) | |
54 | mon.write("The program has ran into an issue") | |
55 | mon.setCursorPos(3,5) | |
56 | mon.write("The following is an error report given to us.") | |
57 | mon.setCursorPos(3,6) | |
58 | if err["mt"][1] ~= nil then | |
59 | - | mon.write("LIGHTS [ ]") |
59 | + | mon.write(err["mt"][2] .. " @ Main thread") |
60 | end | |
61 | if err["lt"][1] ~= nil then | |
62 | mon.write(err["lt"][2] .. " @ Lamp thread") | |
63 | end | |
64 | mon.setCursorPos(3,y-1) | |
65 | mon.write("Thats all we know") | |
66 | mon.setCursorPos(3,9) | |
67 | mon.write("Dumping report...") | |
68 | mon.setCursorPos(3,10) | |
69 | fname = "/RCrashes/DiscoCrash" .. "-" .. os.day() .. "-" .. os.time() | |
70 | mon.write("File name: " .. fname) | |
71 | mon.setCursorPos(3,11) | |
72 | mon.write("[##") | |
73 | oFile = fs.open(fname,"w") | |
74 | mon.write("####") | |
75 | oFile.write(textutils.serialise(err)) | |
76 | mon.write("######") | |
77 | oFile.flush() | |
78 | mon.write("###") | |
79 | oFile.close() | |
80 | mon.write("###]") | |
81 | mon.setCursorPos(3,12) | |
82 | mon.write("Thats all we know") | |
83 | mon.setCursorPos(3,y-1) | |
84 | mon.write("Restarting in 10 seconds") | |
85 | mon.setCursorPos(1,y) | |
86 | for i=1,x do sleep(10/x) mon.write("X") end | |
87 | end | |
88 | local function rewind(id) | |
89 | if id == 1 then tape0.seek(-tape0.getSize()) end | |
90 | - | objloc.tape[1].volume.down = ((x/2)-8)/2 |
90 | + | if id == 2 then tape1.seek(-tape1.getSize()) end |
91 | - | objloc.tape[1].volume.up = objloc.tape[1].volume.down + 7 |
91 | + | if id == 3 then tape2.seek(-tape2.getSize()) end |
92 | if id == 4 then tape3.seek(-tape3.getSize()) end | |
93 | end | |
94 | ||
95 | - | mon.setCursorPos(objloc.tape[1].volume.down,7) |
95 | + | local function pause(id) |
96 | if id == 1 then tape0.stop() end | |
97 | if id == 2 then tape1.stop() end | |
98 | if id == 3 then tape2.stop() end | |
99 | if id == 4 then tape3.stop() end | |
100 | end | |
101 | ||
102 | local function round(num, n) | |
103 | local mult = 10^(n or 0) | |
104 | return math.floor(num * mult + 0.5) / mult | |
105 | end | |
106 | mon = peripheral.wrap("top") | |
107 | --rewrite() | |
108 | - | redraw({1,1.02,0.25,2},{1,1,2,2},false) |
108 | + | |
109 | ||
110 | mon.setTextScale(1) | |
111 | x,y = mon.getSize() | |
112 | local objloc = {} | |
113 | objloc["tape"] = {} | |
114 | objloc.tape[1] = {} | |
115 | objloc.tape[1]["volume"] = {up=0,down=0} | |
116 | objloc.tape[1]["speed"] = {up=0,down=0} | |
117 | objloc.tape[1]["ctrlr"] = {0,0} | |
118 | objloc.tape[2] = {} | |
119 | objloc.tape[2]["volume"] = {up=0,down=0} | |
120 | objloc.tape[2]["speed"] = {up=0,down=0} | |
121 | objloc.tape[2]["ctrlr"] = {0,0} | |
122 | objloc.tape[3] = {} | |
123 | objloc.tape[3]["volume"] = {up=0,down=0} | |
124 | objloc.tape[3]["speed"] = {up=0,down=0} | |
125 | objloc.tape[3]["ctrlr"] = {0,0} | |
126 | objloc.tape[4] = {} | |
127 | objloc.tape[4]["volume"] = {up=0,down=0} | |
128 | objloc.tape[4]["speed"] = {up=0,down=0} | |
129 | objloc.tape[4]["ctrlr"] = {0,0} | |
130 | objloc.tape[1]["ctrlr"]["back"] = {4,4} | |
131 | objloc.tape[1]["ctrlr"]["stop"] = {4,5} | |
132 | objloc.tape[1]["ctrlr"]["play"] = {4,6} | |
133 | objloc.tape[2]["ctrlr"]["back"] = {28,4} | |
134 | objloc.tape[2]["ctrlr"]["stop"] = {28,5} | |
135 | objloc.tape[2]["ctrlr"]["play"] = {28,6} | |
136 | objloc.tape[3]["ctrlr"]["back"] = {4,11} | |
137 | objloc.tape[3]["ctrlr"]["stop"] = {4,12} | |
138 | objloc.tape[3]["ctrlr"]["play"] = {4,13} | |
139 | objloc.tape[4]["ctrlr"]["back"] = {28,11} | |
140 | objloc.tape[4]["ctrlr"]["stop"] = {28,12} | |
141 | objloc.tape[4]["ctrlr"]["play"] = {28,13} | |
142 | objloc.light = {} | |
143 | ||
144 | mon.setPaletteColor(colors.blue,0x23272A) | |
145 | mon.setPaletteColor(colors.white,0xFFFFFF) | |
146 | mon.clear() | |
147 | mon.setBackgroundColor(colors.blue) | |
148 | mon.clear() | |
149 | mon.setTextColor(colors.white) | |
150 | mon.setCursorPos(1,2) | |
151 | mon.setPaletteColor(colors.gray,0x99AAB5) | |
152 | mon.setTextColor(colors.gray) | |
153 | for i=1,x do mon.write("\127") end | |
154 | mon.setCursorPos(1,1) | |
155 | for i=1,x do mon.write("\127") end | |
156 | mon.setCursorPos(1,3) | |
157 | for i=1,x do mon.write("\127") end | |
158 | mon.setTextColor(colors.white) | |
159 | mon.setCursorPos((x-16)/2+1,2) | |
160 | mon.write(" DISCO CONTROL! ") | |
161 | mon.setCursorPos(((x/2)-6)/2,4) | |
162 | mon.write("TAPE 0") | |
163 | mon.setCursorPos(4,4) | |
164 | mon.write("\17") | |
165 | mon.setCursorPos(4,5) | |
166 | mon.write("\143") | |
167 | mon.setCursorPos(4,6) | |
168 | mon.write("\16") | |
169 | mon.setCursorPos((((x/2)-6)/2)+(x/2),4) | |
170 | mon.write("TAPE 1") | |
171 | mon.setCursorPos(28,4) | |
172 | mon.write("\17") | |
173 | mon.setCursorPos(28,5) | |
174 | mon.write("\143") | |
175 | mon.setCursorPos(28,6) | |
176 | mon.write("\16") | |
177 | mon.setCursorPos(((x/2)-6)/2,11) | |
178 | mon.write("TAPE 2") | |
179 | mon.setCursorPos(4,11) | |
180 | mon.write("\17") | |
181 | mon.setCursorPos(4,12) | |
182 | mon.write("\143") | |
183 | mon.setCursorPos(4,13) | |
184 | mon.write("\16") | |
185 | mon.setCursorPos((((x/2)-6)/2)+(x/2),11) | |
186 | mon.write("TAPE 3") | |
187 | mon.setCursorPos(28,11) | |
188 | mon.write("\17") | |
189 | mon.setCursorPos(28,12) | |
190 | mon.write("\143") | |
191 | mon.setCursorPos(28,13) | |
192 | mon.write("\16") | |
193 | mon.setTextColor(colors.gray) | |
194 | for i=4,y do mon.setCursorPos(25,i) mon.write("\127\127") end | |
195 | mon.setTextColor(colors.white) | |
196 | objloc.light = {((x/2)-10/2)+9,18} | |
197 | if lampConnected == 1 then | |
198 | mon.setCursorPos((x/2)-10/2,18) | |
199 | mon.write("LIGHTS [") | |
200 | if light == 0 then mon.setTextColor(colors.red) mon.write("X") mon.setTextColor(colors.white) end | |
201 | if light == 1 then mon.setTextColor(colors.orange) mon.write("-") mon.setTextColor(colors.white) end | |
202 | if light == 2 then mon.setTextColor(colors.lime) mon.write("V") mon.setTextColor(colors.white) end | |
203 | mon.write("]") | |
204 | else | |
205 | mon.setCursorPos((x/2)-15/2,18) | |
206 | mon.write("NO LIGHTS FOUND") | |
207 | end | |
208 | mon.setTextColor(colors.gray) | |
209 | mon.setCursorPos(1,19) | |
210 | for i=1,x do mon.write("\127") end | |
211 | for i=1,y do mon.setCursorPos(1,i) mon.write("\127\127") end | |
212 | for i=1,y do mon.setCursorPos(x-1,i) mon.write("\127\127") end | |
213 | mon.setCursorPos(1,10) | |
214 | --for i=1,x do mon.write("\127") end | |
215 | --mon.setCursorPos(1,11) | |
216 | for i=1,x do mon.write("\127") end | |
217 | mon.setCursorPos(1,17) | |
218 | for i=1,x do mon.write("\127") end | |
219 | mon.setCursorPos(x-#sV+1,y) | |
220 | mon.write(sV) | |
221 | mon.setCursorPos(((x/2)-6)/2,6) | |
222 | mon.write("VOLUME") | |
223 | mon.setCursorPos(((x/2)-6)/2,8) | |
224 | mon.write("SPEED:") | |
225 | mon.setCursorPos((((x/2)-6)/2)+(x/2),6) | |
226 | mon.write("VOLUME") | |
227 | mon.setCursorPos((((x/2)-6)/2)+(x/2),8) | |
228 | mon.write("SPEED:") | |
229 | mon.setCursorPos(((x/2)-6)/2,13) | |
230 | mon.write("VOLUME") | |
231 | mon.setCursorPos(((x/2)-6)/2,15) | |
232 | mon.write("SPEED:") | |
233 | mon.setCursorPos((((x/2)-6)/2)+(x/2),13) | |
234 | mon.write("VOLUME") | |
235 | mon.setCursorPos((((x/2)-6)/2)+(x/2),15) | |
236 | mon.write("SPEED:") | |
237 | mon.setBackgroundColor(colors.white) | |
238 | objloc.tape[1].volume.down = {((x/2)-8)/2-0.5,7} | |
239 | objloc.tape[1].volume.up = {objloc.tape[1].volume.down[1] + 7,7} | |
240 | mon.setPaletteColor(colors.yellow,0x7289DA) | |
241 | mon.setBackgroundColor(colors.yellow) | |
242 | mon.setTextColor(colors.white) | |
243 | mon.setCursorPos(objloc.tape[1].volume.down[1],7) | |
244 | mon.write("\171 \187") | |
245 | mon.setBackgroundColor(colors.white) | |
246 | mon.setTextColor(colors.black) | |
247 | mon.setCursorPos(((x/2)-6)/2,7) | |
248 | mon.write(" ") | |
249 | if #tostring(vol[1]) % 2 == 1 then | |
250 | mon.setCursorPos(((x/2)-#tostring(vol[1]))/2-1,7) | |
251 | else | |
252 | mon.setCursorPos(((x/2)-#tostring(vol[1]))/2,7) | |
253 | end | |
254 | mon.write(vol[1]) | |
255 | mon.setBackgroundColor(colors.white) | |
256 | objloc.tape[1].speed.down = {((x/2)-8)/2-0.5,9} | |
257 | objloc.tape[1].speed.up = {objloc.tape[1].speed.down[1] + 7,9} | |
258 | mon.setPaletteColor(colors.yellow,0x7289DA) | |
259 | mon.setBackgroundColor(colors.yellow) | |
260 | mon.setTextColor(colors.white) | |
261 | mon.setCursorPos(objloc.tape[1].speed.down[1],9) | |
262 | mon.write("\171 \187") | |
263 | mon.setBackgroundColor(colors.white) | |
264 | mon.setTextColor(colors.black) | |
265 | mon.setCursorPos(((x/2)-6)/2,9) | |
266 | mon.write(" ") | |
267 | if #tostring(speed[1]) % 2 == 1 then | |
268 | mon.setCursorPos(((x/2)-#tostring(speed[1]))/2-1,9) | |
269 | else | |
270 | mon.setCursorPos(((x/2)-#tostring(speed[1]))/2,9) | |
271 | end | |
272 | mon.write(speed[1]) | |
273 | ||
274 | mon.setBackgroundColor(colors.white) | |
275 | objloc.tape[2].volume.down = {(((x/2)-8)/2)+(x/2)-0.5,7} | |
276 | objloc.tape[2].volume.up = {objloc.tape[2].volume.down[1] + 7,7} | |
277 | mon.setPaletteColor(colors.yellow,0x7289DA) | |
278 | mon.setBackgroundColor(colors.yellow) | |
279 | mon.setTextColor(colors.white) | |
280 | mon.setCursorPos(objloc.tape[2].volume.down[1],7) | |
281 | mon.write("\171 \187") | |
282 | mon.setBackgroundColor(colors.white) | |
283 | mon.setTextColor(colors.black) | |
284 | mon.setCursorPos((((x/2)-6)/2)+(x/2),7) | |
285 | mon.write(" ") | |
286 | if #tostring(vol[2]) % 2 == 1 then | |
287 | mon.setCursorPos((((x/2)-#tostring(vol[2]))/2-1)+(x/2),7) | |
288 | else | |
289 | mon.setCursorPos((((x/2)-#tostring(vol[2]))/2)+(x/2),7) | |
290 | end | |
291 | mon.write(vol[2]) | |
292 | ||
293 | mon.setBackgroundColor(colors.white) | |
294 | objloc.tape[2].speed.down = {(((x/2)-8)/2)+(x/2)-0.5,9} | |
295 | objloc.tape[2].speed.up = {objloc.tape[2].speed.down[1] + 7,9} | |
296 | mon.setPaletteColor(colors.yellow,0x7289DA) | |
297 | mon.setBackgroundColor(colors.yellow) | |
298 | mon.setTextColor(colors.white) | |
299 | mon.setCursorPos(objloc.tape[2].speed.down[1],9) | |
300 | mon.write("\171 \187") | |
301 | mon.setBackgroundColor(colors.white) | |
302 | mon.setTextColor(colors.black) | |
303 | mon.setCursorPos((((x/2)-6)/2+(x/2)),9) | |
304 | mon.write(" ") | |
305 | if #tostring(speed[2]) % 2 == 1 then | |
306 | mon.setCursorPos((((x/2)-#tostring(speed[2]))/2-1)+(x/2),9) | |
307 | else | |
308 | mon.setCursorPos((((x/2)-#tostring(speed[2]))/2)+(x/2),9) | |
309 | end | |
310 | mon.write(speed[2]) | |
311 | mon.setBackgroundColor(colors.white) | |
312 | objloc.tape[3].volume.down = {((x/2)-8)/2-0.5,14} | |
313 | objloc.tape[3].volume.up = {objloc.tape[3].volume.down[1] + 7,14} | |
314 | mon.setPaletteColor(colors.yellow,0x7289DA) | |
315 | mon.setBackgroundColor(colors.yellow) | |
316 | mon.setTextColor(colors.white) | |
317 | mon.setCursorPos(objloc.tape[3].volume.down[1],14) | |
318 | mon.write("\171 \187") | |
319 | mon.setBackgroundColor(colors.white) | |
320 | mon.setTextColor(colors.black) | |
321 | mon.setCursorPos(((x/2)-6)/2,14) | |
322 | mon.write(" ") | |
323 | if #tostring(vol[3]) % 2 == 1 then | |
324 | mon.setCursorPos(((x/2)-#tostring(vol[3]))/2-1,14) | |
325 | else | |
326 | mon.setCursorPos(((x/2)-#tostring(vol[3]))/2,14) | |
327 | end | |
328 | mon.write(vol[3]) | |
329 | mon.setBackgroundColor(colors.white) | |
330 | objloc.tape[3].speed.down = {((x/2)-8)/2-0.5,16} | |
331 | objloc.tape[3].speed.up = {objloc.tape[3].speed.down[1] + 7,16} | |
332 | mon.setPaletteColor(colors.yellow,0x7289DA) | |
333 | mon.setBackgroundColor(colors.yellow) | |
334 | mon.setTextColor(colors.white) | |
335 | mon.setCursorPos(objloc.tape[3].speed.down[1],16) | |
336 | mon.write("\171 \187") | |
337 | mon.setBackgroundColor(colors.white) | |
338 | mon.setTextColor(colors.black) | |
339 | mon.setCursorPos(((x/2)-6)/2,16) | |
340 | mon.write(" ") | |
341 | if #tostring(speed[3]) % 2 == 1 then | |
342 | mon.setCursorPos(((x/2)-#tostring(speed[3]))/2-1,16) | |
343 | else | |
344 | mon.setCursorPos(((x/2)-#tostring(speed[3]))/2,16) | |
345 | end | |
346 | mon.write(speed[3]) | |
347 | ||
348 | mon.setBackgroundColor(colors.white) | |
349 | objloc.tape[4].volume.down = {(((x/2)-8)/2)+(x/2)-0.5,14} | |
350 | objloc.tape[4].volume.up = {objloc.tape[4].volume.down[1] + 7,14} | |
351 | mon.setPaletteColor(colors.yellow,0x7289DA) | |
352 | mon.setBackgroundColor(colors.yellow) | |
353 | mon.setTextColor(colors.white) | |
354 | mon.setCursorPos(objloc.tape[4].volume.down[1],14) | |
355 | mon.write("\171 \187") | |
356 | mon.setBackgroundColor(colors.white) | |
357 | mon.setTextColor(colors.black) | |
358 | mon.setCursorPos((((x/2)-6)/2)+(x/2),14) | |
359 | mon.write(" ") | |
360 | if #tostring(vol[4]) % 2 == 1 then | |
361 | mon.setCursorPos((((x/2)-#tostring(vol[4]))/2-1)+(x/2),14) | |
362 | else | |
363 | mon.setCursorPos((((x/2)-#tostring(vol[4]))/2)+(x/2),14) | |
364 | end | |
365 | mon.write(vol[4]) | |
366 | mon.setBackgroundColor(colors.white) | |
367 | objloc.tape[4].speed.down = {(((x/2)-8)/2)+(x/2)-0.5,16} | |
368 | objloc.tape[4].speed.up = {objloc.tape[4].speed.down[1] + 7,16} | |
369 | mon.setPaletteColor(colors.yellow,0x7289DA) | |
370 | mon.setBackgroundColor(colors.yellow) | |
371 | mon.setTextColor(colors.white) | |
372 | mon.setCursorPos(objloc.tape[4].speed.down[1],16) | |
373 | mon.write("\171 \187") | |
374 | mon.setBackgroundColor(colors.white) | |
375 | mon.setTextColor(colors.black) | |
376 | mon.setCursorPos((((x/2)-6)/2+(x/2)),16) | |
377 | mon.write(" ") | |
378 | if #tostring(speed[4]) % 2 == 1 then | |
379 | mon.setCursorPos((((x/2)-#tostring(speed[4]))/2-1)+(x/2),16) | |
380 | else | |
381 | mon.setCursorPos((((x/2)-#tostring(speed[4]))/2)+(x/2),16) | |
382 | end | |
383 | mon.write(speed[4]) | |
384 | return objloc | |
385 | end | |
386 | local currentVolume = {0.5,0.5,0.5,0.5} | |
387 | local lampStatus = 0 | |
388 | local currentSpeed = {1,1,1,1} | |
389 | function mainThread() | |
390 | while true do | |
391 | if floor.getSize() then lampConnected = 1 else lampConnected = 0 end | |
392 | tape0.setVolume(currentVolume[1]) | |
393 | tape1.setVolume(currentVolume[2]) | |
394 | tape2.setVolume(currentVolume[3]) | |
395 | tape3.setVolume(currentVolume[4]) | |
396 | tape0.setSpeed(currentSpeed[1]) | |
397 | tape1.setSpeed(currentSpeed[2]) | |
398 | tape2.setSpeed(currentSpeed[3]) | |
399 | tape3.setSpeed(currentSpeed[4]) | |
400 | local objs = redraw(currentVolume,currentSpeed,lampStatus) | |
401 | local tEvent = {os.pullEvent("monitor_touch")} | |
402 | local x = tEvent[3] | |
403 | local y = tEvent[4] | |
404 | if tEvent[2] == "top" then | |
405 | for i=1,4 do | |
406 | if objs.tape[i].volume.down[1] < x+2 and objs.tape[i].volume.down[1] > x-2 then | |
407 | if objs.tape[i].volume.down[2] == y then | |
408 | if currentVolume[i] > 0.10 then | |
409 | currentVolume[i] = currentVolume[i] - 0.05 | |
410 | currentVolume[i] = round(currentVolume[i],2) | |
411 | else currentVolume[i] = 0 end | |
412 | end | |
413 | end | |
414 | end | |
415 | for i=1,4 do | |
416 | if objs.tape[i].volume.up[1] < x+2 and objs.tape[i].volume.up[1] > x-2 then | |
417 | if objs.tape[i].volume.up[2] == y then | |
418 | if currentVolume[i] < 0.901 then | |
419 | currentVolume[i] = currentVolume[i] + 0.05 | |
420 | currentVolume[i] = round(currentVolume[i],2) | |
421 | else currentVolume[i] = 1 end | |
422 | end | |
423 | end | |
424 | end | |
425 | for i=1,4 do | |
426 | if objs.tape[i].speed.down[1] < x+2 and objs.tape[i].speed.down[1] > x-2 then | |
427 | if objs.tape[i].speed.down[2] == y then | |
428 | if currentSpeed[i] > 0.30 then | |
429 | currentSpeed[i] = currentSpeed[i] - 0.05 | |
430 | currentSpeed[i] = round(currentSpeed[i],2) | |
431 | else currentSpeed[i] = 0.25 end | |
432 | end | |
433 | end | |
434 | end | |
435 | for i=1,4 do | |
436 | if objs.tape[i].speed.up[1] < x+2 and objs.tape[i].speed.up[1] > x-2 then | |
437 | if objs.tape[i].speed.up[2] == y then | |
438 | if currentSpeed[i] < 1.90 then | |
439 | currentSpeed[i] = currentSpeed[i] + 0.05 | |
440 | currentSpeed[i] = round(currentSpeed[i],2) | |
441 | else currentSpeed[i] = 2 end | |
442 | end | |
443 | end | |
444 | end | |
445 | if y == 18 then | |
446 | if lampStatus == 0 then lampStatus = 2 elseif lampStatus == 1 then lampStatus = 0 else lampStatus = 1 end | |
447 | end | |
448 | print("Checking rewind") | |
449 | print(x .. " " .. y) | |
450 | if x > 2 and x < 6 and y == 4 then rewind(1) end | |
451 | if x > 26 and x < 30 and y == 4 then rewind(2) end | |
452 | if x > 2 and x < 6 and y == 11 then rewind(3) end | |
453 | if x > 26 and x < 30 and y == 11 then rewind(4) end | |
454 | ||
455 | if x > 2 and x < 6 and y == 5 then pause(1) end | |
456 | if x > 26 and x < 30 and y == 5 then pause(2) end | |
457 | if x > 2 and x < 6 and y == 12 then pause(3) end | |
458 | if x > 26 and x < 30 and y == 12 then pause(4) end | |
459 | ||
460 | ||
461 | if x > 2 and x < 6 and y == 6 then play(1) end | |
462 | if x > 26 and x < 30 and y == 6 then play(2) end | |
463 | if x > 2 and x < 6 and y == 13 then play(3) end | |
464 | if x > 26 and x < 30 and y == 13 then play(4) end | |
465 | end | |
466 | end | |
467 | end | |
468 | function lampThread() | |
469 | local before = term.current() | |
470 | term.redirect(floor) | |
471 | term.setPaletteColor(2^0,0xFFFFFF) | |
472 | term.setPaletteColor(2^1,0xF2B233) | |
473 | term.setPaletteColor(2^2,0xE57FD8) | |
474 | term.setPaletteColor(2^3,0x99B2F2) | |
475 | term.setPaletteColor(2^4,0xDEDE6C) | |
476 | term.setPaletteColor(2^5,0x7FCC19) | |
477 | term.setPaletteColor(2^6,0xF2B2CC) | |
478 | term.setPaletteColor(2^7,0x4C4C4C) | |
479 | term.setPaletteColor(2^8,0x999999) | |
480 | term.setPaletteColor(2^9,0x4C99B2) | |
481 | term.setPaletteColor(2^10,0xB266E5) | |
482 | term.setPaletteColor(2^11,0x3366CC) | |
483 | term.setPaletteColor(2^12,0x7F664C) | |
484 | term.setPaletteColor(2^13,0x57A64E) | |
485 | term.setPaletteColor(2^14,0xCC4C4C) | |
486 | term.setPaletteColor(2^15,0x000000) | |
487 | term.redirect(before) | |
488 | local keklol = math.random(1,20) | |
489 | floor.setTextScale(5) | |
490 | local lamps = {peripheral.find("colorful_lamp")} | |
491 | while true do | |
492 | if lampStatus == 2 and floor.getSize() then | |
493 | local w,h = floor.getSize() | |
494 | for i=1,math.random((w*h)-(w*h/2),w*h) do | |
495 | floor.setCursorPos(math.random(1,w),math.random(1,h)) | |
496 | floor.setBackgroundColor(2^math.random(1,14)) | |
497 | floor.write(" ") | |
498 | end | |
499 | end | |
500 | if lampStatus == 0 and floor.getSize() then | |
501 | floor.setPaletteColor(colors.black,0x000000) | |
502 | floor.setBackgroundColor(colors.black) | |
503 | floor.clear() | |
504 | end | |
505 | sleep(0.5) | |
506 | end | |
507 | end | |
508 | while true do | |
509 | parallel.waitForAny(function() err["mt"] = {pcall(mainThread)} end, function() err["lt"] = {pcall(lampThread)} end) | |
510 | print(textutils.serialise(err)) | |
511 | good,er = pcall(errorReport) | |
512 | if er == "Terminated" then | |
513 | break | |
514 | end | |
515 | err = {} | |
516 | end |