Advertisement
Aest47

Untitled

Aug 31st, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.11 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 >= 10 then
  255. rm3.setCursorPos(23,3)
  256.  
  257. elseif r1waterper < 10 then
  258. rm3.setCursorPos(24,3)
  259.  
  260. end
  261.  
  262. rm3.setTextColor(colors.white)
  263. rm3.write(r1waterper)
  264. rm3.setCursorPos(25,3)
  265. rm3.write(" %")
  266.  
  267. --Steam amount------------------------------
  268. local r1steamlvl = r1.getHotFluidAmount()
  269. local r1steamper = math.floor((r1steamlvl / 21800) * 100)
  270.  
  271. rm3.setTextColor(colors.white)
  272. rm3.setCursorPos(1,4)
  273. rm3.write("Steam:")
  274.  
  275. --adjust cursor
  276. if r1steamper >= 10 then
  277. rm3.setCursorPos(23,4)
  278.  
  279. elseif r1steamper < 10 then
  280. rm3.setCursorPos(24,4)
  281.  
  282. end
  283.  
  284. rm3.setTextColor(colors.white)
  285. rm3.write(r1steamper)
  286. rm3.setCursorPos(25,4)
  287. rm3.write(" %")
  288.  
  289. --Steam Gen---------------------------------
  290. local r1steam = math.floor(r1.getHotFluidProducedLastTick())
  291.  
  292. rm3.setTextColor(colors.white)
  293. rm3.setCursorPos(1,5)
  294. rm3.write("Steam Gen:")
  295.  
  296. --adjust cursor----
  297. if r1steam >= 1000 then
  298. rm3.setCursorPos(19,5)
  299.  
  300. elseif (r1steam < 1000) and (r1steam >= 100) then
  301. rm3.setCursorPos(20,5)
  302.  
  303. elseif (r1steam < 100) and (r1steam >= 10) then
  304. rm3.setCursorPos(21,5)
  305.  
  306. elseif r1steam < 10 then
  307. rm3.setCursorPos(22,5)
  308.  
  309. end
  310.  
  311. rm3.setTextColor(colors.white)
  312. rm3.write(r1steam)
  313. rm3.setCursorPos(25,5)
  314. rm3.write(" MB/T")
  315.  
  316.  
  317. --Turbine 1 display----------------------------------------------------
  318. tm1.clear()
  319.  
  320. tm1.setTextColor(colors.white)
  321. tm1.setCursorPos(1,1)
  322. tm1.write("Turbine 1")
  323.  
  324. --status----
  325. tm1.setCursorPos(14,1)
  326. tm1.write("Status:")
  327. tm1.setCursorPos(22,1)
  328.  
  329. if t1.getActive() == true then
  330. tm1.setTextColor(colors.green)
  331. tm1.write("ONLINE")
  332.  
  333. else
  334. tm1.setTextColor(colors.red)
  335. tm1.write("OFFLINE")
  336.  
  337. end
  338.  
  339. --coils----
  340. tm1.setTextColor(colors.white)
  341. tm1.setCursorPos(15,3)
  342. tm1.write("Coils:")
  343. tm1.setCursorPos(22,3)
  344.  
  345. if t1.getInductorEngaged() == true then
  346. tm1.setTextColor(colors.green)
  347. tm1.write("ACTIVE")
  348. else
  349. tm1.setTextColor(colors.red)
  350. tm1.write("INACTIVE")
  351. end
  352.  
  353. --Percent capacitor filled----
  354. local t1per = math.floor((t1.getEnergyStored() / 1000000) * 100)
  355.  
  356. tm1.setTextColor(colors.white)
  357. tm1.setCursorPos(1,5)
  358. tm1.write("Power:")
  359.  
  360. --color coding
  361. if t1per >= 75 then
  362. tm1.setTextColor(colors.green)
  363.  
  364. elseif (t1per < 75) and (t1per >= 50) then
  365. tm1.setTextColor(colors.yellow)
  366.  
  367. elseif (t1per <50) and (t1per >= 25) then
  368. tm1.setTextColor(colors.orange)
  369.  
  370. elseif t1per < 25 then
  371. tm1.setTextColor(colors.red)
  372.  
  373. end
  374.  
  375. --adjust cursor
  376. if t1per >= 100 then
  377. tm1.setCursorPos(20,5)
  378.  
  379. elseif (t1per < 100) and (t1per >= 10) then
  380. tm1.setCursorPos(21,5)
  381.  
  382. elseif t1per < 10 then
  383. tm1.setCursorPos(22,5)
  384.  
  385. end
  386.  
  387. tm1.write(t1per)
  388.  
  389. tm1.setTextColor(colors.white)
  390. tm1.setCursorPos(25,5)
  391. tm1.write(" %")
  392.  
  393. --Power output----
  394. local t1powertick = t1.getEnergyProducedLastTick()
  395.  
  396. tm1.setTextColor(colors.white)
  397. tm1.setCursorPos(1,7)
  398. tm1.write("Rate:")
  399.  
  400. if t1powertick >= 10000 then
  401. tm1.setCursorPos(18,7)
  402.  
  403. elseif (t1powertick < 10000) and (t1powertick >= 1000) then
  404. tm1.setCursorPos(19,7)
  405.  
  406. elseif (t1powertick < 1000) and (t1powertick >= 100) then
  407. tm1.setCursorPos(20,7)
  408.  
  409. elseif (t1powertick < 100) and (t1powertick >= 10) then
  410. tm1.setCursorPos(21,7)
  411.  
  412. elseif t1powertick < 10 then
  413. tm1.setCursorPos(22,7)
  414.  
  415. end
  416.  
  417. tm1.write(t1powertick)
  418.  
  419. tm1.setTextColor(colors.white)
  420. tm1.setCursorPos(25,7)
  421. tm1.write(" RF/T")
  422.  
  423. --RPM----
  424. local t1rpm = math.floor(t1.getRotorSpeed())
  425.  
  426. tm1.setTextColor(colors.white)
  427. tm1.setCursorPos(1,9)
  428. tm1.write("RPM:")
  429.  
  430. --color coding
  431. if t1rpm >= 2000 then
  432. tm1.setTextColor(colors.red)
  433.  
  434. elseif (t1rpm < 2000) and (t1rpm >= 1900) then
  435. tm1.setTextColor(colors.orange)
  436.  
  437. elseif (t1rpm < 1900) and (t1rpm > 1825) then
  438. tm1.setTextColor(colors.yellow)
  439.  
  440. elseif (t1rpm <= 1825) and (t1rpm >= 1775) then
  441. tm1.setTextColor(colors.green)
  442.  
  443. elseif (t1rpm < 1775) and (t1rpm > 925) then
  444. tm1.setTextColor(colors.cyan)
  445.  
  446. elseif (t1rpm <= 925) and (t1rpm >= 875) then
  447. tm1.setTextColor(colors.green)
  448.  
  449. elseif (t1rpm < 875) and (t1rpm >= 500) then
  450. tm1.setTextColor(colors.cyan)
  451.  
  452. elseif t1rpm < 500 then
  453. tm1.setTextColor(colors.white)
  454.  
  455. end
  456.  
  457. --adjust cursor
  458. if t1rpm >= 1000 then
  459. tm1.setCursorPos(19,9)
  460.  
  461. elseif (t1rpm < 1000) and (t1rpm >= 100) then
  462. tm1.setCursorPos(20,9)
  463.  
  464. elseif (t1rpm < 100) and (t1rpm >= 10) then
  465. tm1.setCursorPos(21,9)
  466.  
  467. elseif t1rpm < 10 then
  468. tm1.setCursorPos(22,9)
  469.  
  470. end
  471.  
  472. tm1.write(t1rpm)
  473.  
  474. tm1.setTextColor(colors.white)
  475. tm1.setCursorPos(25,9)
  476. tm1.write(" RPM ")
  477.  
  478. --Steam flow----
  479. local t1steam = t1.getFluidFlowRateMax()
  480.  
  481. tm1.setTextColor(colors.white)
  482. tm1.setCursorPos(1,11)
  483. tm1.write("Steam Flow:")
  484.  
  485. --adjust cursor
  486. if t1.getActive() == true then
  487. tm1.setCursorPos(19,11)
  488. tm1.write(t1steam)
  489.  
  490. else
  491. tm1.setCursorPos(22,11)
  492. tm1.write("0.0")
  493.  
  494. end
  495.  
  496. tm1.setTextColor(colors.white)
  497. tm1.setCursorPos(25,11)
  498. tm1.write(" MB/T")
  499.  
  500. --Turbine 2 display----------------------------------------------------
  501. tm2.clear()
  502.  
  503. tm2.setTextColor(colors.white)
  504. tm2.setCursorPos(1,1)
  505. tm2.write("Turbine 2")
  506.  
  507. --status----
  508. tm2.setCursorPos(14,1)
  509. tm2.write("Status:")
  510. tm2.setCursorPos(22,1)
  511.  
  512. if t2.getActive() == true then
  513. tm2.setTextColor(colors.green)
  514. tm2.write("ONLINE")
  515.  
  516. else
  517. tm2.setTextColor(colors.red)
  518. tm2.write("OFFLINE")
  519.  
  520. end
  521.  
  522. --coils----
  523. tm2.setTextColor(colors.white)
  524. tm2.setCursorPos(15,3)
  525. tm2.write("Coils:")
  526. tm2.setCursorPos(22,3)
  527.  
  528. if t2.getInductorEngaged() == true then
  529. tm2.setTextColor(colors.green)
  530. tm2.write("ACTIVE")
  531. else
  532. tm2.setTextColor(colors.red)
  533. tm2.write("INACTIVE")
  534. end
  535.  
  536. --Percent capacitor filled----
  537. local t2per = math.floor((t2.getEnergyStored() / 1000000) * 100)
  538.  
  539. tm2.setTextColor(colors.white)
  540. tm2.setCursorPos(1,5)
  541. tm2.write("Power:")
  542.  
  543. --color coding
  544. if t2per >= 75 then
  545. tm2.setTextColor(colors.green)
  546.  
  547. elseif (t2per < 75) and (t2per >= 50) then
  548. tm2.setTextColor(colors.yellow)
  549.  
  550. elseif (t2per <50) and (t2per >= 25) then
  551. tm2.setTextColor(colors.orange)
  552.  
  553. elseif t2per < 25 then
  554. tm2.setTextColor(colors.red)
  555.  
  556. end
  557.  
  558. --adjust cursor
  559. if t2per >= 100 then
  560. tm2.setCursorPos(20,5)
  561.  
  562. elseif (t2per < 100) and (t2per >= 10) then
  563. tm2.setCursorPos(21,5)
  564.  
  565. elseif t2per < 10 then
  566. tm2.setCursorPos(22,5)
  567.  
  568. end
  569.  
  570. tm2.write(t2per)
  571.  
  572. tm2.setTextColor(colors.white)
  573. tm2.setCursorPos(25,5)
  574. tm2.write(" %")
  575.  
  576. --Power output----
  577. local t2powertick = t2.getEnergyProducedLastTick()
  578.  
  579. tm2.setTextColor(colors.white)
  580. tm2.setCursorPos(1,7)
  581. tm2.write("Rate:")
  582.  
  583. if t2powertick >= 10000 then
  584. tm2.setCursorPos(18,7)
  585.  
  586. elseif (t2powertick < 10000) and (t2powertick >= 1000) then
  587. tm2.setCursorPos(19,7)
  588.  
  589. elseif (t2powertick < 1000) and (t2powertick >= 100) then
  590. tm2.setCursorPos(20,7)
  591.  
  592. elseif (t2powertick < 100) and (t2powertick >= 10) then
  593. tm2.setCursorPos(21,7)
  594.  
  595. elseif t2powertick < 10 then
  596. tm2.setCursorPos(22,7)
  597.  
  598. end
  599.  
  600. tm2.write(t2powertick)
  601.  
  602. tm2.setTextColor(colors.white)
  603. tm2.setCursorPos(25,7)
  604. tm2.write(" RF/T")
  605.  
  606. --RPM----
  607. local t2rpm = math.floor(t2.getRotorSpeed())
  608.  
  609. tm2.setTextColor(colors.white)
  610. tm2.setCursorPos(1,9)
  611. tm2.write("RPM:")
  612.  
  613. --color coding
  614. if t2rpm >= 2000 then
  615. tm2.setTextColor(colors.red)
  616.  
  617. elseif (t2rpm < 2000) and (t2rpm >= 1900) then
  618. tm2.setTextColor(colors.orange)
  619.  
  620. elseif (t2rpm < 1900) and (t2rpm > 1825) then
  621. tm2.setTextColor(colors.yellow)
  622.  
  623. elseif (t2rpm <= 1825) and (t2rpm >= 1775) then
  624. tm2.setTextColor(colors.green)
  625.  
  626. elseif (t2rpm < 1775) and (t2rpm > 925) then
  627. tm2.setTextColor(colors.cyan)
  628.  
  629. elseif (t2rpm <= 925) and (t2rpm >= 875) then
  630. tm2.setTextColor(colors.green)
  631.  
  632. elseif (t2rpm < 875) and (t2rpm >= 500) then
  633. tm2.setTextColor(colors.cyan)
  634.  
  635. elseif t2rpm < 500 then
  636. tm2.setTextColor(colors.white)
  637.  
  638. end
  639.  
  640. --adjust cursor
  641. if t2rpm >= 1000 then
  642. tm2.setCursorPos(19,9)
  643.  
  644. elseif (t2rpm < 1000) and (t2rpm >= 100) then
  645. tm2.setCursorPos(20,9)
  646.  
  647. elseif (t2rpm < 100) and (t2rpm >= 10) then
  648. tm2.setCursorPos(21,9)
  649.  
  650. elseif t2rpm < 10 then
  651. tm2.setCursorPos(22,9)
  652.  
  653. end
  654.  
  655. tm2.write(t2rpm)
  656.  
  657. tm2.setTextColor(colors.white)
  658. tm2.setCursorPos(25,9)
  659. tm2.write(" RPM ")
  660.  
  661. --Steam flow----
  662. local t2steam = t2.getFluidFlowRateMax()
  663.  
  664. tm2.setTextColor(colors.white)
  665. tm2.setCursorPos(1,11)
  666. tm2.write("Steam Flow:")
  667.  
  668. --adjust cursor
  669. if t2.getActive() == true then
  670. tm2.setCursorPos(19,11)
  671. tm2.write(t2steam)
  672.  
  673. else
  674. tm2.setCursorPos(22,11)
  675. tm2.write("0.0")
  676.  
  677. end
  678.  
  679. tm2.setTextColor(colors.white)
  680. tm2.setCursorPos(25,11)
  681. tm2.write(" MB/T")
  682.  
  683.  
  684. --Turbine 3 display----------------------------------------------------
  685. tm3.clear()
  686.  
  687. tm3.setTextColor(colors.white)
  688. tm3.setCursorPos(1,1)
  689. tm3.write("Turbine 3")
  690.  
  691. --status----
  692. tm3.setCursorPos(14,1)
  693. tm3.write("Status:")
  694. tm3.setCursorPos(22,1)
  695.  
  696. if t3.getActive() == true then
  697. tm3.setTextColor(colors.green)
  698. tm3.write("ONLINE")
  699.  
  700. else
  701. tm3.setTextColor(colors.red)
  702. tm3.write("OFFLINE")
  703.  
  704. end
  705.  
  706. --coils----
  707. tm3.setTextColor(colors.white)
  708. tm3.setCursorPos(15,3)
  709. tm3.write("Coils:")
  710. tm3.setCursorPos(22,3)
  711.  
  712. if t3.getInductorEngaged() == true then
  713. tm3.setTextColor(colors.green)
  714. tm3.write("ACTIVE")
  715. else
  716. tm3.setTextColor(colors.red)
  717. tm3.write("INACTIVE")
  718. end
  719.  
  720. --Percent capacitor filled----
  721. local t3per = math.floor((t3.getEnergyStored() / 1000000) * 100)
  722.  
  723. tm3.setTextColor(colors.white)
  724. tm3.setCursorPos(1,5)
  725. tm3.write("Power:")
  726.  
  727. --color coding
  728. if t3per >= 75 then
  729. tm3.setTextColor(colors.green)
  730.  
  731. elseif (t3per < 75) and (t3per >= 50) then
  732. tm3.setTextColor(colors.yellow)
  733.  
  734. elseif (t3per <50) and (t3per >= 25) then
  735. tm3.setTextColor(colors.orange)
  736.  
  737. elseif t3per < 25 then
  738. tm3.setTextColor(colors.red)
  739.  
  740. end
  741.  
  742. --adjust cursor
  743. if t3per >= 100 then
  744. tm3.setCursorPos(20,5)
  745.  
  746. elseif (t3per < 100) and (t3per >= 10) then
  747. tm3.setCursorPos(21,5)
  748.  
  749. elseif t3per < 10 then
  750. tm3.setCursorPos(22,5)
  751.  
  752. end
  753.  
  754. tm3.write(t3per)
  755.  
  756. tm3.setTextColor(colors.white)
  757. tm3.setCursorPos(25,5)
  758. tm3.write(" %")
  759.  
  760. --Power output----
  761. local t3powertick = t3.getEnergyProducedLastTick()
  762.  
  763. tm3.setTextColor(colors.white)
  764. tm3.setCursorPos(1,7)
  765. tm3.write("Rate:")
  766.  
  767. if t3powertick >= 10000 then
  768. tm3.setCursorPos(18,7)
  769.  
  770. elseif (t3powertick < 10000) and (t3powertick >= 1000) then
  771. tm3.setCursorPos(19,7)
  772.  
  773. elseif (t3powertick < 1000) and (t3powertick >= 100) then
  774. tm3.setCursorPos(20,7)
  775.  
  776. elseif (t3powertick < 100) and (t3powertick >= 10) then
  777. tm3.setCursorPos(21,7)
  778.  
  779. elseif t3powertick < 10 then
  780. tm3.setCursorPos(22,7)
  781.  
  782. end
  783.  
  784. tm3.write(t3powertick)
  785.  
  786. tm3.setTextColor(colors.white)
  787. tm3.setCursorPos(25,7)
  788. tm3.write(" RF/T")
  789.  
  790. --RPM----
  791. local t3rpm = math.floor(t3.getRotorSpeed())
  792.  
  793. tm3.setTextColor(colors.white)
  794. tm3.setCursorPos(1,9)
  795. tm3.write("RPM:")
  796.  
  797. --color coding
  798. if t3rpm >= 2000 then
  799. tm3.setTextColor(colors.red)
  800.  
  801. elseif (t3rpm < 2000) and (t3rpm >= 1900) then
  802. tm3.setTextColor(colors.orange)
  803.  
  804. elseif (t3rpm < 1900) and (t3rpm > 1825) then
  805. tm3.setTextColor(colors.yellow)
  806.  
  807. elseif (t3rpm <= 1825) and (t3rpm >= 1775) then
  808. tm3.setTextColor(colors.green)
  809.  
  810. elseif (t3rpm < 1775) and (t3rpm > 925) then
  811. tm3.setTextColor(colors.cyan)
  812.  
  813. elseif (t3rpm <= 925) and (t3rpm >= 875) then
  814. tm3.setTextColor(colors.green)
  815.  
  816. elseif (t3rpm < 875) and (t3rpm >= 500) then
  817. tm3.setTextColor(colors.cyan)
  818.  
  819. elseif t3rpm < 500 then
  820. tm3.setTextColor(colors.white)
  821.  
  822. end
  823.  
  824. --adjust cursor
  825. if t3rpm >= 1000 then
  826. tm3.setCursorPos(19,9)
  827.  
  828. elseif (t3rpm < 1000) and (t3rpm >= 100) then
  829. tm3.setCursorPos(20,9)
  830.  
  831. elseif (t3rpm < 100) and (t3rpm >= 10) then
  832. tm3.setCursorPos(21,9)
  833.  
  834. elseif t3rpm < 10 then
  835. tm3.setCursorPos(22,9)
  836.  
  837. end
  838.  
  839. tm3.write(t3rpm)
  840.  
  841. tm3.setTextColor(colors.white)
  842. tm3.setCursorPos(25,9)
  843. tm3.write(" RPM ")
  844.  
  845. --Steam flow----
  846. local t3steam = t3.getFluidFlowRateMax()
  847.  
  848. tm3.setTextColor(colors.white)
  849. tm3.setCursorPos(1,11)
  850. tm3.write("Steam Flow:")
  851.  
  852. --adjust cursor
  853. if t3.getActive() == true then
  854. tm3.setCursorPos(19,11)
  855. tm3.write(t2steam)
  856.  
  857. else
  858. tm3.setCursorPos(22,11)
  859. tm3.write("0.0")
  860.  
  861. end
  862.  
  863. tm3.setTextColor(colors.white)
  864. tm3.setCursorPos(25,11)
  865. tm3.write(" MB/T")
  866.  
  867.  
  868. --Automatic System Control------------------------------------------------------
  869.  
  870. --Turbine 1 Automatic Controls----
  871. if t1auto == true then
  872.  
  873. --toggle turbine 1
  874. if t1per >= 95 then
  875. t1.setActive(false)
  876.  
  877. elseif t1per <= 0 then
  878. t1.setActive(true)
  879.  
  880. end
  881.  
  882. --toggle coils 1
  883. if t1.getActive() == true then
  884.  
  885. if t1.getRotorSpeed() >= 500 then
  886. t1.setInductorEngaged(true)
  887. else
  888. t1.setInductorEngaged(false)
  889. end
  890.  
  891. else
  892. t1.setInductorEngaged(true)
  893. end
  894.  
  895. else
  896. t1.setActive(false)
  897. end
  898.  
  899. --Turbine 2 Automatic Controls----
  900. if t2auto == true then
  901.  
  902. --toggle turbine 2
  903. if t2per >= 95 then
  904. t2.setActive(false)
  905.  
  906. elseif t2per <= 0 then
  907. t2.setActive(true)
  908.  
  909. end
  910.  
  911. --toggle coils 2
  912. if t2.getActive() == true then
  913.  
  914. if t2.getRotorSpeed() >= 500 then
  915. t2.setInductorEngaged(true)
  916. else
  917. t2.setInductorEngaged(false)
  918. end
  919.  
  920. else
  921. t2.setInductorEngaged(true)
  922. end
  923.  
  924. else
  925. t2.setActive(false)
  926. end
  927.  
  928. --Turbine 3 Automatic Controls----
  929. if t3auto == true then
  930.  
  931. --toggle turbine 3
  932. if t3per >= 95 then
  933. t3.setActive(false)
  934.  
  935. elseif t3per <= 0 then
  936. t3.setActive(true)
  937.  
  938. end
  939.  
  940. --toggle coils 3
  941. if t3.getActive() == true then
  942.  
  943. if t3.getRotorSpeed() >= 500 then
  944. t3.setInductorEngaged(true)
  945. else
  946. t3.setInductorEngaged(false)
  947. end
  948.  
  949. else
  950. t3.setInductorEngaged(true)
  951. end
  952.  
  953. else
  954. t3.setActive(false)
  955. end
  956.  
  957. --Reactor Automatic Controls----
  958. if r1auto == true then
  959.  
  960. --toggle reactor
  961. if (t1.getActive() == false) and (t2.getActive() == false) then
  962. r1.setActive(false)
  963.  
  964. else
  965. r1.setActive(true)
  966. r1.setAllControlRodLevels(100)
  967.  
  968. end
  969.  
  970. --rod control
  971. if temp >= 2000 then
  972.  
  973. if rods <= 98 then
  974. rods = rods + 2
  975. end
  976.  
  977. elseif (temp < 2000) and (temp >= 1500) then
  978.  
  979. if rods <= 99 then
  980. rods = rods + 1
  981. end
  982.  
  983. elseif (temp < 1500) and (temp >= 1000) then
  984.  
  985. if rods <= 99 then
  986. rods = rods + 1
  987. end
  988.  
  989. elseif (temp < 1000) and (temp >= 500) then
  990. --ideal
  991.  
  992. elseif temp < 500 then
  993.  
  994. if rods >= 0 then
  995. rods = rods - 1
  996. end
  997.  
  998. end
  999.  
  1000. r1.setAllControlRodLevels(rods)
  1001.  
  1002. else
  1003. r1.setAllControlRodLevels(100)
  1004. r1.setActive(false)
  1005.  
  1006. end
  1007.  
  1008. --Button Press--------------------------------------------------------
  1009. os.startTimer(1)
  1010.  
  1011. while true do
  1012. local evt = {os.pullEvent()}
  1013. if evt[1]=="timer" then
  1014. break
  1015. elseif evt[1]=="monitor_touch" then
  1016. local x,y = evt[3],evt[4]
  1017. if evt[2] == "monitor_25" then
  1018.  
  1019. --ON--
  1020. if x>=18 and x<=22 then
  1021. btn(y,"on")
  1022.  
  1023. if y==1 then
  1024. r1.setActive(true)
  1025. r1auto = true
  1026.  
  1027. elseif y==2 then
  1028. t1.setActive(true)
  1029. t1auto = true
  1030.  
  1031. elseif y==3 then
  1032. t2.setActive(true)
  1033. t2auto = true
  1034.  
  1035. elseif y==4 then
  1036. t3.setActive(true)
  1037. t3auto = true
  1038.  
  1039. elseif y==5 then
  1040. redstone.setOutput("top",true)
  1041.  
  1042. end
  1043.  
  1044. --OFF--
  1045. elseif x>25 and x<=30 then
  1046. btn(y,"off")
  1047.  
  1048. if y==1 then
  1049. r1.setActive(false)
  1050. r1auto = false
  1051.  
  1052. elseif y==2 then
  1053. t1.setActive(false)
  1054. t1auto = false
  1055.  
  1056. elseif y==3 then
  1057. t2.setActive(false)
  1058. t2auto = false
  1059.  
  1060. elseif y==4 then
  1061. t3.setActive(false)
  1062. t3auto = false
  1063.  
  1064. elseif y==5 then
  1065. redstone.setOutput("top",false)
  1066.  
  1067. end
  1068. end
  1069. end
  1070. end
  1071. end
  1072. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement