Compare commits
7 Commits
2711d658ea
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f32a319279 | |||
| 6fa6a024dc | |||
| a5922f5409 | |||
| ea5d127774 | |||
| 7525a331c5 | |||
| 4f1b4cc6d8 | |||
| eddb5e3744 |
5
.vscode/extensions.json
vendored
Normal file
5
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"jackmacwindows.vscode-computercraft"
|
||||
]
|
||||
}
|
||||
18
.vscode/settings.json
vendored
Normal file
18
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Lua.diagnostics.globals": [
|
||||
"shell"
|
||||
],
|
||||
"Lua.workspace.library": [
|
||||
"${addons}/cc-tweaked/module/library"
|
||||
],
|
||||
"Lua.runtime.version": "Lua 5.3",
|
||||
"Lua.runtime.builtin": {
|
||||
"io": "disable",
|
||||
"os": "disable"
|
||||
},
|
||||
"Lua.workspace.checkThirdParty": false,
|
||||
"Lua.diagnostics.disable": [
|
||||
"lowercase-global",
|
||||
"need-check-nil"
|
||||
]
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
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()
|
||||
return
|
||||
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 }
|
||||
8
consumer/main.lua
Normal file
8
consumer/main.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local monitor = peripheral.find("monitor")
|
||||
monitor.setCursorPos(1, 1)
|
||||
|
||||
local function run()
|
||||
monitor.write("Starting system...\n")
|
||||
end
|
||||
|
||||
return { run = run }
|
||||
8
consumer/startup.lua
Normal file
8
consumer/startup.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
shell.execute("rm", "kernel.lua")
|
||||
shell.execute("wget", "https://git.astrocore.space/root/nova-corp/raw/branch/main/kernel.lua")
|
||||
sleep(5)
|
||||
local kernel = require("kernel")
|
||||
local main = kernel.addFolderDriver("consumer", "main")
|
||||
main.run()
|
||||
|
||||
Binary file not shown.
@@ -1,51 +0,0 @@
|
||||
local maxValue = 90
|
||||
local minValue = 80
|
||||
local minCoolant = 20
|
||||
|
||||
local function getValue()
|
||||
return (reactor.getCoolantFilledPercentage() or 1) * 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 <= minCoolant then
|
||||
print("Critical Warning: Coolant below minimum safe level! SCRAMMING reactor.")
|
||||
reactor.scram()
|
||||
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 startup()
|
||||
return
|
||||
end
|
||||
|
||||
local function shutdown()
|
||||
end
|
||||
|
||||
local function report()
|
||||
local value = getValue()
|
||||
local color = colors.black
|
||||
monitor.setBackgroundColor(color)
|
||||
|
||||
setNewLine()
|
||||
monitor.write("Coolant: " .. value .. "%")
|
||||
end
|
||||
|
||||
|
||||
return { report = report, watch = watch, startup = startup, shutdown = shutdown }
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
local function getValue(env)
|
||||
local value = env.getRadiation()
|
||||
print(value.radiation, value.unit)
|
||||
local stringValue = tostring(value.radiation) .. " " .. tostring(value.unit)
|
||||
return stringValue
|
||||
end
|
||||
|
||||
local function watch()
|
||||
while true do
|
||||
sleep(0.05) -- Update every tenth second
|
||||
end
|
||||
end
|
||||
|
||||
local function startup()
|
||||
end
|
||||
|
||||
local function shutdown()
|
||||
end
|
||||
|
||||
local function report()
|
||||
setNewLine()
|
||||
setNewLine()
|
||||
monitor.setBackgroundColor(colors.blue)
|
||||
monitor.write("Radiation Levels:")
|
||||
monitor.setBackgroundColor(colors.black)
|
||||
local internal = getValue(internalEnvironment)
|
||||
local external = getValue(externalEnvironment)
|
||||
setNewLine()
|
||||
monitor.write("Internal: " .. internal)
|
||||
setNewLine()
|
||||
monitor.write("External: " .. external)
|
||||
end
|
||||
return { report = report, watch = watch, startup = startup, shutdown = shutdown }
|
||||
1486
external_alarm.dfpwm
1486
external_alarm.dfpwm
File diff suppressed because one or more lines are too long
Binary file not shown.
14
kernel.lua
14
kernel.lua
@@ -2,10 +2,20 @@ local function addDriver(fileName)
|
||||
local extension = ".lua"
|
||||
local fullFile = fileName .. extension
|
||||
shell.execute("rm", fullFile)
|
||||
local baseRoute = "https://git.astrocore.space/root/NovaCorpLLC/raw/branch/main/"
|
||||
local baseRoute = "https://git.astrocore.space/root/nova-corp/raw/branch/main/"
|
||||
shell.execute("wget", baseRoute .. fullFile)
|
||||
sleep(1)
|
||||
return require(fileName)
|
||||
end
|
||||
|
||||
return { addDriver = addDriver }
|
||||
local function addFolderDriver(folder, fileName)
|
||||
local extension = ".lua"
|
||||
local fullFile = fileName .. extension
|
||||
shell.execute("rm", fullFile)
|
||||
local baseRoute = "https://git.astrocore.space/root/nova-corp/raw/branch/main/"
|
||||
shell.execute("wget", baseRoute .. folder .. "/" .. fullFile)
|
||||
sleep(1)
|
||||
return require(fileName)
|
||||
end
|
||||
|
||||
return { addDriver = addDriver, addFolderDriver = addFolderDriver }
|
||||
126
main.lua
126
main.lua
@@ -1,126 +0,0 @@
|
||||
kernel = require("kernel")
|
||||
reactor = peripheral.find("fissionReactorLogicAdapter")
|
||||
turbine = peripheral.find("turbineValve")
|
||||
turbineVent = peripheral.find("turbineVent")
|
||||
monitor = peripheral.find("monitor")
|
||||
internalEnvironment = peripheral.wrap("environmentDetector_0")
|
||||
externalEnvironment = peripheral.wrap("environmentDetector_1")
|
||||
modem = peripheral.find("modem")
|
||||
controlRoomSpeakers = peripheral.find("speaker")
|
||||
|
||||
tempDriver = kernel.addDriver("temperature_driver")
|
||||
coolantDriver = kernel.addDriver("coolant_driver")
|
||||
statusDriver = kernel.addDriver("status_driver")
|
||||
turbineDriver = kernel.addDriver("turbine_driver")
|
||||
burnRateDriver = kernel.addDriver("burnrate_driver")
|
||||
environmentDriver = kernel.addDriver("environment_driver")
|
||||
speakerDriver = kernel.addDriver("speaker_driver")
|
||||
|
||||
isErrorState = false
|
||||
reactorStatus = false
|
||||
|
||||
function setNewLine()
|
||||
local x,y = monitor.getCursorPos()
|
||||
monitor.setCursorPos(1, y + 1)
|
||||
monitor.clearLine()
|
||||
end
|
||||
|
||||
local function runMonitors()
|
||||
if(reactorStatus) then
|
||||
parallel.waitForAll(
|
||||
tempDriver.watch,
|
||||
coolantDriver.watch,
|
||||
statusDriver.watch,
|
||||
turbineDriver.watch,
|
||||
burnRateDriver.watch,
|
||||
environmentDriver.watch)
|
||||
else
|
||||
end
|
||||
end
|
||||
|
||||
local function runDisplay()
|
||||
monitor.clear()
|
||||
monitor.setTextScale(1)
|
||||
while true do
|
||||
monitor.setCursorPos(1, 0)
|
||||
setNewLine()
|
||||
monitor.setBackgroundColor(colors.blue)
|
||||
monitor.write("Reactor Readings:")
|
||||
local drivers = {
|
||||
{ Label = "Status", driver = statusDriver},
|
||||
{ Label = "Temperature", driver = tempDriver },
|
||||
{ Label = "Coolant", driver = coolantDriver },
|
||||
{ Label = "Turbine", driver = turbineDriver },
|
||||
{ Label = "Burn Rate", driver = burnRateDriver },
|
||||
{ Label = "Radiation Level", driver = environmentDriver }
|
||||
}
|
||||
|
||||
|
||||
for i, item in ipairs(drivers) do
|
||||
item.driver.report()
|
||||
end
|
||||
|
||||
sleep(0.05) -- Update every tenth second
|
||||
end
|
||||
end
|
||||
|
||||
local function startup()
|
||||
parallel.waitForAll(tempDriver.startup,
|
||||
coolantDriver.startup,
|
||||
statusDriver.startup,
|
||||
turbineDriver.startup,
|
||||
burnRateDriver.startup,
|
||||
environmentDriver.startup)
|
||||
end
|
||||
|
||||
local function shutDown()
|
||||
parallel.waitForAll(tempDriver.shutDown,
|
||||
coolantDriver.shutDown,
|
||||
statusDriver.shutDown,
|
||||
turbineDriver.shutDown,
|
||||
burnRateDriver.shutDown,
|
||||
environmentDriver.shutDown)
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function runSafe()
|
||||
while not reactor do
|
||||
print("Waiting for reactor signal...")
|
||||
sleep(1)
|
||||
end
|
||||
while not turbine do
|
||||
print("Waiting for turbine signal...")
|
||||
sleep(1)
|
||||
end
|
||||
while not monitor do
|
||||
print("Waiting for monitor signal...")
|
||||
sleep(1)
|
||||
end
|
||||
|
||||
startup();
|
||||
monitor.clear();
|
||||
monitor.setBackgroundColor(colors.black)
|
||||
-- local names = peripheral.getNames()
|
||||
-- for index, value in ipairs(names) do
|
||||
-- print(index, value)
|
||||
-- read()
|
||||
-- end
|
||||
parallel.waitForAll(runMonitors, runDisplay)
|
||||
end
|
||||
|
||||
local function run()
|
||||
local success, err = pcall(runSafe)
|
||||
if not success then
|
||||
monitor.setTextColor(colors.red)
|
||||
monitor.write("Error: " .. err)
|
||||
isErrorState = true
|
||||
modem.open(500)
|
||||
modem.transmit(500, 500, "Error: " .. err)
|
||||
os.reboot()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return { run = run }
|
||||
@@ -1,32 +0,0 @@
|
||||
kernel = require("kernel")
|
||||
speakerDriver = kernel.addDriver("speaker_driver")
|
||||
local modem = peripheral.find("modem")
|
||||
local monitor = peripheral.wrap("top")
|
||||
controlRoomSpeakers = peripheral.find("speaker")
|
||||
|
||||
function setNewLine()
|
||||
local x,y = monitor.getCursorPos()
|
||||
monitor.setCursorPos(1, y + 1)
|
||||
monitor.clearLine()
|
||||
end
|
||||
|
||||
local function startup()
|
||||
speakerDriver.startup()
|
||||
speakerDriver.playTTSFile(peripheral.wrap("left"), "ELLO MATE LOVELY DAY INIT YOU GOT ANYYYY BEEEANSS AND TOAST ON YA MATE ID LOVE TO HAVE SOME BEANS N TOAST")
|
||||
speakerDriver.playTTSFile(peripheral.wrap("right"), "ELLO MATE LOVELY DAY INIT YOU GOT ANYYYY BEEEANSS AND TOAST ON YA MATE ID LOVE TO HAVE SOME BEANS N TOAST")
|
||||
end
|
||||
|
||||
local function run()
|
||||
monitor.setTextScale(0.5)
|
||||
monitor.setCursorPos(1,0)
|
||||
startup()
|
||||
while true do
|
||||
setNewLine()
|
||||
monitor.write("Checking for reactor status...")
|
||||
setNewLine()
|
||||
monitor.write("Checking main control loop...")
|
||||
sleep(2)
|
||||
end
|
||||
end
|
||||
|
||||
return { run = run }
|
||||
@@ -1,4 +0,0 @@
|
||||
local kernel = require("kernel")
|
||||
local main = kernel.addDriver("pairity_main")
|
||||
sleep(5)
|
||||
main.run()
|
||||
Binary file not shown.
@@ -1,130 +0,0 @@
|
||||
local dfpwm = require("cc.audio.dfpwm")
|
||||
local encoder = dfpwm.make_encoder()
|
||||
local decoder = dfpwm.make_decoder()
|
||||
local baseRoute = "https://git.astrocore.space/root/NovaCorpLLC/raw/branch/main/"
|
||||
|
||||
local function getFileName(name)
|
||||
local extension = ".dfpwm"
|
||||
local fullFile = name .. extension
|
||||
return fullFile
|
||||
end
|
||||
|
||||
local function randomFileName()
|
||||
local name = ""
|
||||
for i = 1, 12 do
|
||||
name = name .. string.char(math.random(97, 122)) -- a–z
|
||||
end
|
||||
return name
|
||||
end
|
||||
|
||||
local function playSound(speaker, fileName)
|
||||
local fileStream = getFileName(fileName)
|
||||
local values = io.lines(fileStream, 16 * 1024)
|
||||
for input in values do
|
||||
print("playing audo....")
|
||||
local decoded = decoder(input)
|
||||
while not speaker.playAudio(decoded, 3) do
|
||||
os.pullEvent("speaker_audio_empty")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function playControlRoomAlarm(speakers)
|
||||
playSound(speakers,"short_control_alarm")
|
||||
end
|
||||
|
||||
local function playExternalAlarm(speakers)
|
||||
playSound(speakers,"external_alarm")
|
||||
end
|
||||
|
||||
local function playInternalAlarm(speakers)
|
||||
playSound(speakers,"internal_alarm")
|
||||
end
|
||||
|
||||
local function playTTSFile(speakers, value)
|
||||
local message = textutils.urlEncode(value)
|
||||
local url = "http://api.astrocore.space/api/TextToSpeech?message=" .. message
|
||||
local response, err = http.get { url = url, binary = true }
|
||||
local name = randomFileName()
|
||||
local fileName = name .. ".dfpwm"
|
||||
|
||||
local fileData = response.readAll()
|
||||
local file = fs.open(fileName,"w")
|
||||
file.write(fileData)
|
||||
file.close()
|
||||
response.close()
|
||||
playSound(speakers, name)
|
||||
shell.execute("rm", fileName)
|
||||
end
|
||||
|
||||
local function createSoundFile(fileName)
|
||||
local name = getFileName(fileName)
|
||||
local fullPath = baseRoute .. name
|
||||
shell.execute("rm", name)
|
||||
local response = http.request({
|
||||
url = fullPath,
|
||||
method = "GET",
|
||||
binary = true
|
||||
})
|
||||
|
||||
|
||||
local event, url, handle
|
||||
repeat
|
||||
event, url, handle = os.pullEvent()
|
||||
if event == "http_failure" and url == fullPath then
|
||||
print("HTTP request failed for: " .. url)
|
||||
print(event)
|
||||
return nil
|
||||
end
|
||||
if event == "http_success" then
|
||||
print("Waiting for response for " .. fileName)
|
||||
end
|
||||
until event == "http_success" and url == fullPath
|
||||
print("Recieved response!")
|
||||
local fileData = handle.readAll()
|
||||
local file = fs.open(name,"w")
|
||||
|
||||
file.write(fileData)
|
||||
file.close()
|
||||
handle.close()
|
||||
end
|
||||
|
||||
|
||||
function addSoundFile(fileName)
|
||||
createSoundFile(fileName)
|
||||
end
|
||||
|
||||
local function watch()
|
||||
end
|
||||
|
||||
|
||||
local function startup()
|
||||
local sounds = {
|
||||
{ fileName = "short_control_alarm" },
|
||||
{ fileName = "external_alarm" },
|
||||
{ fileName = "internal_alarm" }
|
||||
}
|
||||
|
||||
for i, item in ipairs(sounds) do
|
||||
addSoundFile(item.fileName)
|
||||
print("Added sound file: " .. item.fileName)
|
||||
end
|
||||
end
|
||||
|
||||
local function shutdown()
|
||||
end
|
||||
|
||||
|
||||
local function report()
|
||||
end
|
||||
|
||||
return { report = report,
|
||||
watch = watch,
|
||||
startup = startup,
|
||||
shutdown = shutdown,
|
||||
playControlRoomAlarm = playControlRoomAlarm,
|
||||
addSoundFile = addSoundFile,
|
||||
playExternalAlarm = playExternalAlarm,
|
||||
playInternalAlarm = playInternalAlarm,
|
||||
playTTSFile = playTTSFile
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
speaker = peripheral.find("speaker")
|
||||
speakerDriver = kernel.addDriver("speaker_driver")
|
||||
|
||||
local function startup()
|
||||
parallel.waitForAll(speakerDriver.startup)
|
||||
end
|
||||
|
||||
local function shutDown()
|
||||
parallel.waitForAll(speakerDriver.shutDown)
|
||||
end
|
||||
|
||||
local function runSafe()
|
||||
startup()
|
||||
end
|
||||
|
||||
local function run()
|
||||
local success, err = pcall(runSafe)
|
||||
if not success then
|
||||
os.reboot()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return { run = run }
|
||||
@@ -1,4 +0,0 @@
|
||||
local kernel = require("kernel")
|
||||
local main = kernel.addDriver("speaker_main")
|
||||
sleep(5)
|
||||
main.run()
|
||||
@@ -1,4 +0,0 @@
|
||||
local kernel = require("kernel")
|
||||
local main = kernel.addDriver("main")
|
||||
sleep(5)
|
||||
main.run()
|
||||
@@ -1,42 +0,0 @@
|
||||
|
||||
local function getValue()
|
||||
return reactor.getStatus() or false
|
||||
end
|
||||
|
||||
|
||||
local function checkStatus()
|
||||
local value = getValue()
|
||||
end
|
||||
|
||||
local function watch()
|
||||
while true do
|
||||
checkStatus()
|
||||
sleep(0.05) -- Update every tenth second
|
||||
end
|
||||
end
|
||||
|
||||
local function startup()
|
||||
reactor.setBurnRate(2)
|
||||
local status = reactor.getStatus()
|
||||
if(not status) then
|
||||
reactor.activate()
|
||||
return
|
||||
end
|
||||
|
||||
reactorStatus = reactor.getStatus()
|
||||
end
|
||||
|
||||
local function shutdown()
|
||||
reactor.setBurnRate(0)
|
||||
reactor.deactivate()
|
||||
end
|
||||
|
||||
local function report()
|
||||
local value = getValue()
|
||||
local color = colors.black
|
||||
monitor.setBackgroundColor(color)
|
||||
|
||||
setNewLine()
|
||||
monitor.write("Reactor Status: " .. tostring(value))
|
||||
end
|
||||
return { report = report, watch = watch, startup = startup, shutdown = shutdown }
|
||||
@@ -1,49 +0,0 @@
|
||||
local max = 310
|
||||
local min = 300
|
||||
|
||||
|
||||
local function getValue()
|
||||
local kelvin = reactor.getTemperature() or 0
|
||||
local fahrenheit = (kelvin - 273.15) * 9 / 5 + 32
|
||||
return math.floor(fahrenheit * 10000 + 0.5) / 10000
|
||||
end
|
||||
|
||||
local function checkTemperature()
|
||||
local temperature = getValue()
|
||||
local upperThreshold = max - 1
|
||||
local lowerThreshold = min + 1
|
||||
|
||||
if temperature >= upperThreshold then
|
||||
print("Warning: Temperature approaching upper limit! Taking action.")
|
||||
burnRateDriver.stepDown()
|
||||
elseif temperature <= lowerThreshold then
|
||||
print("Warning: Temperature approaching lower limit! Taking action.")
|
||||
burnRateDriver.slowStepUp()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function watch()
|
||||
while true do
|
||||
print("Temperature: " .. getValue())
|
||||
checkTemperature()
|
||||
sleep(0.05) -- Update every tenth second
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function startup()
|
||||
end
|
||||
|
||||
local function shutdown()
|
||||
end
|
||||
|
||||
|
||||
local function report()
|
||||
local value = getValue()
|
||||
local color = colors.black
|
||||
monitor.setBackgroundColor(color)
|
||||
setNewLine()
|
||||
monitor.write("Temperature: " .. value .. "F")
|
||||
end
|
||||
return { report = report, watch = watch, startup = startup, shutdown = shutdown }
|
||||
@@ -1,64 +0,0 @@
|
||||
local max = 99
|
||||
local maxVent = 90
|
||||
local minVent = 95
|
||||
local min = 80
|
||||
|
||||
local function getValue()
|
||||
return turbine.getSteamFilledPercentage() * 100
|
||||
end
|
||||
|
||||
local function color()
|
||||
local value = getValue()
|
||||
return colors.black
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function checkSteamLevel()
|
||||
local value = getValue()
|
||||
if value > max then
|
||||
print("Warning: Steam above maximum! Taking action.")
|
||||
reactor.scram();
|
||||
turbine.setDumpingMode("DUMPING")
|
||||
burnRateDriver.stepDown()
|
||||
elseif value >= maxVent-1 then
|
||||
print("Steam within vent range. Adjusting vents.")
|
||||
turbine.setDumpingMode("DUMPING")
|
||||
burnRateDriver.stepDown()
|
||||
elseif value >= min and value < minVent then
|
||||
print("Steam within normal operation range.")
|
||||
turbine.setDumpingMode("IDLE")
|
||||
--burnRateDriver.stepDown()
|
||||
elseif value < min then
|
||||
print("Warning: Steam below minimum! Taking action.")
|
||||
turbine.setDumpingMode("IDLE")
|
||||
end
|
||||
end
|
||||
|
||||
local function startup()
|
||||
return
|
||||
end
|
||||
|
||||
local function shutdown()
|
||||
end
|
||||
|
||||
local function watch()
|
||||
while true do
|
||||
checkSteamLevel()
|
||||
sleep(0.05) -- Update every tenth second
|
||||
end
|
||||
end
|
||||
|
||||
local function report()
|
||||
local color = color()
|
||||
monitor.setBackgroundColor(color)
|
||||
value = getValue()
|
||||
|
||||
setNewLine()
|
||||
monitor.write("Turbine Steam: " .. value .. "%")
|
||||
|
||||
setNewLine()
|
||||
monitor.write("Turbine Vent: " .. turbine.getDumpingMode())
|
||||
end
|
||||
|
||||
return { report = report, watch = watch, startup = startup, shutdown = shutdown }
|
||||
Reference in New Issue
Block a user