Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- computerName = "reaktor1"
- controlUnit = "pcc1"
- CUid = 0
- rednet.open("top")
- rednet.host(computerName,computerName)
- reactor = peripheral.find("BigReactors-Reactor")
- reactorActive = false
- reactorRF = 0
- reactorCRL = 0
- reactorTemp = 0
- function lookup()
- while true do
- CUid = rednet.lookup(controlUnit)
- sleep(5)
- end
- end
- function send()
- while true do
- local LreactorActive = reactor.getActive()
- local LreactorRF = reactor.getEnergyProducedLastTick(0)
- local LreactorCRL = reactor.getControlRodLevel(0)
- local LreactorTemp = reactor.getFuelTemperature (0)
- reactorActive = LreactorActive
- reactorRF = LreactorRF
- reactorCRL = LreactorCRL
- reactorTemp = LreactorTemp
- rednet.broadcast(LreactorActive,computerName.."AK")
- rednet.broadcast(LreactorRF,computerName.."RF")
- rednet.broadcast(LreactorCRL,computerName.."CRL")
- rednet.broadcast(LreactorTemp,computerName.."Temp")
- sleep(2)
- end
- end
- function recieve()
- while true do
- event, sId, message, prot = os.pullEvent("rednet_message")
- if CUid and (CUid == sId) then
- if prot==computerName.."ToggleAK" then
- if message==computerName.."ON" then
- reactor.setActive(true)
- print("Fernsteuerung: Reaktor Aktiviert")
- elseif message==computerName.."OFF" then
- reactor.setActive(false)
- print("Fernsteuerung: Reaktor Deaktiviert")
- end
- end
- if prot==computerName.."changeCRL" then
- reactor.setAllControlRodLevels(message)
- print("Fernsteuerung: Reaktor CRL wurde auf "..message.." gestellt")
- end
- end
- end
- end
- parallel.waitForAny(lookup, send, recieve)
Add Comment
Please, Sign In to add comment