Advertisement
Guest User

startup

a guest
Jun 29th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.43 KB | None | 0 0
  1. mon = peripheral.wrap("left")
  2. r = peripheral.wrap("BigReactors-Reactor_0")
  3.  
  4. minimum_rf = 1000000
  5. maximum_rf = 9000000
  6.  
  7. function Main()
  8.   while true do
  9.     buffer = r.getEnergyStored()
  10.     is_on = r.getActive()
  11.    
  12.     if (buffer < minimum_rf) and (is_on == false) then
  13.       r.setActive(true)
  14.     elseif (buffer > maximum_rf) and (is_on == true) then
  15.       r.setActive(false)
  16.     end  
  17.     sleep(2)
  18.   end
  19. end
  20.  
  21. Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement