diff --git a/station_broadcast.lua b/station_broadcast.lua index 8b725ea..4b665d6 100644 --- a/station_broadcast.lua +++ b/station_broadcast.lua @@ -1,6 +1,6 @@ -- 1. Configuration & Constants -local APP_VERSION_TEXT = "v1.0.57" +local APP_VERSION_TEXT = "v1.0.58" local CONFIG = { CLOUD_URL = "ws://stabadmin.fse-media.group", @@ -273,9 +273,11 @@ function Utils.promptSlaveIdentity() term.setCursorPos(1, 10) term.setTextColor(colors.gray) - term.write("Available beeps: " .. availStr) - term.setTextColor(colors.white) + term.write("Available beeps:") term.setCursorPos(1, 11) + term.write(availStr) + term.setTextColor(colors.white) + term.setCursorPos(1, 13) term.write("Departure beep (e.g. fc1): ") term.setCursorPos(30, 6) @@ -285,15 +287,15 @@ function Utils.promptSlaveIdentity() term.setCursorPos(31, 8) local stationPlatform = Utils.trim(read() or "") - term.setCursorPos(32, 11) + term.setCursorPos(32, 13) local departureBeep = Utils.trim(read() or "") if departureBeep == "" then departureBeep = "fc1" end if stationCode == "" or stationPlatform == "" then - term.setCursorPos(1, 12) + term.setCursorPos(1, 15) term.setTextColor(colors.red) term.write("Both station code and platform are required.") - term.setCursorPos(1, 14) + term.setCursorPos(1, 16) term.setTextColor(colors.lightGray) term.write("Press any key to retry...") os.pullEvent("key") @@ -359,9 +361,11 @@ function Utils.promptConfig() term.setCursorPos(1, 10) term.setTextColor(colors.gray) - term.write("Available beeps: " .. availStr) - term.setTextColor(colors.white) + term.write("Available beeps:") term.setCursorPos(1, 11) + term.write(availStr) + term.setTextColor(colors.white) + term.setCursorPos(1, 13) term.write("Departure beep [" .. currentBeep .. "]: ") term.setCursorPos(30, 6) @@ -373,17 +377,17 @@ function Utils.promptConfig() local platformInput = Utils.trim(read() or "") if platformInput == "" then platformInput = currentPlatform end - term.setCursorPos(32, 11) + term.setCursorPos(32, 13) local beepInput = Utils.trim(read() or "") if beepInput == "" then beepInput = currentBeep end local ok = Utils.saveStationIdentity(codeInput, platformInput, beepInput) if ok then Utils.refreshStationIdentity() - term.setCursorPos(1, 12) + term.setCursorPos(1, 15) term.setTextColor(colors.green) term.write("Configuration saved.") - term.setCursorPos(1, 14) + term.setCursorPos(1, 16) term.setTextColor(colors.lightGray) term.write("Press any key to return...") os.pullEvent("key") @@ -393,10 +397,10 @@ function Utils.promptConfig() State.inConfig = false break else - term.setCursorPos(1, 12) + term.setCursorPos(1, 15) term.setTextColor(colors.red) term.write("Failed to save configuration.") - term.setCursorPos(1, 14) + term.setCursorPos(1, 16) term.setTextColor(colors.lightGray) term.write("Press any key to retry...") os.pullEvent("key") @@ -2764,8 +2768,13 @@ function Main.loop() end local isAtStation = false + local trainPlatform = tostring(platform or State.stationPlatform or "1") + local currentPlatform = tostring(State.stationPlatform or "1") + if State.currentTrain then - if State.currentTrain.id == trainName then + if trainPlatform == currentPlatform then + isAtStation = true + elseif State.currentTrain.id == trainName then if trainName == "???" or trainName == "Unknown" or trainName == "" then if Utils.isFuzzyMatch(State.currentTrain.dest, destination) then isAtStation = true @@ -2913,8 +2922,13 @@ function Main.loop() end local isAtStation = false + local trainPlatform = tostring(platform or State.stationPlatform or "1") + local currentPlatform = tostring(State.stationPlatform or "1") + if State.currentTrain then - if State.currentTrain.id == tName then + if trainPlatform == currentPlatform then + isAtStation = true + elseif State.currentTrain.id == tName then if tName == "???" or tName == "Unknown" or tName == "" then if Utils.isFuzzyMatch(State.currentTrain.dest, dest) then isAtStation = true