From d28b0eec30d514db2034fc6df621c956bab85351 Mon Sep 17 00:00:00 2001 From: HenryDu8133 <813367384@qq.com> Date: Sun, 2 Aug 2026 16:10:52 +0800 Subject: [PATCH] fix: correctly assign State.upcomingTrains before display link fallback --- station_broadcast.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/station_broadcast.lua b/station_broadcast.lua index cb3c517..fcfec76 100644 --- a/station_broadcast.lua +++ b/station_broadcast.lua @@ -2103,7 +2103,7 @@ function Display.render() -- Upcoming Trains if State.upcomingTrains and #State.upcomingTrains > 0 then - local startY = State.currentTrain and 11 or 7 + local startY = State.currentTrain and 10 or 7 mon.setCursorPos(1, startY) mon.setTextColor(COLORS.DEBUG) mon.write("UPCOMING TRAINS:") @@ -2327,8 +2327,11 @@ function Main.loop() end end end - -- Fallback to Display Link text parsing if Block Reader is not available - elseif Peripherals.createTarget then + -- Update Upcoming Trains globally for the monitor + State.upcomingTrains = newUpcoming + + -- Try CC:C Bridge Display Link (Legacy Text Parsing) if Block Reader is not available + if not Peripherals.blockReader and Peripherals.createTarget then local lines = Peripherals.createTarget.dump() for k, v in pairs(State.announcedApproaching) do @@ -2409,7 +2412,6 @@ function Main.loop() if not Peripherals.station then State.currentTrain = nil - State.upcomingTrains = newUpcoming Display.render() Display.renderTerminal() os.sleep(0.5) @@ -2472,7 +2474,6 @@ function Main.loop() end end - State.upcomingTrains = newUpcoming Display.render() Display.renderTerminal() os.sleep(0.5)