SHARE
TWEET

Big Reactors: Active Cooling Reactor

scadl Sep 20th, 2016 (edited) 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Simple Big Reactors Active Cooling Reactor control: Power only if steam tank low
  2.  
  3. while true do
  4.  
  5. local sides = {"left", "right", "top", "bottom", "front", "back"}
  6. local reactor, monitor
  7.  
  8. for i, side in pairs(sides) do
  9.     if (peripheral.isPresent(side)) then
  10.         local deviceType = peripheral.getType(side)
  11.         local peripher = peripheral.wrap(side)
  12.         if (deviceType == "monitor") then
  13.             peripher.setTextScale(0.9)
  14.             monitor = peripher
  15.         end
  16.         if (deviceType == "BigReactors-Reactor") then
  17.             reactor = peripher
  18.         end
  19.         print("Debug: side: '"..side.."', device: '"..deviceType.."'")
  20.     end
  21. end
  22.  
  23. monitor.clear()
  24. monitor.setCursorPos(1, 1)
  25. monitor.write('Reactor:')
  26. monitor.setCursorPos(1, 2)
  27. monitor.write('--------')
  28. monitor.setCursorPos(1,3)
  29. monitor.write('STATE:'..tostring(reactor.getActive()))
  30. if not reactor.getHotFluidType()
  31. then
  32. monitor.setCursorPos(1,5)
  33. monitor.write('No HOT fluid')
  34. else
  35. monitor.setCursorPos(1,5)
  36. monitor.write('HOT: '..reactor.getHotFluidType())
  37. monitor.setCursorPos(1,6)
  38. local chprc = (reactor.getHotFluidAmount()*100)/reactor.getHotFluidAmountMax()
  39. monitor.write('FILL: '..math.ceil(chprc).."%")
  40. monitor.setCursorPos(1,7)
  41. monitor.write('FILL: '..(reactor.getHotFluidAmount()/1000).." B")
  42. end
  43.  
  44. term.clear()
  45. term.setCursorPos(1, 1)
  46. term.write('Reactor:')
  47. term.setCursorPos(1, 2)
  48. term.write('--------')
  49. term.setCursorPos(1,3)
  50. term.write('STATE:'..tostring(reactor.getActive()))
  51. if not reactor.getHotFluidType()
  52. then
  53. term.setCursorPos(1,5)
  54. term.write('No HOT fluid')
  55. else
  56. term.setCursorPos(1,5)
  57. term.write('HOT FLUID: '..reactor.getHotFluidType())
  58. term.setCursorPos(1,6)
  59. local chprc = (reactor.getHotFluidAmount()*100)/reactor.getHotFluidAmountMax()
  60. term.write('FILL: '..math.ceil(chprc).."%")
  61. term.setCursorPos(1,7)
  62. term.write('FILL: '..reactor.getHotFluidAmount().." mB")
  63. end
  64.  
  65. term.setCursorPos(1,9)
  66. term.write("Press Ctrl+T")
  67. term.setCursorPos(1,10)
  68. term.write("to stop script")
  69.  
  70. if reactor.getHotFluidAmount() < reactor.getHotFluidAmountMax()/2
  71. then reactor.setActive(true)
  72. else reactor.setActive(false)
  73. end
  74.  
  75. sleep(2)
  76.  
  77. end
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top