Weastwood

Reactor Reader Edited

Sep 11th, 2022
810
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | Gaming | 1 0
  1. local reactor = peripheral.wrap("front")
  2. local wired = peripheral.wrap("right")
  3. local wireless = peripheral.wrap("left")
  4.  
  5. local relayID = 6
  6.  
  7. local active, euOutput, heat, heatMax
  8. local failsafeOn = false
  9.  
  10. function OpenWireless()
  11.     rednet.open("left")
  12. end
  13.  
  14. function SendToRelay(msg)
  15.     rednet.send(relayID, msg)
  16. end
  17.  
  18. function MainLoop()
  19.     while true do
  20.         sleep(1)
  21.         term.clear()
  22.        
  23.         active = reactor.getMetadata().reactor.active
  24.         euOutput = reactor.getOfferedEnergy()
  25.         heat = reactor.getMetadata().reactor.heat
  26.         heatMax = reactor.getMetadata().reactor.maxHeat
  27.        
  28.         OpenWireless()
  29.         SendToRelay("<active>" .. tostring(active))
  30.         SendToRelay("<euoutput>" .. euOutput)
  31.         SendToRelay("<heat>" .. heat)
  32.         SendToRelay("<heatmax>" .. heatMax)
  33.     end
  34. end
  35.  
  36. function FailSafe()
  37.     sleep(5)
  38.     if heat > (heatMax - 900) and failsafeOn == false then
  39.         redstone.setOutput("front", false)
  40.         failsafeOn = true
  41.     end
  42. end
  43.  
  44. redstone.setOutput("front", true)
  45. MainLoop()
  46.  
Advertisement
Add Comment
Please, Sign In to add comment