40 lines
943 B
Lua
40 lines
943 B
Lua
local maxValue = 80
|
|
local minValue = 60
|
|
|
|
local function getValue()
|
|
return (reactor.getCoolantFilledPercentage() or 0) * 100
|
|
end
|
|
|
|
local function checkCoolantLevel()
|
|
local coolantLevel = getValue()
|
|
if coolantLevel > maxValue then
|
|
print("Warning: Coolant above maximum! Stepping down burn rate.")
|
|
burnRateDriver.stepDown()
|
|
elseif coolantLevel < minValue then
|
|
print("Warning: Coolant below minimum! Stepping up burn rate.")
|
|
burnRateDriver.stepUp()
|
|
end
|
|
return true
|
|
end
|
|
|
|
local function watch()
|
|
while true do
|
|
checkCoolantLevel()
|
|
sleep(0.05)
|
|
end
|
|
end
|
|
|
|
-- local function watch()
|
|
-- checkCoolantLevel()
|
|
-- end
|
|
|
|
local function report()
|
|
local value = getValue()
|
|
local color = colors.black
|
|
monitor.setBackgroundColor(color)
|
|
monitor.clearLine()
|
|
monitor.write("Coolant: " .. value .. "%")
|
|
end
|
|
|
|
|
|
return { report = report, watch = watch} |