cobra_tomtrein

betterDiscoFloor

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