57 lines
1.2 KiB
Lua
57 lines
1.2 KiB
Lua
local max = 15
|
|
local init = 3
|
|
local rateStep = 0.04
|
|
local smallRateStep = 0.02
|
|
local min = 1
|
|
|
|
local function getValue()
|
|
return reactor.getBurnRate() or init
|
|
end
|
|
|
|
|
|
local function stepUp()
|
|
local value = getValue()
|
|
if value < max then
|
|
reactor.setBurnRate(value + rateStep)
|
|
end
|
|
end
|
|
|
|
local function slowStepDown()
|
|
local value = getValue()
|
|
if value > min then
|
|
reactor.setBurnRate(value - smallRateStep)
|
|
end
|
|
end
|
|
|
|
local function slowStepUp()
|
|
local value = getValue()
|
|
if value < max then
|
|
reactor.setBurnRate(value + smallRateStep)
|
|
end
|
|
end
|
|
|
|
local function stepDown()
|
|
local value = getValue()
|
|
if value > min then
|
|
reactor.setBurnRate(value - rateStep)
|
|
end
|
|
end
|
|
local function startup()
|
|
end
|
|
|
|
local function shutdown()
|
|
end
|
|
local function watch()
|
|
print("Setting Default Burn Rate to: " .. init)
|
|
reactor.setBurnRate(init)
|
|
end
|
|
|
|
local function report()
|
|
local color = colors.black
|
|
monitor.setBackgroundColor(color)
|
|
value = getValue()
|
|
|
|
setNewLine()
|
|
monitor.write("Burn Rate: " .. value)
|
|
end
|
|
return { report = report, watch = watch, stepUp = stepUp, stepDown = stepDown, slowStepDown = slowStepDown, slowStepUp = slowStepUp, startup = startup, shutdown = shutdown } |