Advertisement
Aest47

Untitled

Aug 31st, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.23 KB | None | 0 0
  1. --Hardware Variables---------------------------------------
  2. local cm1 = peripheral.wrap("monitor_25")
  3.  
  4. local rm1 = peripheral.wrap("monitor_58")
  5. local rm2 = peripheral.wrap("monitor_59")
  6. local rm3 = peripheral.wrap("monitor_60")
  7.  
  8. local tm1 = peripheral.wrap("monitor_3")
  9. local tm2 = peripheral.wrap("monitor_23")
  10. local tm3 = peripheral.wrap("monitor_22")
  11.  
  12. local r1 = peripheral.wrap("BigReactors-Reactor_2")
  13. local t1 = peripheral.wrap("BigReactors-Turbine_13")
  14. local t2 = peripheral.wrap("BigReactors-Turbine_14")
  15. local t3 = peripheral.wrap("BigReactors-Turbine_15")
  16.  
  17. --Button Toggle variables-----------------------------------
  18. local r1auto = true
  19. local t1auto = true
  20. local t2auto = true
  21. local t3auto = true
  22.  
  23. --Control Button Toggle ------------------------------------
  24. function btn(y,state)
  25.  
  26. if state == "on" then
  27. cm1.setCursorPos(18,y)
  28. cm1.setBackgroundColor(colors.green)
  29. cm1.write(" ON ")
  30. cm1.setCursorPos(25,y)
  31. cm1.setBackgroundColor(colors.gray)
  32. cm1.write(" OFF ")
  33. cm1.setBackgroundColor(colors.black)
  34.  
  35. if y == 1 then
  36. r1auto = true
  37.  
  38. elseif y == 2 then
  39. t1auto = true
  40.  
  41. elseif y == 3 then
  42. t2auto = true
  43.  
  44. elseif y == 4 then
  45. t3auto = true
  46.  
  47. end
  48.  
  49. elseif state == "off" then
  50. cm1.setCursorPos(18,y)
  51. cm1.setBackgroundColor(colors.gray)
  52. cm1.write(" ON ")
  53. cm1.setCursorPos(25,y)
  54. cm1.setBackgroundColor(colors.red)
  55. cm1.write(" OFF ")
  56. cm1.setBackgroundColor(colors.black)
  57.  
  58. if y == 1 then
  59. r1auto = false
  60.  
  61. elseif y == 2 then
  62. t1auto = false
  63.  
  64. elseif y == 3 then
  65. t2auto = false
  66.  
  67. elseif y == 4 then
  68. t3auto = false
  69.  
  70. end
  71.  
  72. end
  73.  
  74. end
  75.  
  76. --Start Program--------------------------------------------------
  77. print("Running ReactorOS..")
  78.  
  79. --Control panel initialize----------------------------------------
  80. cm1.setBackgroundColor(colors.black)
  81. cm1.clear()
  82.  
  83. --Reactor
  84. cm1.setCursorPos(1,1)
  85. cm1.write("Reactor")
  86. btn(1,"on")
  87. r1.setActive(true)
  88. r1.setAllControlRodLevels(100)
  89.  
  90. --Turbine 1
  91. cm1.setCursorPos(1,2)
  92. cm1.write("Turbine 1")
  93. btn(2,"on")
  94. t1.setActive(true)
  95.  
  96. --Turbine 2
  97. cm1.setCursorPos(1,3)
  98. cm1.write("Turbine 2")
  99. btn(3,"on")
  100. t2.setActive(true)
  101.  
  102. --Turbine 3
  103. cm1.setCursorPos(1,4)
  104. cm1.write("Turbine 3")
  105. btn(4,"on")
  106. t3.setActive(true)
  107.  
  108. --Blast door
  109. cm1.setCursorPos(1,5)
  110. cm1.write("Blast Door")
  111. btn(5,"off")
  112. redstone.setOutput("top",false)
  113.  
  114. --Program Loop----------------------------------------------------
  115. while true do
  116.  
  117. --Reactor monitor 1 status display------------------------------------------------
  118.  
  119. rm1.setBackgroundColor(colors.black)
  120. rm1.setTextColor(colors.white)
  121. rm1.clear()
  122.  
  123. rm1.setTextColor(colors.white)
  124. rm1.setCursorPos(1,1)
  125. rm1.write("Reactor Core")
  126.  
  127. --Status----
  128. rm1.setCursorPos(15,1)
  129. rm1.write("Status:")
  130. rm1.setCursorPos(23,1)
  131.  
  132. if r1.getActive() == true then
  133. rm1.setTextColor(colors.green)
  134. rm1.write("ONLINE")
  135.  
  136. else
  137. rm1.setTextColor(colors.red)
  138. rm1.write("OFFLINE")
  139.  
  140. end
  141.  
  142. --Reactor monitor 2 temp/rod/fuel rate display------------------------------------------------
  143.  
  144. --Temp------------------------------------------
  145. local temp = math.floor(r1.getFuelTemperature())
  146.  
  147. rm2.setBackgroundColor(colors.black)
  148. rm2.setTextColor(colors.white)
  149. rm2.clear()
  150.  
  151. rm2.setCursorPos(1,1)
  152. rm2.write("Reactor Control")
  153.  
  154. rm2.setTextColor(colors.white)
  155. rm2.setCursorPos(1,3)
  156. rm2.write("Temp:")
  157.  
  158. --color coding
  159. if temp >= 2000 then
  160. rm2.setTextColor(colors.red)
  161.  
  162. elseif temp >= 1500 then
  163. rm2.setTextColor(colors.orange)
  164.  
  165. elseif temp >= 1000 then
  166. rm2.setTextColor(colors.yellow)
  167.  
  168. elseif (temp < 1000) and (temp >= 500) then
  169. rm2.setTextColor(colors.green)
  170.  
  171. elseif temp < 500 then
  172. rm2.setTextColor(colors.cyan)
  173. end
  174.  
  175. --adjust cursor
  176. if temp >= 1000 then
  177. rm2.setCursorPos(19,3)
  178.  
  179. elseif (temp < 1000) and (temp >= 100) then
  180. rm2.setCursorPos(20,3)
  181.  
  182. elseif (temp < 100) and (temp >= 10) then
  183. rm2.setCursorPos(21,3)
  184.  
  185. elseif temp < 10 then
  186. rm2.setCursorPos(22,3)
  187.  
  188. end
  189.  
  190. rm2.write(temp)
  191.  
  192. rm2.setTextColor(colors.white)
  193. rm2.setCursorPos(25,3)
  194. rm2.write(" C")
  195.  
  196. --Rods-------------------------------
  197. local rods = r1.getControlRodLevel(0)
  198.  
  199. rm2.setTextColor(colors.white)
  200. rm2.setCursorPos(1,4)
  201. rm2.write("Output:")
  202.  
  203. --adjust cursor
  204. if (100 - rods) >= 10 then
  205. rm2.setCursorPos(23,4)
  206.  
  207. elseif (100 - rods) < 10 then
  208. rm2.setCursorPos(24,4)
  209.  
  210. end
  211.  
  212. rm2.setTextColor(colors.white)
  213. rm2.write(100 - rods)
  214. rm2.setCursorPos(25,4)
  215. rm2.write(" %")
  216.  
  217. --Fuel Rate------------------------------------
  218. local r1fuelrate = r1.getFuelConsumedLastTick()
  219. rm2.setTextColor(colors.white)
  220. rm2.setCursorPos(1,5)
  221. rm2.write("Fuel Rate:")
  222.  
  223. if r1fuelrate > 0 then
  224. rm2.setCursorPos(19,5)
  225.  
  226. else
  227. rm2.setCursorPos(22,5)
  228.  
  229. end
  230.  
  231. rm2.write(r1fuelrate)
  232.  
  233. rm2.setCursorPos(25,5)
  234. rm2.write(" MB/T")
  235.  
  236. --Reactor monitor 3 water/steam/steam rate display------------------------------------------------------
  237.  
  238. rm3.setBackgroundColor(colors.black)
  239. rm3.setTextColor(colors.white)
  240. rm3.clear()
  241.  
  242. rm3.setCursorPos(1,1)
  243. rm3.write("Reactor Coolant")
  244.  
  245. --Coolant amount----------------------------
  246. local r1waterlvl = r1.getCoolantAmount()
  247. local r1waterper = math.floor((r1waterlvl / 21800) * 100)
  248.  
  249. rm3.setTextColor(colors.white)
  250. rm3.setCursorPos(1,3)
  251. rm3.write("Coolant:")
  252.  
  253. --adjust cursor
  254. if r1waterper == 100 then
  255. rm3.setCursorPos(20,3)
  256.  
  257. elseif r1waterper >= 10 then
  258. rm3.setCursorPos(21,3)
  259.  
  260. elseif r1waterper < 10 then
  261. rm3.setCursorPos(22,3)
  262.  
  263. end
  264.  
  265. rm3.setTextColor(colors.white)
  266. rm3.write(r1waterper)
  267. rm3.setCursorPos(25,3)
  268. rm3.write(" %")
  269.  
  270. --Steam amount------------------------------
  271. local r1steamlvl = r1.getHotFluidAmount()
  272. local r1steamper = math.floor((r1steamlvl / 21800) * 100)
  273.  
  274. rm3.setTextColor(colors.white)
  275. rm3.setCursorPos(1,4)
  276. rm3.write("Steam:")
  277.  
  278. --adjust cursor
  279. if r1steamper == 100 then
  280. rm3.setCursorPos(20,3)
  281.  
  282. elseif r1steamper >= 10 then
  283. rm3.setCursorPos(21,3)
  284.  
  285. elseif r1steamper < 10 then
  286. rm3.setCursorPos(22,3)
  287.  
  288. end
  289.  
  290. rm3.setTextColor(colors.white)
  291. rm3.write(r1steamper)
  292. rm3.setCursorPos(25,4)
  293. rm3.write(" %")
  294.  
  295. --Steam Gen---------------------------------
  296. local r1steam = math.floor(r1.getHotFluidProducedLastTick())
  297.  
  298. rm3.setTextColor(colors.white)
  299. rm3.setCursorPos(1,5)
  300. rm3.write("Steam Gen:")
  301.  
  302. --adjust cursor----
  303. if r1steam >= 1000 then
  304. rm3.setCursorPos(19,5)
  305.  
  306. elseif (r1steam < 1000) and (r1steam >= 100) then
  307. rm3.setCursorPos(20,5)
  308.  
  309. elseif (r1steam < 100) and (r1steam >= 10) then
  310. rm3.setCursorPos(21,5)
  311.  
  312. elseif r1steam < 10 then
  313. rm3.setCursorPos(22,5)
  314.  
  315. end
  316.  
  317. rm3.setTextColor(colors.white)
  318. rm3.write(r1steam)
  319. rm3.setCursorPos(25,5)
  320. rm3.write(" MB/T")
  321.  
  322.  
  323. --Turbine 1 display----------------------------------------------------
  324. tm1.clear()
  325.  
  326. tm1.setTextColor(colors.white)
  327. tm1.setCursorPos(1,1)
  328. tm1.write("Turbine 1")
  329.  
  330. --status----
  331. tm1.setCursorPos(14,1)
  332. tm1.write("Status:")
  333. tm1.setCursorPos(22,1)
  334.  
  335. if t1.getActive() == true then
  336. tm1.setTextColor(colors.green)
  337. tm1.write("ONLINE")
  338.  
  339. else
  340. tm1.setTextColor(colors.red)
  341. tm1.write("OFFLINE")
  342.  
  343. end
  344.  
  345. --coils----
  346. tm1.setTextColor(colors.white)
  347. tm1.setCursorPos(15,3)
  348. tm1.write("Coils:")
  349. tm1.setCursorPos(22,3)
  350.  
  351. if t1.getInductorEngaged() == true then
  352. tm1.setTextColor(colors.green)
  353. tm1.write("ACTIVE")
  354. else
  355. tm1.setTextColor(colors.red)
  356. tm1.write("INACTIVE")
  357. end
  358.  
  359. --Percent capacitor filled----
  360. local t1per = math.floor((t1.getEnergyStored() / 1000000) * 100)
  361.  
  362. tm1.setTextColor(colors.white)
  363. tm1.setCursorPos(1,5)
  364. tm1.write("Power:")
  365.  
  366. --color coding
  367. if t1per >= 75 then
  368. tm1.setTextColor(colors.green)
  369.  
  370. elseif (t1per < 75) and (t1per >= 50) then
  371. tm1.setTextColor(colors.yellow)
  372.  
  373. elseif (t1per <50) and (t1per >= 25) then
  374. tm1.setTextColor(colors.orange)
  375.  
  376. elseif t1per < 25 then
  377. tm1.setTextColor(colors.red)
  378.  
  379. end
  380.  
  381. --adjust cursor
  382. if t1per >= 100 then
  383. tm1.setCursorPos(20,5)
  384.  
  385. elseif (t1per < 100) and (t1per >= 10) then
  386. tm1.setCursorPos(21,5)
  387.  
  388. elseif t1per < 10 then
  389. tm1.setCursorPos(22,5)
  390.  
  391. end
  392.  
  393. tm1.write(t1per)
  394.  
  395. tm1.setTextColor(colors.white)
  396. tm1.setCursorPos(25,5)
  397. tm1.write(" %")
  398.  
  399. --Power output----
  400. local t1powertick = t1.getEnergyProducedLastTick()
  401.  
  402. tm1.setTextColor(colors.white)
  403. tm1.setCursorPos(1,7)
  404. tm1.write("Rate:")
  405.  
  406. if t1powertick >= 10000 then
  407. tm1.setCursorPos(18,7)
  408.  
  409. elseif (t1powertick < 10000) and (t1powertick >= 1000) then
  410. tm1.setCursorPos(19,7)
  411.  
  412. elseif (t1powertick < 1000) and (t1powertick >= 100) then
  413. tm1.setCursorPos(20,7)
  414.  
  415. elseif (t1powertick < 100) and (t1powertick >= 10) then
  416. tm1.setCursorPos(21,7)
  417.  
  418. elseif t1powertick < 10 then
  419. tm1.setCursorPos(22,7)
  420.  
  421. end
  422.  
  423. tm1.write(t1powertick)
  424.  
  425. tm1.setTextColor(colors.white)
  426. tm1.setCursorPos(25,7)
  427. tm1.write(" RF/T")
  428.  
  429. --RPM----
  430. local t1rpm = math.floor(t1.getRotorSpeed())
  431.  
  432. tm1.setTextColor(colors.white)
  433. tm1.setCursorPos(1,9)
  434. tm1.write("RPM:")
  435.  
  436. --color coding
  437. if t1rpm >= 2000 then
  438. tm1.setTextColor(colors.red)
  439.  
  440. elseif (t1rpm < 2000) and (t1rpm >= 1900) then
  441. tm1.setTextColor(colors.orange)
  442.  
  443. elseif (t1rpm < 1900) and (t1rpm > 1825) then
  444. tm1.setTextColor(colors.yellow)
  445.  
  446. elseif (t1rpm <= 1825) and (t1rpm >= 1775) then
  447. tm1.setTextColor(colors.green)
  448.  
  449. elseif (t1rpm < 1775) and (t1rpm > 925) then
  450. tm1.setTextColor(colors.cyan)
  451.  
  452. elseif (t1rpm <= 925) and (t1rpm >= 875) then
  453. tm1.setTextColor(colors.green)
  454.  
  455. elseif (t1rpm < 875) and (t1rpm >= 500) then
  456. tm1.setTextColor(colors.cyan)
  457.  
  458. elseif t1rpm < 500 then
  459. tm1.setTextColor(colors.white)
  460.  
  461. end
  462.  
  463. --adjust cursor
  464. if t1rpm >= 1000 then
  465. tm1.setCursorPos(19,9)
  466.  
  467. elseif (t1rpm < 1000) and (t1rpm >= 100) then
  468. tm1.setCursorPos(20,9)
  469.  
  470. elseif (t1rpm < 100) and (t1rpm >= 10) then
  471. tm1.setCursorPos(21,9)
  472.  
  473. elseif t1rpm < 10 then
  474. tm1.setCursorPos(22,9)
  475.  
  476. end
  477.  
  478. tm1.write(t1rpm)
  479.  
  480. tm1.setTextColor(colors.white)
  481. tm1.setCursorPos(25,9)
  482. tm1.write(" RPM ")
  483.  
  484. --Steam flow----
  485. local t1steam = t1.getFluidFlowRateMax()
  486.  
  487. tm1.setTextColor(colors.white)
  488. tm1.setCursorPos(1,11)
  489. tm1.write("Steam Flow:")
  490.  
  491. --adjust cursor
  492. if t1.getActive() == true then
  493. tm1.setCursorPos(19,11)
  494. tm1.write(t1steam)
  495.  
  496. else
  497. tm1.setCursorPos(22,11)
  498. tm1.write("0.0")
  499.  
  500. end
  501.  
  502. tm1.setTextColor(colors.white)
  503. tm1.setCursorPos(25,11)
  504. tm1.write(" MB/T")
  505.  
  506. --Turbine 2 display----------------------------------------------------
  507. tm2.clear()
  508.  
  509. tm2.setTextColor(colors.white)
  510. tm2.setCursorPos(1,1)
  511. tm2.write("Turbine 2")
  512.  
  513. --status----
  514. tm2.setCursorPos(14,1)
  515. tm2.write("Status:")
  516. tm2.setCursorPos(22,1)
  517.  
  518. if t2.getActive() == true then
  519. tm2.setTextColor(colors.green)
  520. tm2.write("ONLINE")
  521.  
  522. else
  523. tm2.setTextColor(colors.red)
  524. tm2.write("OFFLINE")
  525.  
  526. end
  527.  
  528. --coils----
  529. tm2.setTextColor(colors.white)
  530. tm2.setCursorPos(15,3)
  531. tm2.write("Coils:")
  532. tm2.setCursorPos(22,3)
  533.  
  534. if t2.getInductorEngaged() == true then
  535. tm2.setTextColor(colors.green)
  536. tm2.write("ACTIVE")
  537. else
  538. tm2.setTextColor(colors.red)
  539. tm2.write("INACTIVE")
  540. end
  541.  
  542. --Percent capacitor filled----
  543. local t2per = math.floor((t2.getEnergyStored() / 1000000) * 100)
  544.  
  545. tm2.setTextColor(colors.white)
  546. tm2.setCursorPos(1,5)
  547. tm2.write("Power:")
  548.  
  549. --color coding
  550. if t2per >= 75 then
  551. tm2.setTextColor(colors.green)
  552.  
  553. elseif (t2per < 75) and (t2per >= 50) then
  554. tm2.setTextColor(colors.yellow)
  555.  
  556. elseif (t2per <50) and (t2per >= 25) then
  557. tm2.setTextColor(colors.orange)
  558.  
  559. elseif t2per < 25 then
  560. tm2.setTextColor(colors.red)
  561.  
  562. end
  563.  
  564. --adjust cursor
  565. if t2per >= 100 then
  566. tm2.setCursorPos(20,5)
  567.  
  568. elseif (t2per < 100) and (t2per >= 10) then
  569. tm2.setCursorPos(21,5)
  570.  
  571. elseif t2per < 10 then
  572. tm2.setCursorPos(22,5)
  573.  
  574. end
  575.  
  576. tm2.write(t2per)
  577.  
  578. tm2.setTextColor(colors.white)
  579. tm2.setCursorPos(25,5)
  580. tm2.write(" %")
  581.  
  582. --Power output----
  583. local t2powertick = t2.getEnergyProducedLastTick()
  584.  
  585. tm2.setTextColor(colors.white)
  586. tm2.setCursorPos(1,7)
  587. tm2.write("Rate:")
  588.  
  589. if t2powertick >= 10000 then
  590. tm2.setCursorPos(18,7)
  591.  
  592. elseif (t2powertick < 10000) and (t2powertick >= 1000) then
  593. tm2.setCursorPos(19,7)
  594.  
  595. elseif (t2powertick < 1000) and (t2powertick >= 100) then
  596. tm2.setCursorPos(20,7)
  597.  
  598. elseif (t2powertick < 100) and (t2powertick >= 10) then
  599. tm2.setCursorPos(21,7)
  600.  
  601. elseif t2powertick < 10 then
  602. tm2.setCursorPos(22,7)
  603.  
  604. end
  605.  
  606. tm2.write(t2powertick)
  607.  
  608. tm2.setTextColor(colors.white)
  609. tm2.setCursorPos(25,7)
  610. tm2.write(" RF/T")
  611.  
  612. --RPM----
  613. local t2rpm = math.floor(t2.getRotorSpeed())
  614.  
  615. tm2.setTextColor(colors.white)
  616. tm2.setCursorPos(1,9)
  617. tm2.write("RPM:")
  618.  
  619. --color coding
  620. if t2rpm >= 2000 then
  621. tm2.setTextColor(colors.red)
  622.  
  623. elseif (t2rpm < 2000) and (t2rpm >= 1900) then
  624. tm2.setTextColor(colors.orange)
  625.  
  626. elseif (t2rpm < 1900) and (t2rpm > 1825) then
  627. tm2.setTextColor(colors.yellow)
  628.  
  629. elseif (t2rpm <= 1825) and (t2rpm >= 1775) then
  630. tm2.setTextColor(colors.green)
  631.  
  632. elseif (t2rpm < 1775) and (t2rpm > 925) then
  633. tm2.setTextColor(colors.cyan)
  634.  
  635. elseif (t2rpm <= 925) and (t2rpm >= 875) then
  636. tm2.setTextColor(colors.green)
  637.  
  638. elseif (t2rpm < 875) and (t2rpm >= 500) then
  639. tm2.setTextColor(colors.cyan)
  640.  
  641. elseif t2rpm < 500 then
  642. tm2.setTextColor(colors.white)
  643.  
  644. end
  645.  
  646. --adjust cursor
  647. if t2rpm >= 1000 then
  648. tm2.setCursorPos(19,9)
  649.  
  650. elseif (t2rpm < 1000) and (t2rpm >= 100) then
  651. tm2.setCursorPos(20,9)
  652.  
  653. elseif (t2rpm < 100) and (t2rpm >= 10) then
  654. tm2.setCursorPos(21,9)
  655.  
  656. elseif t2rpm < 10 then
  657. tm2.setCursorPos(22,9)
  658.  
  659. end
  660.  
  661. tm2.write(t2rpm)
  662.  
  663. tm2.setTextColor(colors.white)
  664. tm2.setCursorPos(25,9)
  665. tm2.write(" RPM ")
  666.  
  667. --Steam flow----
  668. local t2steam = t2.getFluidFlowRateMax()
  669.  
  670. tm2.setTextColor(colors.white)
  671. tm2.setCursorPos(1,11)
  672. tm2.write("Steam Flow:")
  673.  
  674. --adjust cursor
  675. if t2.getActive() == true then
  676. tm2.setCursorPos(19,11)
  677. tm2.write(t2steam)
  678.  
  679. else
  680. tm2.setCursorPos(22,11)
  681. tm2.write("0.0")
  682.  
  683. end
  684.  
  685. tm2.setTextColor(colors.white)
  686. tm2.setCursorPos(25,11)
  687. tm2.write(" MB/T")
  688.  
  689.  
  690. --Turbine 3 display----------------------------------------------------
  691. tm3.clear()
  692.  
  693. tm3.setTextColor(colors.white)
  694. tm3.setCursorPos(1,1)
  695. tm3.write("Turbine 3")
  696.  
  697. --status----
  698. tm3.setCursorPos(14,1)
  699. tm3.write("Status:")
  700. tm3.setCursorPos(22,1)
  701.  
  702. if t3.getActive() == true then
  703. tm3.setTextColor(colors.green)
  704. tm3.write("ONLINE")
  705.  
  706. else
  707. tm3.setTextColor(colors.red)
  708. tm3.write("OFFLINE")
  709.  
  710. end
  711.  
  712. --coils----
  713. tm3.setTextColor(colors.white)
  714. tm3.setCursorPos(15,3)
  715. tm3.write("Coils:")
  716. tm3.setCursorPos(22,3)
  717.  
  718. if t3.getInductorEngaged() == true then
  719. tm3.setTextColor(colors.green)
  720. tm3.write("ACTIVE")
  721. else
  722. tm3.setTextColor(colors.red)
  723. tm3.write("INACTIVE")
  724. end
  725.  
  726. --Percent capacitor filled----
  727. local t3per = math.floor((t3.getEnergyStored() / 1000000) * 100)
  728.  
  729. tm3.setTextColor(colors.white)
  730. tm3.setCursorPos(1,5)
  731. tm3.write("Power:")
  732.  
  733. --color coding
  734. if t3per >= 75 then
  735. tm3.setTextColor(colors.green)
  736.  
  737. elseif (t3per < 75) and (t3per >= 50) then
  738. tm3.setTextColor(colors.yellow)
  739.  
  740. elseif (t3per <50) and (t3per >= 25) then
  741. tm3.setTextColor(colors.orange)
  742.  
  743. elseif t3per < 25 then
  744. tm3.setTextColor(colors.red)
  745.  
  746. end
  747.  
  748. --adjust cursor
  749. if t3per >= 100 then
  750. tm3.setCursorPos(20,5)
  751.  
  752. elseif (t3per < 100) and (t3per >= 10) then
  753. tm3.setCursorPos(21,5)
  754.  
  755. elseif t3per < 10 then
  756. tm3.setCursorPos(22,5)
  757.  
  758. end
  759.  
  760. tm3.write(t3per)
  761.  
  762. tm3.setTextColor(colors.white)
  763. tm3.setCursorPos(25,5)
  764. tm3.write(" %")
  765.  
  766. --Power output----
  767. local t3powertick = t3.getEnergyProducedLastTick()
  768.  
  769. tm3.setTextColor(colors.white)
  770. tm3.setCursorPos(1,7)
  771. tm3.write("Rate:")
  772.  
  773. if t3powertick >= 10000 then
  774. tm3.setCursorPos(18,7)
  775.  
  776. elseif (t3powertick < 10000) and (t3powertick >= 1000) then
  777. tm3.setCursorPos(19,7)
  778.  
  779. elseif (t3powertick < 1000) and (t3powertick >= 100) then
  780. tm3.setCursorPos(20,7)
  781.  
  782. elseif (t3powertick < 100) and (t3powertick >= 10) then
  783. tm3.setCursorPos(21,7)
  784.  
  785. elseif t3powertick < 10 then
  786. tm3.setCursorPos(22,7)
  787.  
  788. end
  789.  
  790. tm3.write(t3powertick)
  791.  
  792. tm3.setTextColor(colors.white)
  793. tm3.setCursorPos(25,7)
  794. tm3.write(" RF/T")
  795.  
  796. --RPM----
  797. local t3rpm = math.floor(t3.getRotorSpeed())
  798.  
  799. tm3.setTextColor(colors.white)
  800. tm3.setCursorPos(1,9)
  801. tm3.write("RPM:")
  802.  
  803. --color coding
  804. if t3rpm >= 2000 then
  805. tm3.setTextColor(colors.red)
  806.  
  807. elseif (t3rpm < 2000) and (t3rpm >= 1900) then
  808. tm3.setTextColor(colors.orange)
  809.  
  810. elseif (t3rpm < 1900) and (t3rpm > 1825) then
  811. tm3.setTextColor(colors.yellow)
  812.  
  813. elseif (t3rpm <= 1825) and (t3rpm >= 1775) then
  814. tm3.setTextColor(colors.green)
  815.  
  816. elseif (t3rpm < 1775) and (t3rpm > 925) then
  817. tm3.setTextColor(colors.cyan)
  818.  
  819. elseif (t3rpm <= 925) and (t3rpm >= 875) then
  820. tm3.setTextColor(colors.green)
  821.  
  822. elseif (t3rpm < 875) and (t3rpm >= 500) then
  823. tm3.setTextColor(colors.cyan)
  824.  
  825. elseif t3rpm < 500 then
  826. tm3.setTextColor(colors.white)
  827.  
  828. end
  829.  
  830. --adjust cursor
  831. if t3rpm >= 1000 then
  832. tm3.setCursorPos(19,9)
  833.  
  834. elseif (t3rpm < 1000) and (t3rpm >= 100) then
  835. tm3.setCursorPos(20,9)
  836.  
  837. elseif (t3rpm < 100) and (t3rpm >= 10) then
  838. tm3.setCursorPos(21,9)
  839.  
  840. elseif t3rpm < 10 then
  841. tm3.setCursorPos(22,9)
  842.  
  843. end
  844.  
  845. tm3.write(t3rpm)
  846.  
  847. tm3.setTextColor(colors.white)
  848. tm3.setCursorPos(25,9)
  849. tm3.write(" RPM ")
  850.  
  851. --Steam flow----
  852. local t3steam = t3.getFluidFlowRateMax()
  853.  
  854. tm3.setTextColor(colors.white)
  855. tm3.setCursorPos(1,11)
  856. tm3.write("Steam Flow:")
  857.  
  858. --adjust cursor
  859. if t3.getActive() == true then
  860. tm3.setCursorPos(19,11)
  861. tm3.write(t2steam)
  862.  
  863. else
  864. tm3.setCursorPos(22,11)
  865. tm3.write("0.0")
  866.  
  867. end
  868.  
  869. tm3.setTextColor(colors.white)
  870. tm3.setCursorPos(25,11)
  871. tm3.write(" MB/T")
  872.  
  873.  
  874. --Automatic System Control------------------------------------------------------
  875.  
  876. --Turbine 1 Automatic Controls----
  877. if t1auto == true then
  878.  
  879. --toggle turbine 1
  880. if t1per >= 95 then
  881. t1.setActive(false)
  882.  
  883. elseif t1per <= 0 then
  884. t1.setActive(true)
  885.  
  886. end
  887.  
  888. --toggle coils 1
  889. if t1.getActive() == true then
  890.  
  891. if t1.getRotorSpeed() >= 500 then
  892. t1.setInductorEngaged(true)
  893. else
  894. t1.setInductorEngaged(false)
  895. end
  896.  
  897. else
  898. t1.setInductorEngaged(true)
  899. end
  900.  
  901. else
  902. t1.setActive(false)
  903. end
  904.  
  905. --Turbine 2 Automatic Controls----
  906. if t2auto == true then
  907.  
  908. --toggle turbine 2
  909. if t2per >= 95 then
  910. t2.setActive(false)
  911.  
  912. elseif t2per <= 0 then
  913. t2.setActive(true)
  914.  
  915. end
  916.  
  917. --toggle coils 2
  918. if t2.getActive() == true then
  919.  
  920. if t2.getRotorSpeed() >= 500 then
  921. t2.setInductorEngaged(true)
  922. else
  923. t2.setInductorEngaged(false)
  924. end
  925.  
  926. else
  927. t2.setInductorEngaged(true)
  928. end
  929.  
  930. else
  931. t2.setActive(false)
  932. end
  933.  
  934. --Turbine 3 Automatic Controls----
  935. if t3auto == true then
  936.  
  937. --toggle turbine 3
  938. if t3per >= 95 then
  939. t3.setActive(false)
  940.  
  941. elseif t3per <= 0 then
  942. t3.setActive(true)
  943.  
  944. end
  945.  
  946. --toggle coils 3
  947. if t3.getActive() == true then
  948.  
  949. if t3.getRotorSpeed() >= 500 then
  950. t3.setInductorEngaged(true)
  951. else
  952. t3.setInductorEngaged(false)
  953. end
  954.  
  955. else
  956. t3.setInductorEngaged(true)
  957. end
  958.  
  959. else
  960. t3.setActive(false)
  961. end
  962.  
  963. --Reactor Automatic Controls----
  964. if r1auto == true then
  965.  
  966. --toggle reactor
  967. if (t1.getActive() == false) and (t2.getActive() == false) then
  968. r1.setActive(false)
  969.  
  970. else
  971. r1.setActive(true)
  972. r1.setAllControlRodLevels(100)
  973.  
  974. end
  975.  
  976. --rod control
  977. if temp >= 2000 then
  978.  
  979. if rods <= 98 then
  980. rods = rods + 2
  981. end
  982.  
  983. elseif (temp < 2000) and (temp >= 1500) then
  984.  
  985. if rods <= 99 then
  986. rods = rods + 1
  987. end
  988.  
  989. elseif (temp < 1500) and (temp >= 1000) then
  990.  
  991. if rods <= 99 then
  992. rods = rods + 1
  993. end
  994.  
  995. elseif (temp < 1000) and (temp >= 500) then
  996. --ideal
  997.  
  998. elseif temp < 500 then
  999.  
  1000. if rods >= 0 then
  1001. rods = rods - 1
  1002. end
  1003.  
  1004. end
  1005.  
  1006. r1.setAllControlRodLevels(rods)
  1007.  
  1008. else
  1009. r1.setAllControlRodLevels(100)
  1010. r1.setActive(false)
  1011.  
  1012. end
  1013.  
  1014. --Button Press--------------------------------------------------------
  1015. os.startTimer(1)
  1016.  
  1017. while true do
  1018. local evt = {os.pullEvent()}
  1019. if evt[1]=="timer" then
  1020. break
  1021. elseif evt[1]=="monitor_touch" then
  1022. local x,y = evt[3],evt[4]
  1023. if evt[2] == "monitor_25" then
  1024.  
  1025. --ON--
  1026. if x>=18 and x<=22 then
  1027. btn(y,"on")
  1028.  
  1029. if y==1 then
  1030. r1.setActive(true)
  1031. r1auto = true
  1032.  
  1033. elseif y==2 then
  1034. t1.setActive(true)
  1035. t1auto = true
  1036.  
  1037. elseif y==3 then
  1038. t2.setActive(true)
  1039. t2auto = true
  1040.  
  1041. elseif y==4 then
  1042. t3.setActive(true)
  1043. t3auto = true
  1044.  
  1045. elseif y==5 then
  1046. redstone.setOutput("top",true)
  1047.  
  1048. end
  1049.  
  1050. --OFF--
  1051. elseif x>25 and x<=30 then
  1052. btn(y,"off")
  1053.  
  1054. if y==1 then
  1055. r1.setActive(false)
  1056. r1auto = false
  1057.  
  1058. elseif y==2 then
  1059. t1.setActive(false)
  1060. t1auto = false
  1061.  
  1062. elseif y==3 then
  1063. t2.setActive(false)
  1064. t2auto = false
  1065.  
  1066. elseif y==4 then
  1067. t3.setActive(false)
  1068. t3auto = false
  1069.  
  1070. elseif y==5 then
  1071. redstone.setOutput("top",false)
  1072.  
  1073. end
  1074. end
  1075. end
  1076. end
  1077. end
  1078. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement