30 lines
717 B
Lua
30 lines
717 B
Lua
|
|
local function getValue(reactor)
|
|
return reactor.getTemperature() or 0
|
|
end
|
|
|
|
local function watch(reactor, monitor)
|
|
print("Temperature: " .. getValue(reactor))
|
|
sleep(1)
|
|
end
|
|
|
|
local function color(reactor)
|
|
local temperature = getValue(reactor)
|
|
return colors.black
|
|
end
|
|
|
|
local function report(reactor, monitor)
|
|
local value = getValue(reactor)
|
|
local color = color(reactor)
|
|
configureReport(monitor)
|
|
monitor.setBackgroundColor(color)
|
|
monitor.write("Coolant: " .. value .. "%")
|
|
end
|
|
|
|
local function configureReport(monitor)
|
|
local x,y = monitor.getCursorPos()
|
|
monitor.setCursorPos(x, y + 1)
|
|
monitor.clearLine()
|
|
end
|
|
|
|
return { report = report, watch = watch} |