From 3c25040a84bd4f19b06a304a03f237997f098fe6 Mon Sep 17 00:00:00 2001 From: HenryDu8133 <813367384@qq.com> Date: Mon, 3 Aug 2026 12:27:37 +0800 Subject: [PATCH] =?UTF-8?q?chore(client):=20=E4=BC=98=E5=8C=96=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=BE=93=E5=87=BA=E5=B9=B6=E6=B8=85=E7=90=86=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 引入全局 `CONFIG.DEBUG` 配置项(默认为 `false`),将所有 `Utils.log(DEBUG, ...)` 的大量扫描和推算日志默认隐藏,避免刷屏 CC 终端,需要时可通过配置文件开启。 2. 移除了排查 NBT 结构时添加的 `stop_dump.json` 导出逻辑,保持主机系统文件整洁。 --- station_broadcast.lua | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/station_broadcast.lua b/station_broadcast.lua index 932544f..5290576 100644 --- a/station_broadcast.lua +++ b/station_broadcast.lua @@ -18,7 +18,7 @@ local CONFIG = { ALERT_COOLDOWN_MS = 300000, APPROACHING_COOLDOWN_MS = 120000, APPROACHING_STABLE_MS = 5000, - DEBUG = true + DEBUG = false } local dfpwm = require "cc.audio.dfpwm" @@ -154,6 +154,7 @@ end local Utils = {} function Utils.log(level, message) + if level == "DEBUG" and not CONFIG.DEBUG then return end local timestamp = os.date("%H:%M:%S") local entryText = string.format("[%s][%s] %s", timestamp, level, message) local entry = { level = level, text = entryText } @@ -2640,16 +2641,6 @@ function Main.loop() cleanupTimestampMap(State.announcedAlerts, now, tonumber(CONFIG.ALERT_COOLDOWN_MS) or 300000) for i, stop in ipairs(data.TrainStops) do - -- [DEBUG] Dump first stop to file for inspection - if i == 1 and not State.dumpedStop then - State.dumpedStop = true - local f = fs.open("stop_dump.json", "w") - if f then - f.write(textutils.serializeJSON(stop)) - f.close() - Utils.log("DEBUG", "Dumped stop structure to stop_dump.json") - end - end local st = stop.Station if st then local trainName = st.TrainName or "Unknown"