daily pastebin goal
65%
SHARE
TWEET

BigReactorsController

Malishara Nov 14th, 2017 (edited) 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Modified version of script by Vircomore
  2. -- original version at https://pastebin.com/JCa6CmhL
  3.  
  4. -- changed to work with a single reactor only
  5.  
  6. print('ReactorControl Engaged. View Monitor.')
  7.  
  8. emptyflag=0
  9. offlineflag=0
  10. flashflag=0
  11.  
  12. reactor=peripheral.wrap('BigReactors-Reactor_0')
  13. monitor=peripheral.wrap('monitor_0')
  14.  
  15. monitor.setTextScale(1)
  16. monitor.setBackgroundColor(colors.black)
  17.  
  18. while true do
  19. monitor.clear()
  20. monitor.setCursorPos(1,1)
  21. monitor.setTextColor(colors.white)
  22. monitor.write('Fuel Level:')
  23. monitor.setCursorPos(1,2)
  24. monitor.setTextColor(colors.yellow)
  25. monitor.write(math.floor(((reactor.getFuelAmount()/reactor.getFuelAmountMax())*100)+0.5)..'% Fuel')
  26. monitor.setCursorPos(1,3)
  27. monitor.setTextColor(colors.lightBlue)
  28. monitor.write(math.floor(((reactor.getWasteAmount()/reactor.getFuelAmountMax())*100)+0.5)..'% Waste')
  29. monitor.setCursorPos(1,5)
  30. monitor.setTextColor(colors.white)
  31. monitor.write('Control Rod Levels:')
  32. monitor.setTextColor(colors.green)
  33. monitor.setCursorPos(1,6)
  34. monitor.write('  '..(100-(reactor.getControlRodLevel(0)))..'% Depth')
  35. monitor.setCursorPos(1,12)
  36. monitor.setTextColor(colors.white)
  37. monitor.write('Temperature:')
  38. monitor.setCursorPos(1,13)
  39. if reactor.getFuelTemperature()>=650 then
  40.     monitor.setTextColor(colors.purple)
  41.     else if reactor.getFuelTemperature()>=950 then
  42.         monitor.setTextColor(colors.red)
  43.     else
  44.     monitor.setTextColor(colors.green)
  45.     end
  46. end
  47. monitor.write('Reactor : '..reactor.getFuelTemperature()..'C')
  48. monitor.setCursorPos(1,16)
  49. monitor.setTextColor(colors.white)
  50. monitor.write('Flux:')
  51. monitor.setCursorPos(1,17)
  52. monitor.setTextColor(colors.green)
  53. monitor.write('  '..reactor.getEnergyStored()..' RF Stored      ')
  54.  
  55. if reactor.getEnergyProducedLastTick()>=500 and reactor.getEnergyProducedLastTick()<2000 then
  56.     monitor.setTextColor(colors.orange)
  57. end
  58.  
  59. if reactor.getEnergyProducedLastTick()>=2000 then
  60.     monitor.setTextColor(colors.red)
  61. end
  62. monitor.write((math.floor(reactor.getEnergyProducedLastTick()+0.5))..'RF/t')
  63.  
  64. monitor.setCursorPos(1,18)
  65.  
  66. monitor.setCursorPos(1,20)
  67. monitor.setTextColor(colors.orange)
  68. monitor.write('Warnings:')
  69.  
  70. if flashflag==0 then
  71.   flashflag=1
  72.   if offlineflag==1 then
  73.     monitor.setCursorPos(1,21)
  74.     monitor.setTextColor(colors.lightGray)
  75.     monitor.write('OFFLINE - Manual Override')
  76.   end
  77.   if emptyflag==1 then
  78.     monitor.setCursorPos(1,21)
  79.     monitor.setTextColor(colors.pink)
  80.     monitor.write('OFFLINE - Fuel Exhausted')
  81.   end
  82.   if emptyflag==0 and offlineflag==0 and reactor.getControlRodLevel(0)>75 then
  83.     monitor.setCursorPos(1,21)
  84.     monitor.setTextColor(colors.yellow)
  85.     monitor.write('ONLINE - Low Power Mode')
  86.   end
  87.   if emptyflag==0 and offlineflag==0 and reactor.getControlRodLevel(0)<=75 then
  88.     monitor.setCursorPos(1,21)
  89.     monitor.setTextColor(colors.orange)
  90.     monitor.write('ONLINE - High Power Mode')
  91.   end
  92. else
  93.   flashflag=0
  94.   monitor.setCursorPos(1,21)
  95.   monitor.clearLine()
  96. end
  97.  
  98. if reactor.getEnergyStored()<=10000000 and reactor.getEnergyStored()>100 then
  99.     reactor.setAllControlRodLevels(0+(math.floor(reactor.getEnergyStored()/100000)))
  100. else
  101.     reactor.setAllControlRodLevels(0)
  102. end
  103.  
  104.  
  105. if (reactor.getFuelAmount()<=100 and offlineflag==0) then
  106.     reactor.setAllControlRodLevels(100)
  107.     reactor.setActive(false)
  108.     emptyflag=1
  109. else
  110.     emptyflag=0
  111. end
  112.      
  113. if rs.getInput('bottom')==false and emptyflag==0 then
  114.     reactor.setActive(true)
  115.     offlineflag=0
  116. end
  117.  
  118. if rs.getInput('bottom')==true and emptyflag==0 then
  119.     reactor.setActive(false)
  120.     reactor.setAllControlRodLevels(100)
  121.     offlineflag=1
  122. end    
  123. sleep(1)
  124. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top