diff --git a/station_broadcast.lua b/station_broadcast.lua index 8306c97..f30caf4 100644 --- a/station_broadcast.lua +++ b/station_broadcast.lua @@ -1,6 +1,6 @@ -- 1. Configuration & Constants -local APP_VERSION_TEXT = "v1.0.56" +local APP_VERSION_TEXT = "v1.0.57" local CONFIG = { CLOUD_URL = "ws://stabadmin.fse-media.group", @@ -2725,7 +2725,20 @@ function Main.loop() end end - local isAtStation = State.currentTrain and State.currentTrain.id == trainName and State.currentTrain.dest == destination + local isAtStation = false + if State.currentTrain then + if State.currentTrain.id == trainName then + if trainName == "???" or trainName == "Unknown" or trainName == "" then + local currentDest = Utils.getBaseName(State.currentTrain.dest) + local nbtDest = Utils.getBaseName(destination) + if currentDest == nbtDest or currentDest:find(nbtDest, 1, true) or nbtDest:find(currentDest, 1, true) then + isAtStation = true + end + else + isAtStation = true + end + end + end if not isAtStation and etaSeconds > 0 and etaSeconds <= 45 then if not seenApproachKeys[announceKey] then seenApproachKeys[announceKey] = true @@ -2863,7 +2876,20 @@ function Main.loop() end end - local isAtStation = State.currentTrain and State.currentTrain.id == tName and State.currentTrain.dest == dest + local isAtStation = false + if State.currentTrain then + if State.currentTrain.id == tName then + if tName == "???" or tName == "Unknown" or tName == "" then + local currentDest = Utils.getBaseName(State.currentTrain.dest) + local nbtDest = Utils.getBaseName(dest) + if currentDest == nbtDest or currentDest:find(nbtDest, 1, true) or nbtDest:find(currentDest, 1, true) then + isAtStation = true + end + else + isAtStation = true + end + end + end if not isAtStation and etaSeconds > 0 and etaSeconds <= 45 then if not seenApproachKeys[announceKey] then seenApproachKeys[announceKey] = true