This commit is contained in:
2025-06-14 17:02:44 -04:00
parent 3297944cda
commit 904309aa0f
6 changed files with 99 additions and 28 deletions

View File

@@ -5,21 +5,22 @@ turbine = peripheral.find("turbineValve")
turbineVent = peripheral.find("turbineVent")
monitor = peripheral.find("monitor")
local tempDriver = kernel.addDriver("temperature_driver")
local coolantDriver = kernel.addDriver("coolant_driver")
local statusDriver = kernel.addDriver("status_driver")
local turbineDriver = kernel.addDriver("turbine_driver")
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")
isWarningState = false
isCriticalState = false
isShutdownState = false
local function runMonitors()
while true do
tempDriver.watch(reactor, monitor)
coolantDriver.watch(reactor, monitor)
statusDriver.watch(reactor, monitor)
turbineDriver.watch(turbine, monitor)
parallel.waitForAll(
tempDriver.watch,
coolantDriver.watch,
statusDriver.watch,
turbineDriver.watch,
burnRateDriver.watch
)
end
end
@@ -27,20 +28,13 @@ local function runDisplay()
monitor.clear()
monitor.setTextScale(1)
while true do
if(isWarningState or isCriticalState or isShutdownState) then
monitor.setBackgroundColor(colors.red)
monitor.clear()
monitor.setCursorPos(1, 1)
monitor.write("Reactor in critical state!")
sleep(2)
monitor.clear()
end
monitor.setCursorPos(1, 1)
local drivers = {
{ Label = "Status", driver = statusDriver},
{ Label = "Temperature", driver = tempDriver },
{ Label = "Coolant", driver = coolantDriver },
{ Label = "Turbine", driver = turbineDriver }
{ Label = "Burn Rate", driver = burnRateDriver }
}
for i, item in ipairs(drivers) do