diff --git a/station_broadcast.lua b/station_broadcast.lua index 4938070..8f0155a 100644 --- a/station_broadcast.lua +++ b/station_broadcast.lua @@ -1,6 +1,6 @@ -- 1. Configuration & Constants -local APP_VERSION_TEXT = "v1.0.53" +local APP_VERSION_TEXT = "v1.0.54" local CONFIG = { CLOUD_URL = "ws://stabadmin.fse-media.group", @@ -2559,6 +2559,37 @@ local function mapTrainStatusReason(statusId) return known[tail] or tail end +local function isStationDestination(destName) + if not destName then return false end + local blacklist = { + "速度", "speed", + "名称", "rename", "重命名", + "时刻表", "schedule", + "区段", "section", + "卸", "unload", + "装", "load", + "等待", "wait", + "条件", "condition", + "动力", "powered", + "物品", "item", + "流体", "fluid", + "玩家", "player", + "时间", "time", + "抛弃", "discard", + "限制", "limit", + "货物", "cargo", + "无载", "unloaded", + "空载", "empty" + } + local lowerDest = string.lower(destName) + for _, word in ipairs(blacklist) do + if string.find(lowerDest, word, 1, true) then + return false + end + end + return true +end + function Main.loop() while true do local now = os.epoch("utc") @@ -2643,7 +2674,14 @@ function Main.loop() if type(stop.Stopovers) == "table" and #stop.Stopovers > 0 then destination = stop.Stopovers[#stop.Stopovers] or destination end - local platform = stop.StationInfo and stop.StationInfo.Platform or State.stationPlatform or "1" + + if isStationDestination(destination) then + local platform = "1" + if st.ScheduledStation and st.ScheduledStation.StationInfo and st.ScheduledStation.StationInfo.Platform then + platform = st.ScheduledStation.StationInfo.Platform + else + platform = State.stationPlatform or "1" + end local cancelled = false local reason = nil local tr = stop.Train @@ -2747,6 +2785,7 @@ function Main.loop() end end end + end end end @@ -2768,37 +2807,6 @@ function Main.loop() local seenAlertKeys = {} local seenApproachKeys = {} - local function isStationDestination(destName) - if not destName then return false end - local blacklist = { - "速度", "speed", - "名称", "rename", "重命名", - "时刻表", "schedule", - "区段", "section", - "卸", "unload", - "装", "load", - "等待", "wait", - "条件", "condition", - "动力", "powered", - "物品", "item", - "流体", "fluid", - "玩家", "player", - "时间", "time", - "抛弃", "discard", - "限制", "limit", - "货物", "cargo", - "无载", "unloaded", - "空载", "empty" - } - local lowerDest = string.lower(destName) - for _, word in ipairs(blacklist) do - if string.find(lowerDest, word, 1, true) then - return false - end - end - return true - end - cleanupTimestampMap(State.announcedApproaching, now, tonumber(CONFIG.APPROACHING_COOLDOWN_MS) or 120000) cleanupTimestampMap(State.announcedAlerts, now, tonumber(CONFIG.ALERT_COOLDOWN_MS) or 300000)