Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- modem = peripheral.wrap("back")
- modem.open(235)
- if #args > 0 and args[1] == "status" then
- while true do
- _,_,_,_,mesg,_ = os.pullEvent("modem_message")
- data = {}
- for i in string.gmatch(mesg,"([^,%s]+)") do
- data[#data+1] = i
- end
- power = tonumber(data[2])
- energy = tonumber(data[3])
- f_rate = tonumber(data[4])
- fuel = tonumber(data[5])
- rod_level = tonumber(data[6])
- term.clear()
- term.setCursorPos(1,1)
- term.write("Reactor: ")
- if data[1] == "true" then
- term.setTextColor(colors.green)
- term.write("Active")
- else
- term.setTextColor(colors.red)
- term.write("Inactive")
- end
- term.setTextColor(colors.white)
- term.setCursorPos(1,3)
- term.write("Energy: ")
- if energy < 10 then
- term.setTextColor(colors.red)
- elseif energy < 50 then
- term.setTextColor(colors.orange)
- elseif energy < 70 then
- term.setTextColor(colors.yellow)
- else
- term.setTextColor(colors.green)
- end
- term.write(tostring(energy).."%")
- term.setTextColor(colors.white)
- term.setCursorPos(1,4)
- term.write("Power: " .. tostring(power) .."K RF/t")
- term.setCursorPos(1,5)
- term.write("Fuel: ")
- if fuel < 10 then
- term.setTextColor(colors.red)
- elseif fuel < 50 then
- term.setTextColor(colors.orange)
- elseif fuel < 70 then
- term.setTextColor(colors.yellow)
- else
- term.setTextColor(colors.green)
- end
- term.write(tostring(fuel).."%")
- term.setTextColor(colors.white)
- term.setCursorPos(1,7)
- term.write("Fuel Burnup: "..tostring(f_rate).."mB/t")
- end
- else
- command = ""
- for _,arg in pairs(args) do
- command = command.." "..arg
- end
- --print(command)
- modem.transmit(233,235,command)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement