From b4dc738f05c3a3a3e7ecd968e0015340a3bc33e0 Mon Sep 17 00:00:00 2001 From: itzmarkoni Date: Sat, 14 Jun 2025 14:59:02 -0400 Subject: [PATCH] updated --- main.lua | 17 ++++++++++++++--- turbine_driver.lua | 18 +++++++++--------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/main.lua b/main.lua index d41deb4..bb81e72 100644 --- a/main.lua +++ b/main.lua @@ -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 diff --git a/turbine_driver.lua b/turbine_driver.lua index cd1e4cc..6aaf8ac 100644 --- a/turbine_driver.lua +++ b/turbine_driver.lua @@ -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 } \ No newline at end of file