This commit is contained in:
2025-06-14 18:46:23 -04:00
parent aa56d4289b
commit 5557180a57
2 changed files with 15 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
local max = 15
local init = 3
local rateStep = 0.10
local smallRateStep = 0.01
local min = 1
local function getValue()
@@ -28,6 +29,13 @@ local function stepUp()
end
end
local function slowStepDown()
local value = getValue()
if value > min then
reactor.setBurnRate(value - smallRateStep)
end
end
local function stepDown()
local value = getValue()
if value > min then
@@ -35,7 +43,6 @@ local function stepDown()
end
end
local function watch()
print("Setting Default Burn Rate to: " .. init)
reactor.setBurnRate(init)
@@ -48,4 +55,4 @@ local function report()
monitor.clearLine()
monitor.write("Burn Rate: " .. value)
end
return { report = report, watch = watch, stepUp = stepUp, stepDown = stepDown }
return { report = report, watch = watch, stepUp = stepUp, stepDown = stepDown, slowStepDown = slowStepDown }

View File

@@ -8,11 +8,13 @@ end
local function checkCoolantLevel()
local coolantLevel = getValue()
if coolantLevel > maxValue then
print("Warning: Coolant above maximum! Stepping down burn rate.")
-- 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()
elseif coolantLevel < minValue then
print("Warning: Coolant below minimum! Stepping up burn rate.")
burnRateDriver.stepUp()
end
return true
end