Advertisement
NanoBob

ReactorControl

Jul 21st, 2015
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.46 KB | None | 0 0
  1. local cell=peripheral.wrap("tile_thermalexpansion_cell_reinforced_name_0")
  2. local reactor=peripheral.wrap("BigReactors-Reactor_0")
  3. local maxEnergy=cell.getMaxEnergyStored("north")
  4.  
  5. function handleReactor()
  6.     local energy=cell.getEnergyStored("north")
  7.     print(energy.."/"..maxEnergy)
  8.     if energy>=maxEnergy*0.8 then
  9.         reactor.setActive(false)
  10.     elseif energy<=maxEnergy*0.3 then
  11.         reactor.setActive(true)
  12.     end
  13. end
  14.  
  15. while true do
  16.     handleReactor()
  17.     sleep(10)
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement