feat: implement train arrival/departure sequence logic and add departure beep config in client

This commit is contained in:
2026-08-01 11:28:52 +08:00
parent 810dff3f0e
commit 86b6ba180e
109 changed files with 95 additions and 14 deletions
+6 -5
View File
@@ -1764,10 +1764,11 @@ function handleTrainArrival(ws, data) {
const trainId = data.trainId;
const stationName = getCorrectStationName(data.stationName);
const stationCode = data.stationCode;
const platform = data.platform || '1';
const lineCode = data.lineCode || 'UNK';
const destCode = data.destCode || 'UNK';
const nextCode = data.nextCode || 'UNK';
const platform = data.stationPlatform || data.platform || '1';
const lineCode = data.lineCode || (stationCode ? stationCode.split('-')[0] : 'UNK');
const destCode = data.destCode || getStationCodeFromName(data.destination) || 'UNK';
const nextCode = data.nextCode || getStationCodeFromName(data.nextStation) || 'UNK';
const existingIndex = activeTrains.findIndex(t => t.trainId === trainId);
const trainData = {
@@ -1824,7 +1825,7 @@ function handleTrainDeparture(ws, data) {
const trainId = data.trainId;
const stationName = getCorrectStationName(data.stationName);
const stationCode = data.stationCode;
const beep = data.beep || 'fc1';
const beep = data.departureBeep || data.beep || 'fc1';
const existingIndex = activeTrains.findIndex(t => t.trainId === trainId);
if (existingIndex >= 0) {