Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local reactor = peripheral.wrap("top")
- local controlID = 7
- local active = false
- function listen()
- rednet.open("left")
- while true do
- id, msg = rednet.receive()
- if msg == "Reactor true" then
- active = true
- print(msg)
- elseif msg == "Reactor false" then
- active = false
- print(msg)
- end
- end
- end
- function main_loop()
- while true do
- os.queueEvent("randomEvent")
- os.pullEvent()
- sendDetails()
- if active == false then
- reactor.setActive(false)
- else
- reactor.setActive(true)
- end
- end
- end
- function sendTemp()
- rednet.send(controlID, "Reactor 1 temperature = " .. reactor.getFuelTemperature())
- end
- function sendFuel()
- rednet.send(controlID, "Reactor 1 fuel amount = " .. reactor.getFuelAmount() .. "/" .. reactor.getFuelAmountMax())
- end
- function sentWater()
- rednet.send(controlID, "Reactor 1 water level = " .. reactor.getCoolantAmount() .. "/" .. reactor.CoolantAmountMax())
- end
- function sentSteam()
- rednet.send(controlID, "Reactor 1 steam level = " .. reactor.getHotFluidAmount() .. "/" .. reactor.getHotFluidAmountMax())
- end
- function sendDetails()
- sendTemp()
- sendFuel()
- sendWater()
- sendSteam()
- sleep(1)
- end
- parallel.waitForAll(listen, main_loop)
Advertisement
Add Comment
Please, Sign In to add comment