Advertisement
DustinRosebery

Untitled

Jun 15th, 2015
527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. --HD & IPJ's KickAss Reactor Control v1.0.0
  2. -------------------------------------------
  3.  
  4. -- Abbreviations
  5. monitor = peripheral.wrap("monitor_25")
  6. t1 = peripheral.wrap("BigReactors-Turbine_18")
  7. r = peripheral.wrap("back")
  8. -- Colors
  9. headingColor = colors.blue
  10. inert = colors.yellow
  11. positive = colors.lime
  12. negative = colors.red
  13. backgroundColor = colors.gray
  14. windowColor = colors.lightGray
  15.  
  16. local function drawMain() --Defines Main GUI
  17.  
  18. -- Main window Heading
  19. monitor.setCursorPos(1,1)
  20. monitor.setBackgroundColor(backgroundColor)
  21. monitor.clear()
  22. monitor.setTextScale(2)
  23. monitor.setTextColor(headingColor)
  24. monitor.write(" HD & IPJ's KickAss Reactor Control")
  25. monitor.setCursorPos(1,2)
  26. monitor.write("- - - - - - - - - - - - - - - - - - -")
  27.  
  28. -- Windows
  29. -- ReactorWindow
  30. local reactorWindow = window.create(monitor, 2, 3, 17, 7)
  31. reactorWindow.setBackgroundColor(windowColor)
  32. reactorWindow.setVisible(true)
  33. --heading
  34. monitor.setCursorPos(2,3)
  35. monitor.setTextColor(headingColor)
  36. monitor.setCursorPos(2,3)
  37. monitor.write("Reactor")
  38. monitor.setCursorPos(2,4)
  39. monitor.write("- - - -")
  40.  
  41. end -- end drawMain()
  42.  
  43. -- Reactor Functions
  44.  
  45. -- Reactor Steam
  46. local function getSteam()
  47. steam = r.getHotFluidProducedLastTick()
  48. monitor.setCursorPos(2,5)
  49. monitor.setTextColor(inert)
  50. monitor.write("Steam: ")
  51.  
  52. if steam < 9500 then
  53. monitor.setTextColor(negative)
  54. else
  55. monit.setTextColor(positive)
  56. end
  57.  
  58. monitor.write(steam)
  59. monitor.setTextColor(inert)
  60. monitor.write"mB/t")
  61. os.sleep(1)
  62. end -- end Steam
  63.  
  64. -- Reactor Core Temp
  65. local function getCoreTemp()
  66. coreTemp = r.getFuelTemperature()
  67. monitor.setCursorPos(2,6)
  68. monitor.setTextColor(inert)
  69. monitor.write("CoreTemp: "..math.floor(coreTemp).."C")
  70. getSteam()
  71. end
  72.  
  73. -- Reactor Case Temp
  74. local function getCaseTemp()
  75. temp = r.getCasingTemperature()
  76. monitor.setCursorPos(2,7)
  77. monitor.setTextColor(inert)
  78. monitor.write("CaseTemp: "..math.floor(temp).."C")
  79. getCoreTemp()
  80.  
  81. -- Rounding
  82. local function roundPercent(num, idp)
  83. local mult = 10^(idp or 0)
  84. return math.floor((num / 1782) * mult + 0.5 / mult)/10
  85. end
  86.  
  87. -- Turbine Functions
  88.  
  89. -- Turbine Speed
  90. local function getTurbineSpeed()
  91. drawMain()
  92. speed = t1.getRotorSpeed()
  93.  
  94. monitor.setCursorPos(20,5)
  95. monitor.setTextColor(inert)
  96. monitor.write("Speed: ")
  97.  
  98. if speed < 1750 then
  99. monitor.setTextColor(negative)
  100. else
  101. monitor.setTextColor(positve)
  102. end
  103.  
  104. monitor.write(roundPercent(speed,3).."%")
  105. getCaseTemp()
  106. end -- end turbineSpeed
  107.  
  108. -- Start Of execution
  109. drawMain()
  110.  
  111. while true do
  112. getTurbineSpeed()
  113. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement