Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scanner = peripheral.wrap("top")
- meta = scanner.getBlockMeta(0, -1, -2)
- rednet.open("back")
- reactorString = textutils.serialise(meta)
- function getReactorHeat()
- ha = string.find(reactorString, "heat = %d", plain)
- hb = ha + 12
- hc = ha + 6
- hd = string.sub(reactorString, hc, hb)
- he = string.gsub(hd, "[^%d]", "")
- hf = tonumber(he)
- return hf
- end
- function getEUOutput()
- ea = string.find(reactorString, "euOutput = %d", plain)
- eb = ea + 16
- ec = ea + 10
- ed = string.sub(reactorString, ec, eb)
- ee = string.gsub(ed, "[^%d]", "")
- ef = tonumber(ee)
- return ef
- end
- function getStatus()
- sa = string.find(reactorString, "active =", plain)
- sb = sa + 14
- sc = sa + 8
- sd = string.sub(reactorString, sc, sb)
- se = string.match(sd, "true")
- se2 = string.match(sd, "false")
- if se == "true" then
- return true
- elseif se2 == "false" then
- return false
- else
- return error("Reactor did not provide status")
- end
- end
- while true do
- meta = scanner.getBlockMeta(0, -1, -2)
- reactorString = textutils.serialise(meta)
- reactorTable = {getReactorHeat(), getEUOutput(), getStatus()}
- reactorData = textutils.serialise(reactorTable)
- id,message = rednet.receive()
- sleep(0.1)
- if id == 37 and message == "send.data" then
- rednet.send(37,reactorData)
- end
- end
Add Comment
Please, Sign In to add comment