This commit is contained in:
2025-06-14 14:59:02 -04:00
parent c7f5b9d860
commit b4dc738f05
2 changed files with 23 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
local kernel = require("kernel")
local reactor = peripheral.find("fissionReactorLogicAdapter")
local turbine = peripheral.find("turbineValve")
local monitor = peripheral.find("monitor")
local tempDriver = kernel.addDriver("temperature_driver")
local coolantDriver = kernel.addDriver("coolant_driver")
@@ -15,7 +16,7 @@ local function runMonitors()
tempDriver.watch(reactor, monitor)
coolantDriver.watch(reactor, monitor)
statusDriver.watch(reactor, monitor)
turbineDriver.watch(reactor, monitor)
turbineDriver.watch(turbine, monitor)
end
end
@@ -32,19 +33,29 @@ local function runDisplay()
monitor.clear()
end
monitor.setCursorPos(1, 1)
local drivers = {
local reactorDrivers = {
{ Label = "Status", driver = statusDriver },
{ Label = "Temperature", driver = tempDriver },
{ Label = "Coolant", driver = coolantDriver },
{ Label = "Turbine", driver = turbineDriver },
}
for i, item in ipairs(drivers) do
for i, item in ipairs(reactorDrivers) do
monitor.setCursorPos(1, i)
item.driver.report(reactor, monitor)
monitor.setCursorPos(1, i + 1)
end
local turbineDrivers = {
{ Label = "Turbine", driver = turbineDriver }
}
for i, item in ipairs(turbineDrivers) do
monitor.setCursorPos(1, i)
item.driver.report(turbine, monitor)
monitor.setCursorPos(1, i + 1)
end
sleep(0.25) -- Update every quarter second
end
end

View File

@@ -1,20 +1,20 @@
local function getValue(reactor)
return reactor.getSteamFilledPercentage() * 100
local function getValue(target)
return target.getSteamFilledPercentage() * 100
end
local function color(reactor)
local value = getValue(reactor)
local function color(target)
local value = getValue(target)
return colors.black
end
local function watch(reactor, monitor)
print("Turbine Steam Filled: " .. getValue(reactor))
local function watch(target, monitor)
print("Turbine Steam Filled: " .. getValue(target))
end
local function report(reactor, monitor)
local color = color(reactor)
local function report(target, monitor)
local color = color(target)
monitor.setBackgroundColor(color)
monitor.clearLine()
monitor.write("Turbine Steam Filled: " .. getValue(reactor) .. "%")
monitor.write("Turbine Steam Filled: " .. getValue(target) .. "%")
end
return { report = report, watch = watch }