Advertisement
DustinRosebery

Untitled

Jun 15th, 2015
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 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.write("Reactor")
  37. monitor.setCursorPos(2,4)
  38. monitor.write("- - - -")
  39.  
  40. -- Turbine Window
  41. local turbine Window = window.create(monitor, 21, 3, 13, 16)
  42. turbineWindow.setBackgroundColor(windowColor)
  43. turbineWindow.setVisible(true)
  44. --heading
  45. monitor.setCursorPos(21,3)
  46. monitor.setTextColor(headingColor)
  47. monitor.write("Turbine 1")
  48. monitor.setCursorPos(21,4)
  49. monitor.write("- - - - -"
  50.  
  51. monitor.setCursorPos(21, 7)
  52. monitor.write("Turbine 2")
  53.  
  54.  
  55. end -- end drawMain()
  56.  
  57. -- Reactor Functions
  58.  
  59. -- Reactor Steam
  60. local function getSteam()
  61. steam = r.getHotFluidProducedLastTick()
  62. monitor.setCursorPos(2,5)
  63. monitor.setTextColor(inert)
  64. monitor.write("Steam: ")
  65.  
  66. if steam < 9500 then
  67. monitor.setTextColor(negative)
  68. else
  69. monit.setTextColor(positive)
  70. end
  71.  
  72. monitor.write(steam)
  73. monitor.setTextColor(inert)
  74. monitor.write"mB/t")
  75. os.sleep(1)
  76. end -- end Steam
  77.  
  78. -- Reactor Core Temp
  79. local function getCoreTemp()
  80. coreTemp = r.getFuelTemperature()
  81. monitor.setCursorPos(2,6)
  82. monitor.setTextColor(inert)
  83. monitor.write("CoreTemp: "..math.floor(coreTemp).."C")
  84. getSteam()
  85. end
  86.  
  87. -- Reactor Case Temp
  88. local function getCaseTemp()
  89. temp = r.getCasingTemperature()
  90. monitor.setCursorPos(2,7)
  91. monitor.setTextColor(inert)
  92. monitor.write("CaseTemp: "..math.floor(temp).."C")
  93. getCoreTemp()
  94.  
  95. -- Rounding
  96. local function roundPercent(num, idp)
  97. local mult = 10^(idp or 0)
  98. return math.floor((num / 1782) * mult + 0.5 / mult)/10
  99. end
  100.  
  101. -- Turbine Functions
  102.  
  103. -- Turbine Speed
  104. local function getTurbineSpeed()
  105. drawMain()
  106. speed = t1.getRotorSpeed()
  107.  
  108. monitor.setCursorPos(20,5)
  109. monitor.setTextColor(inert)
  110. monitor.write("Speed: ")
  111.  
  112. if speed < 1750 then
  113. monitor.setTextColor(negative)
  114. else
  115. monitor.setTextColor(positve)
  116. end
  117.  
  118. monitor.write(roundPercent(speed,3).."%")
  119. getCaseTemp()
  120. end -- end turbineSpeed
  121.  
  122. -- Start Of execution
  123. drawMain()
  124.  
  125. while true do
  126. getTurbineSpeed()
  127. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement