Pralexio

Big Reactor Fuel Controller and Controller On|Off 1.10.2

Feb 28th, 2021 (edited)
614
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local component = require("component")
  2.  
  3. local rc = component.br_reactor
  4.  
  5. local Me = rc.getEnergyStored()
  6.  
  7. local FAM = rc.getFuelAmount()
  8.  
  9. local function nv()
  10.         local FM = rc.getFuelAmount()
  11.         ptt = (FM * 100) / FAM
  12.     end
  13.  
  14. while true do
  15.     nv()
  16.    
  17.     if ptt < 50 then
  18.         rc.setActive(false)
  19.     elseif ptt >= 51 then
  20.         rc.setActive(true)
  21.      end
  22.     os.sleep(1)
  23.  
  24. local function lvl()
  25.     local en = rc.getEnergyStored()
  26.     pct = (en * 100) / Me
  27. end
  28.  
  29. while true do
  30.     lvl()
  31.  
  32.     if pct < 20 and rc.getActive() == false then
  33.         rc.setActive(true)
  34.     elseif pct >= 99 and rc.getActive() == true then
  35.         rc.setActive(false)
  36.     end
  37. os.sleep(3)
  38. end
  39. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×