Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednetSide = "bottom"
- monitorSide = "back"
- reactorArray = {"BigReactors-Reactor_0","BigReactors-Reactor_1","BigReactors-Reactor_2","BigReactors-Reactor_3"}
- turbineArray = {"BigReactors-Turbine_0","BigReactors-Turbine_1","BigReactors-Turbine_2","BigReactors-Turbine_3"}
- reactorWrap = {}
- turbineWrap = {}
- -- Rednet
- rednet.close(rednetSide)
- rednet.open(rednetSide)
- -- Wrap peripherals
- mon = peripheral.wrap(monitorSide)
- for i, turbine in ipairs(turbineArray) do -- Wrap turbine
- turbineWrap[i] = peripheral.wrap(turbine)
- end
- for r, reactor in ipairs(reactorArray) do -- Wrap reactor
- reactorWrap[r] = peripheral.wrap(reactor)
- end
- function setMonColor(color)
- mon.setTextColor(color)
- end
- -- Console clear
- term.clear()
- term.setCursorPos(1,1)
- term.write("Running total RF monitor.")
- -- While loop
- while true do
- mon.setCursorPos(1,1)
- mon.setTextScale(4)
- mon.setTextColor(colors.gray)
- mon.clear()
- rfTick = 0 -- Check for turbine activity
- turbineActive = false
- for key, wrapped in ipairs(turbineWrap) do
- rfTick = rfTick + wrapped.getEnergyProducedLastTick()
- if(turbineActive == false and wrapped.getActive() == true) then
- turbineActive = true
- end
- end
- reactorActive = false -- Check for reactor activity
- for key, wrapped in ipairs(reactorWrap) do
- if(reactorActive == false and wrapped.getActive() == true) then
- reactorActive = true
- end
- end
- if(reactorActive == true and rfTick < 20000) then -- Backup generators to get AE going
- rednet.send(21,"redstoneOn")
- rednet.send(22,"redstoneOn")
- setMonColor(colors.orange)
- else
- rednet.send(21,"redstoneOff")
- rednet.send(22,"redstoneOff")
- end
- if(reactorActive == true and turbineActive == true and rfTick > 0) then
- setMonColor(colors.green)
- end
- mon.write(string.format("%07d", rfTick))
- mon.write(" RF")
- sleep(60)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement