41 lines
954 B
Lua
41 lines
954 B
Lua
local maxValue = 100
|
|
local minValue = 0
|
|
|
|
local function configureReport(monitor)
|
|
local x,y = term.getCursorPos()
|
|
monitor.setCursorPos(x, y + 1)
|
|
monitor.clearLine()
|
|
end
|
|
|
|
local function getValue(reactor)
|
|
return (reactor.getCoolantFilledPercentage() or 0) * 100
|
|
end
|
|
|
|
local function configureReport(monitor)
|
|
local x,y = monitor.getCursorPos()
|
|
monitor.setCursorPos(x, y + 1)
|
|
monitor.clearLine()
|
|
end
|
|
|
|
local function color(reactor)
|
|
local coolantLevel = getValue(reactor)
|
|
return colors.black
|
|
end
|
|
|
|
|
|
local function watch(reactor, monitor)
|
|
local coolantLevel = getValue(reactor)
|
|
print("Coolant: " .. coolantLevel)
|
|
sleep(1)
|
|
end
|
|
|
|
local function report(reactor, monitor)
|
|
local value = getValue(reactor)
|
|
local color = color(reactor)
|
|
configureReport(monitor)
|
|
monitor.setBackgroundColor(color)
|
|
monitor.write("Coolant: " .. value .. "%")
|
|
end
|
|
|
|
|
|
return { report = report, watch = watch} |