Sakuchou

Untitled

Oct 20th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.39 KB | None | 0 0
  1. -- Energy Cell
  2. e1 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_0")
  3. e2 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_1")
  4. e3 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_2")
  5. e4 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_3")
  6. e5 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_4")
  7. e6 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_5")
  8. e7 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_6")
  9. e8 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_7")
  10. e9 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_8")
  11. e10 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_9")
  12. e11 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_10")
  13. e12 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_11")
  14. e13 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_12")
  15. e14 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_13")
  16. -- Turbines
  17. b1 = peripheral.wrap("BigReactors-Turbine_1")
  18. b2 = peripheral.wrap("BigReactors-Turbine_2")
  19. b3 = peripheral.wrap("BigReactors-Turbine_3")
  20. b4 = peripheral.wrap("BigReactors-Turbine_4")
  21. b5 = peripheral.wrap("BigReactors-Turbine_5")
  22. b6 = peripheral.wrap("BigReactors-Turbine_6")
  23. b7 = peripheral.wrap("BigReactors-Turbine_7")
  24. b8 = peripheral.wrap("BigReactors-Turbine_8")
  25.  
  26. -- Peripheriques
  27. d = peripheral.wrap("monitor_0")
  28. rednet.open("back")
  29.  
  30. while true do
  31. u1 = e1.getEnergyStored()
  32. u2 = e2.getEnergyStored()
  33. u3 = e3.getEnergyStored()
  34. u4 = e4.getEnergyStored()
  35. u5 = e5.getEnergyStored()
  36. u6 = e6.getEnergyStored()
  37. u7 = e7.getEnergyStored()
  38. u8 = e8.getEnergyStored()
  39. u9 = e9.getEnergyStored()
  40. u10 = e10.getEnergyStored()
  41. u11 = e11.getEnergyStored()
  42. u12 = e12.getEnergyStored()
  43. u13 = e13.getEnergyStored()
  44. u14 = e14.getEnergyStored()
  45. t1 = b1.getEnergyProducedLastTick()
  46. t2 = b2.getEnergyProducedLastTick()
  47. t3 = b3.getEnergyProducedLastTick()
  48. t4 = b4.getEnergyProducedLastTick()
  49. t5 = b5.getEnergyProducedLastTick()
  50. t6 = b6.getEnergyProducedLastTick()
  51. t7 = b7.getEnergyProducedLastTick()
  52. t8 = b8.getEnergyProducedLastTick()
  53. r1 = b1.getRotorSpeed()
  54. r2 = b2.getRotorSpeed()
  55. r3 = b3.getRotorSpeed()
  56. r4 = b4.getRotorSpeed()
  57. r5 = b5.getRotorSpeed()
  58. r6 = b6.getRotorSpeed()
  59. r7 = b7.getRotorSpeed()
  60. r8 = b8.getRotorSpeed()
  61.  
  62.  
  63.  
  64.  
  65. local function centerText(text)
  66. x,y = d.getSize()
  67. x1,y1 = d.getCursorPos()
  68. d.setCursorPos((math.floor(x/2) - (math.floor(#text/2))), y1)
  69. d.write(text)
  70. end
  71. -- Presentation
  72. d.clear()
  73. d.setCursorPos(1,3)
  74. d.setTextColor(1025)
  75. centerText("| Energy |")
  76.  
  77. --Presentation
  78. d.setCursorPos(35,7)
  79. d.write("|")
  80. d.setCursorPos(35,8)
  81. d.write("|")
  82. d.setCursorPos(35,9)
  83. d.write("|")
  84. d.setCursorPos(35,10)
  85. d.write("|")
  86. d.setCursorPos(35,11)
  87. d.write("|")
  88. d.setCursorPos(35,12)
  89. d.write("|")
  90. d.setCursorPos(35,13)
  91. d.write("|")
  92. d.setCursorPos(35,14)
  93. d.write("|")
  94. d.setCursorPos(35,15)
  95. d.write("|")
  96. d.setCursorPos(35,16)
  97. d.write("|")
  98. d.setCursorPos(35,17)
  99. d.write("|")
  100. d.setCursorPos(35,18)
  101. d.write("|")
  102. d.setCursorPos(35,19)
  103. d.write("|")
  104. d.setCursorPos(35,20)
  105. d.write("|")
  106. d.setCursorPos(35,21)
  107. d.write("|")
  108. d.setCursorPos(35,22)
  109. d.write("|")
  110. d.setCursorPos(35,23)
  111. d.write("|")
  112. d.setCursorPos(35,24)
  113. d.write("|")
  114. d.setCursorPos(35,25)
  115. d.write("|")
  116. d.setCursorPos(35,26)
  117. d.write("|")
  118.  
  119. -- Generator
  120. d.setTextColor(4096)
  121. d.setCursorPos(1,4)
  122. d.write("------------")
  123. d.setCursorPos(1,5)
  124. d.write("|Generateur|")
  125. d.setCursorPos(1,6)
  126. d.write("------------")
  127. d.setTextColor(1)
  128. d.setCursorPos(1,7)
  129. d.write("Status :")
  130.  
  131. id, message = rednet.receive()
  132. tableG = textutils.unserialize(message)
  133.  
  134. --Status
  135. d.setCursorPos(18,7)
  136. if tableG[1] == true then
  137. d.setTextColor(32)
  138. d.write("On")
  139. else
  140. d.setTextColor(16384)
  141. d.write("Off")
  142. end
  143. --Consomation
  144. d.setTextColor(1)
  145. d.setCursorPos(1,8)
  146. d.write("Consomation :")
  147. d.setCursorPos(18,8)
  148. d.write(tableG[3])
  149. d.setCursorPos(25,8)
  150. d.write(" Y/h ")
  151. --Rod
  152. d.setCursorPos(1,9)
  153. d.write("Rod Insertion :")
  154. d.setCursorPos(18,9)
  155. d.write(tableG[2])
  156. d.setCursorPos(25,9)
  157. d.write(" % ")
  158. --Fuel
  159. d.setCursorPos(1,10)
  160. d.write("Reactivity : ")
  161. d.setCursorPos(18,10)
  162. if tableG[1] == true then
  163. d.write(tableG[4])
  164. d.setCursorPos(25,10)
  165. d.write(" % ")
  166. else
  167. d.write("Off")
  168. end
  169. --Temperature
  170. d.setCursorPos(1,11)
  171. d.write("Temperature ; ")
  172. d.setCursorPos(18,11)
  173. d.write(tableG[5])
  174. d.setCursorPos(25,11)
  175. d.write(" C ")
  176. if tableG[5] >= 600 then
  177. d.setTextColor(16384)
  178. d.setCursorPos(28,11)
  179. d.write(" DANGER")
  180. d.setTextColor(1)
  181. else
  182. d.setTextColor(32)
  183. d.setCursorPos(28,11)
  184. d.write(" Ok")
  185. d.setTextColor(1)
  186. end
  187.  
  188. -- Turbines
  189. d.setTextColor(16384)
  190. d.setCursorPos(55,4)
  191. d.write("------------")
  192. d.setCursorPos(55,5)
  193. d.write("|Turbines|")
  194. d.setCursorPos(55,6)
  195. d.write("------------")
  196. d.setTextColor(1)
  197. --color
  198. vert = 8192
  199. bleue = 2048
  200. rouge = 16384
  201.  
  202. --T 1
  203. if r1 < 200 then
  204. d.setBackgroundColor(rouge)
  205. d.setCursorPos(39,7)
  206. d.write(string.rep(" ",11))
  207. d.setCursorPos(39,7)
  208. d.write("T1 : Offline")
  209. d.setBackgroundColor(colors.black)
  210. end
  211. if r1 < 1600 and r1 > 200 then
  212. d.setBackgroundColor(bleue)
  213. d.setCursorPos(39,7)
  214. d.write(string.rep(" ",11))
  215. d.setCursorPos(39,7)
  216. d.write("T1: ")
  217. d.write(math.ceil(r1))
  218. d.setCursorPos(47,7)
  219. d.write(" RPM")
  220. d.setBackgroundColor(colors.black)
  221. end
  222. if r1 > 1600 then
  223. d.setBackgroundColor(vert)
  224. d.setCursorPos(39,7)
  225. d.write(string.rep(" ",11))
  226. d.setCursorPos(39,7)
  227. d.write("T1: ")
  228. d.write(math.ceil(r1))
  229. d.setCursorPos(47,7)
  230. d.write(" RPM")
  231. d.setBackgroundColor(colors.black)
  232. end
  233.  
  234. --T2
  235. if r2 < 200 then
  236. d.setBackgroundColor(rouge)
  237. d.setCursorPos(55,8)
  238. d.write(string.rep(" ",11))
  239. d.setCursorPos(55,8)
  240. d.write("T2 : Offline")
  241. d.setBackgroundColor(colors.black)
  242. end
  243. if r2 < 1600 and r2 > 200 then
  244. d.setBackgroundColor(bleue)
  245. d.setCursorPos(55,8)
  246. d.write(string.rep(" ",11))
  247. d.setCursorPos(55,8)
  248. d.write("T2: ")
  249. d.write(math.ceil(r2))
  250. d.setCursorPos(63,8)
  251. d.write(" RPM")
  252. d.setBackgroundColor(colors.black)
  253. end
  254. if r2 > 1600 then
  255. d.setBackgroundColor(vert)
  256. d.setCursorPos(55,8)
  257. d.write(string.rep(" ",11))
  258. d.setCursorPos(55,8)
  259. d.write("T2: ")
  260. d.write(math.ceil(r2))
  261. d.setCursorPos(63,8)
  262. d.write(" RPM")
  263. d.setBackgroundColor(colors.black)
  264. end
  265. --t3
  266. if r3 < 200 then
  267. d.setBackgroundColor(rouge)
  268. d.setCursorPos(39,9)
  269. d.write(string.rep(" ",11))
  270. d.setCursorPos(39,9)
  271. d.write("T3 : Offline")
  272. d.setBackgroundColor(colors.black)
  273. end
  274. if r3 < 1600 and r3 > 200 then
  275. d.setBackgroundColor(bleue)
  276. d.setCursorPos(39,9)
  277. d.write(string.rep(" ",11))
  278. d.setCursorPos(39,9)
  279. d.write("T3: ")
  280. d.write(math.ceil(r3))
  281. d.setCursorPos(47,9)
  282. d.write(" RPM")
  283. d.setBackgroundColor(colors.black)
  284. end
  285. if r3 > 1600 then
  286. d.setBackgroundColor(vert)
  287. d.setCursorPos(39,9)
  288. d.write(string.rep(" ",11))
  289. d.setCursorPos(39,9)
  290. d.write("T3: ")
  291. d.write(math.ceil(r3))
  292. d.setCursorPos(47,9)
  293. d.write(" RPM")
  294. d.setBackgroundColor(colors.black)
  295. end
  296. --T4
  297. if r4 < 200 then
  298. d.setBackgroundColor(rouge)
  299. d.setCursorPos(55,10)
  300. d.write(string.rep(" ",11))
  301. d.setCursorPos(55,10)
  302. d.write("T4 : Offline")
  303. d.setBackgroundColor(colors.black)
  304. end
  305. if r4 < 1600 and r4 > 200 then
  306. d.setBackgroundColor(bleue)
  307. d.setCursorPos(55,10)
  308. d.write(string.rep(" ",11))
  309. d.setCursorPos(55,10)
  310. d.write("T4: ")
  311. d.write(math.ceil(r4))
  312. d.setCursorPos(63,10)
  313. d.write(" RPM")
  314. d.setBackgroundColor(colors.black)
  315. end
  316. if r4 > 1600 then
  317. d.setBackgroundColor(vert)
  318. d.setCursorPos(55,10)
  319. d.write(string.rep(" ",11))
  320. d.setCursorPos(55,10)
  321. d.write("T4: ")
  322. d.write(math.ceil(r4))
  323. d.setCursorPos(63,10)
  324. d.write(" RPM")
  325. d.setBackgroundColor(colors.black)
  326. end
  327.  
  328. --t5
  329. if r5 < 200 then
  330. d.setBackgroundColor(rouge)
  331. d.setCursorPos(39,12)
  332. d.write(string.rep(" ",11))
  333. d.setCursorPos(39,12)
  334. d.write("T5 : Offline")
  335. d.setBackgroundColor(colors.black)
  336. end
  337. if r5 < 1600 and r5 > 200 then
  338. d.setBackgroundColor(bleue)
  339. d.setCursorPos(39,12)
  340. d.write(string.rep(" ",11))
  341. d.setCursorPos(39,12)
  342. d.write("T5: ")
  343. d.write(math.ceil(r5))
  344. d.setCursorPos(47,12)
  345. d.write(" RPM")
  346. d.setBackgroundColor(colors.black)
  347. end
  348. if r5 > 1600 then
  349. d.setBackgroundColor(vert)
  350. d.setCursorPos(39,12)
  351. d.write(string.rep(" ",11))
  352. d.setCursorPos(39,12)
  353. d.write("T5: ")
  354. d.write(math.ceil(r5))
  355. d.setCursorPos(47,12)
  356. d.write(" RPM")
  357. d.setBackgroundColor(colors.black)
  358. end
  359.  
  360. --T6
  361. if r6 < 200 then
  362. d.setBackgroundColor(rouge)
  363. d.setCursorPos(55,13)
  364. d.write(string.rep(" ",11))
  365. d.setCursorPos(55,13)
  366. d.write("T6 : Offline")
  367. d.setBackgroundColor(colors.black)
  368. end
  369. if r6 < 1600 and r6 > 200 then
  370. d.setBackgroundColor(bleue)
  371. d.setCursorPos(55,13)
  372. d.write(string.rep(" ",11))
  373. d.setCursorPos(55,13)
  374. d.write("T6: ")
  375. d.write(math.ceil(r6))
  376. d.setCursorPos(63,13)
  377. d.write(" RPM")
  378. d.setBackgroundColor(colors.black)
  379. end
  380. if r6 > 1600 then
  381. d.setBackgroundColor(vert)
  382. d.setCursorPos(55,13)
  383. d.write(string.rep(" ",11))
  384. d.setCursorPos(55,13)
  385. d.write("T6: ")
  386. d.write(math.ceil(r6))
  387. d.setCursorPos(63,13)
  388. d.write(" RPM")
  389. d.setBackgroundColor(colors.black)
  390. end
  391.  
  392. --t7
  393. if r7 < 200 then
  394. d.setBackgroundColor(rouge)
  395. d.setCursorPos(39,14)
  396. d.write(string.rep(" ",11))
  397. d.setCursorPos(39,14)
  398. d.write("T7 : Offline")
  399. d.setBackgroundColor(colors.black)
  400. end
  401. if r7 < 1600 and r7 > 200 then
  402. d.setBackgroundColor(bleue)
  403. d.setCursorPos(39,14)
  404. d.write(string.rep(" ",11))
  405. d.setCursorPos(39,14)
  406. d.write("T7: ")
  407. d.write(math.ceil(r7))
  408. d.setCursorPos(47,14)
  409. d.write(" RPM")
  410. d.setBackgroundColor(colors.black)
  411. end
  412. if r7 > 1600 then
  413. d.setBackgroundColor(vert)
  414. d.setCursorPos(39,14)
  415. d.write(string.rep(" ",11))
  416. d.setCursorPos(39,14)
  417. d.write("T7: ")
  418. d.write(math.ceil(r7))
  419. d.setCursorPos(47,14)
  420. d.write(" RPM")
  421. d.setBackgroundColor(colors.black)
  422. end
  423.  
  424. --T8
  425. if r8 < 200 then
  426. d.setBackgroundColor(rouge)
  427. d.setCursorPos(55,15)
  428. d.write(string.rep(" ",11))
  429. d.setCursorPos(55,15)
  430. d.write("T8 : Offline")
  431. d.setBackgroundColor(colors.black)
  432. end
  433. if r8 < 1600 and r8 > 200 then
  434. d.setBackgroundColor(bleue)
  435. d.setCursorPos(55,15)
  436. d.write(string.rep(" ",11))
  437. d.setCursorPos(55,15)
  438. d.write("T8: ")
  439. d.write(math.ceil(r8))
  440. d.setCursorPos(63,15)
  441. d.write(" RPM")
  442. d.setBackgroundColor(colors.black)
  443. end
  444. if r8 > 1600 then
  445. d.setBackgroundColor(vert)
  446. d.setCursorPos(55,15)
  447. d.write(string.rep(" ",11))
  448. d.setCursorPos(55,15)
  449. d.write("T8: ")
  450. d.write(math.ceil(r8))
  451. d.setCursorPos(63,15)
  452. d.write(" RPM")
  453. d.setBackgroundColor(colors.black)
  454. end
  455.  
  456. -- Energy
  457. d.setTextColor(16)
  458. d.setCursorPos(1,13)
  459. d.write("----------")
  460. d.setCursorPos(1,14)
  461. d.write("|Stockage|")
  462. d.setCursorPos(1,15)
  463. d.write("----------")
  464. d.setTextColor(1)
  465. energ = u1+u2+u3+u4+u5+u6+u7+u9+u10+u11+u12+u13+u14
  466. energy = energ/1000000
  467. d.setCursorPos(1,16)
  468.  
  469. --Stock
  470. d.write("Energie stockée :")
  471. d.setCursorPos(18,16)
  472. d.write(math.ceil(energy))
  473. d.setCursorPos(25,16)
  474. d.write(" M Rf")
  475.  
  476. --Delta
  477. -- if ut == nil then
  478. -- ut = 0
  479. -- delta = 0 -- initialisation
  480. -- else
  481. -- ut0 = ut --Ancien Tick
  482. -- ut = u1+u2+u3+u4+u5+u6+u7+u9+u10+u11+u12+u13+u14 --Nouveau tick
  483. -- delta = ut-ut0
  484. -- end
  485. -- deltac = delta/15
  486. -- d.setCursorPos(1,17)
  487. -- d.write("Delta :")
  488. -- d.setCursorPos(18,17)
  489. -- d.write(deltac)
  490. -- d.setCursorPos(25,17)
  491. -- d.write(" Rf/t ")
  492.  
  493. -- Production
  494. d.setTextColor(8)
  495. d.setCursorPos(1,19)
  496. d.write("------------")
  497. d.setCursorPos(1,20)
  498. d.write("|Production|")
  499. d.setCursorPos(1,21)
  500. d.write("------------")
  501. d.setTextColor(1)
  502. d.setCursorPos(1,22)
  503. d.write("Turbines :")
  504. d.setCursorPos(18,22)
  505. p = t1+t2+t3+t4+t5+t6+t7+t8
  506. d.write(p)
  507. d.setCursorPos(25,22)
  508. d.write(" Rf/t ")
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517. sleep(0) --while
  518. end
Add Comment
Please, Sign In to add comment