From c39daa5508abd31685b467930a9f9f6afd94d463 Mon Sep 17 00:00:00 2001 From: itzmarkoni Date: Sat, 14 Jun 2025 12:52:53 -0400 Subject: [PATCH] updated --- coolant_driver.lua | 14 ++++++++++---- main.lua | 6 +++++- temperature_driver.lua | 9 ++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/coolant_driver.lua b/coolant_driver.lua index 257c6ef..150499c 100644 --- a/coolant_driver.lua +++ b/coolant_driver.lua @@ -1,10 +1,16 @@ -local function report() - local reactor = peripheral.find("fissionReactorLogicAdapter") +local function report(reactor) if reactor then - return reactor.getTemperature() + return reactor.getCoolantFilledPercentage() else return "No reactor found" end end -return { report = report } \ No newline at end of file +local function watch(reactor, monitor) + while true do + print("Coolant: " .. report(reactor)) + sleep(1) + end +end + +return { report = report, watch = watch } \ No newline at end of file diff --git a/main.lua b/main.lua index ef91272..d17738e 100644 --- a/main.lua +++ b/main.lua @@ -1,15 +1,19 @@ local function run() local kernel = require("kernel") local tempDriver = kernel.addDriver("temperature_driver") + local coolantDriver = kernel.addDriver("coolant_driver") local reactor = peripheral.find("fissionReactorLogicAdapter") local monitor = peripheral.find("monitor") while true do monitor.clear() monitor.setCursorPos(1,1) + tempDriver.watch(reactor, monitor) + coolantDriver.watch(reactor, monitor) + local data = { { Label = "Temperature", value = tempDriver.report(reactor)}, - { Label = "Pressure", value = "101kPa" }, + { Label = "Coolant", value = coolantDriver.report(reactor) }, { Label = "Humidity", value = "45%" } } diff --git a/temperature_driver.lua b/temperature_driver.lua index a6959be..75e2df5 100644 --- a/temperature_driver.lua +++ b/temperature_driver.lua @@ -6,4 +6,11 @@ local function report(reactor) end end -return { report = report } \ No newline at end of file +local function watch(reactor, monitor) + while true do + print("Temperature: " .. report(reactor)) + sleep(1) + end +end + +return { report = report, watch = watch } \ No newline at end of file