Advertisement
Plazter

Mekanism Reactor

Feb 21st, 2023 (edited)
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | Gaming | 0 0
  1.  reactor = peripheral.wrap("back")
  2.  
  3. local CoolantPerc = reactor.getCoolant().amount / reactor.getCoolantCapacity() *100
  4. local StartBurn = 28 -- Edit to reactor's capacity
  5. --local prevBurn = StartBurn
  6. local count = 1
  7. --local CurrentBurn = reactor.getActualBurnRate()
  8.  
  9.  
  10. local function HeatMonitor()
  11.     if reactor.getTemperature() > 600 then
  12.         CurrentBurn = CurrentBurn-1
  13.         reactor.setBurnRate(CurrentBurn)
  14.         prevBurn = CurrentBurn
  15.     end
  16. end
  17.  
  18. local function CheckCoolant()
  19.     prev = reactor.getActualBurnRate()
  20.     if reactor.getCoolant().amount/reactor.getCoolantCapacity()*100 < 90 then  
  21.         prev = reactor.getActualBurnRate()
  22.         reactor.setBurnRate(0)  
  23.     elseif reactor.getCoolant().amount / reactor.getCoolantCapacity()*100 == 100 then  
  24.         reactor.setBurnRate(prev)
  25.     end
  26. end
  27.  
  28. local function HeatedCoolantMonitor()
  29.     prev = reactor.getActualBurnRate()  
  30.     if reactor.getHeatedCoolant().amount > 10 then
  31.     prev = reactor.getActualBurnRate()
  32.     reactor.setBurnRate(0)
  33.     else
  34.     reactor.setBurnRate(prev)
  35.     end
  36. end
  37.  
  38. local function Translate()
  39.     if reactor.getStatus() == true then
  40.         mode = "Online "
  41.     else
  42.         mode = "Offline"
  43.     end
  44. end
  45.  
  46. reactor.setBurnRate(StartBurn)
  47.  
  48. term.clear()
  49. while true do
  50.     CurrentBurn = CurrentBurn
  51.      prev =
  52.     HeatMonitor()
  53.     CheckCoolant()
  54.     HeatedCoolantMonitor()
  55.     Translate()
  56.    
  57.     term.setCursorPos(1,1)
  58.     print("Fission Reactor Mode: ".. mode)
  59.     os.sleep(.5)
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement