updated
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
local max = 15
|
local max = 15
|
||||||
local init = 3
|
local init = 3
|
||||||
local rateStep = 0.10
|
local rateStep = 0.10
|
||||||
|
local smallRateStep = 0.01
|
||||||
local min = 1
|
local min = 1
|
||||||
|
|
||||||
local function getValue()
|
local function getValue()
|
||||||
@@ -28,6 +29,13 @@ local function stepUp()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function slowStepDown()
|
||||||
|
local value = getValue()
|
||||||
|
if value > min then
|
||||||
|
reactor.setBurnRate(value - smallRateStep)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function stepDown()
|
local function stepDown()
|
||||||
local value = getValue()
|
local value = getValue()
|
||||||
if value > min then
|
if value > min then
|
||||||
@@ -35,7 +43,6 @@ local function stepDown()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function watch()
|
local function watch()
|
||||||
print("Setting Default Burn Rate to: " .. init)
|
print("Setting Default Burn Rate to: " .. init)
|
||||||
reactor.setBurnRate(init)
|
reactor.setBurnRate(init)
|
||||||
@@ -48,4 +55,4 @@ local function report()
|
|||||||
monitor.clearLine()
|
monitor.clearLine()
|
||||||
monitor.write("Burn Rate: " .. value)
|
monitor.write("Burn Rate: " .. value)
|
||||||
end
|
end
|
||||||
return { report = report, watch = watch, stepUp = stepUp, stepDown = stepDown }
|
return { report = report, watch = watch, stepUp = stepUp, stepDown = stepDown, slowStepDown = slowStepDown }
|
||||||
@@ -8,11 +8,13 @@ end
|
|||||||
local function checkCoolantLevel()
|
local function checkCoolantLevel()
|
||||||
local coolantLevel = getValue()
|
local coolantLevel = getValue()
|
||||||
if coolantLevel > maxValue then
|
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()
|
burnRateDriver.stepDown()
|
||||||
elseif coolantLevel < minValue then
|
|
||||||
print("Warning: Coolant below minimum! Stepping up burn rate.")
|
|
||||||
burnRateDriver.stepUp()
|
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user