Pralexio

Big Reactor controller on | off 1.10.2

Feb 27th, 2021 (edited)
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.38 KB | None | 0 0
  1. local component = require("component")
  2.  
  3. local rc = component.br_reactor
  4.  
  5. local Me = rc.getEnergyStored()
  6.  
  7. local function lvl()
  8.     local en = rc.getEnergyStored()
  9.     pct = (en * 100) / Me
  10. end
  11.  
  12. while true do
  13.     lvl()
  14.  
  15.     if pct < 20 and rc.getActive() == false then
  16.         rc.setActive(true)
  17.     elseif pct >= 99 and rc.getActive() == true then
  18.         rc.setActive(false)
  19.     end
  20. os.sleep(3)
  21. end
Add Comment
Please, Sign In to add comment