Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --reactor
- if (not fs.exists("rAPI")) then shell.run("rom/programs/http/pastebin", "get", "wqWsCHUH", "rAPI") end
- os.loadAPI("rAPI")
- local wm = peripheral.find("modem")
- local r = peripheral.find("BigReactors-Reactor")
- if (wm == nil or r == nil) then
- print("Modem or reactor not found")
- error()
- end
- channel = 66
- replyChannel = 6
- wm.open(channel)
- while true do
- local event, mSide, sChannel, rChannel, message, sDis = os.pullEvent("modem_message")
- print(event .. ": " ..tostring(message))
- if (message ~= nil) then
- print(message)
- if (not rAPI.isMessageTable(message)) then
- if (message == "isActivelyCooled") then
- rAPI.replyCall(wm, replyChannel, channel, r.isActivelyCooled())
- elseif (message == "getActive") then
- rAPI.replyCall(wm, replyChannel, channel, r.getActive())
- elseif (message == "getEnergyProducedLastTick") then
- rAPI.replyCall(wm, replyChannel, channel, r.getEnergyProducedLastTick())
- elseif (message == "getFuelConsumedLastTick") then
- rAPI.replyCall(wm, replyChannel, channel, r.getFuelConsumedLastTick())
- elseif (message == "getFuelTemperature") then
- rAPI.replyCall(wm, replyChannel, channel, r.getFuelTemperature())
- elseif (message == "getHotFluidAmount") then
- rAPI.replyCall(wm, replyChannel, channel, r.getHotFluidAmount())
- end
- else
- print(message)
- local message = textutils.unserialize(message)
- print(message)
- if (message[1] == "setActive") then
- r.setActive(message[2])
- elseif (message[1] == "setAllControlRodLevels") then
- r.setAllControlRodLevels(message[2])
- elseif (message[1] == "getControlRodLevel") then
- rAPI.replyCall(wm, replyChannel, channel, r.getControlRodLevel(message[2]))
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement