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