Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Reactor = BigReactors-Reactors_0
- cbtxt = "tile_blockcapacitorbank_name_0"
- -- Computer = computer_0
- cb = peripheral.wrap(cbtxt)
- r = peripheral.wrap("back")
- -- Initially turn the reactor off on reboot of computer
- r.setActive(false)
- rs = "off" -- current reactor state - used to display only
- -- Limits
- ul = 95 -- upper limit
- ll = 50 -- lower limit
- cbmax = cb.getMaxEnergyStored()
- print (cbmax)
- while true do
- cbcur = cb.getEnergyStored()
- cbper = 100 * cbcur/cbmax
- if cbper > ul then -- if above upper limit then reactor off
- r.setActive(false)
- rs = "off"
- end
- if cbper < ll then -- if below lower limit then reactor on
- r.setActive(true)
- rs = "on"
- end
- print(cbcur .. " of " .. cbmax .. " " .. cbper .. "% - Reactor is " .. rs)
- sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement