popatop15

Untitled

Oct 24th, 2020 (edited)
1,135
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local turbine = peripheral.wrap("left")
  2. local reactor = peripheral.wrap("BigReactors-Reactor_0")
  3. rednet.open("back")
  4. while true do
  5.     local tPower = turbine.getEnergyStored()
  6.  
  7.     local fuel = reactor.getFuelAmount()
  8.     local fuelMax = reactor.getFuelAmountMax()
  9.     local fuelPercent = math.floor(fuel/fuelMax*100)
  10.  
  11.     local status = {
  12.         ["reactor"] = {
  13.             status = "OK"
  14.         },
  15.         ["turbine"] = {
  16.             status = "OK"
  17.         }
  18.     }
  19.  
  20.     if tPower <= 990000 or fuelPercent <= 60 then
  21.         redstone.setOutput("right", true)
  22.         print("Turbine power or reactor fuel low... emitting")
  23.     else
  24.         redstone.setOutput("right", false)
  25.         print("Turbine power and reactor fuel OK.")
  26.     end
  27.  
  28.     if tPower <= 990000 then
  29.         status.turbine.status = "LOW POWER"
  30.     end
  31.  
  32.     if fuelPercent <= 60 then
  33.         status.reactor.status = "LOW FUEL"
  34.     end
  35.  
  36.     rednet.send(4, status)
  37.  
  38.     sleep(2)
  39. end
RAW Paste Data