Files
nova-corp/coolant_driver.lua
2025-06-14 18:53:55 -04:00

42 lines
1.0 KiB
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
-- Do nothing if coolant is above the max value
elseif coolantLevel > minValue then
-- print("Coolant approaching minimum, slowly stepping down burn rate.")
-- burnRateDriver.slowStepDown()
elseif coolantLevel <= minValue then
print("Warning: Coolant below minimum! Stepping down burn rate.")
burnRateDriver.stepDown()
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}