Skip to content

Commit e4b7b25

Browse files
authored
Merge pull request #301 from Gxorge/main
feat: terminations and SOL, TYS, WMR
2 parents 5e1fcae + 79dc682 commit e4b7b25

File tree

6 files changed

+34
-6
lines changed

6 files changed

+34
-6
lines changed
17.5 KB
Binary file not shown.

audio/WMT/172/stations/SOL.mp3

10.6 KB
Binary file not shown.

audio/WMT/172/stations/TYS.mp3

9.75 KB
Binary file not shown.

audio/WMT/172/stations/WMR.mp3

10.6 KB
Binary file not shown.

audio/WMT/172/this is.mp3

8.58 KB
Binary file not shown.

src/announcement-data/systems/rolling-stock/WMTClass172.ts

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@ import TrainAnnouncementSystem from '../../TrainAnnouncementSystem'
77

88
interface IApproachingStationAnnouncementOptions {
99
stationCode: string
10+
terminatesHere: boolean
1011
ticketsReady: boolean
1112
mindTheGap: boolean
1213
}
1314

1415
interface IWelcomeAnnouncementOptions {
1516
terminatesAtCode: string
17+
terminatesHere: boolean
1618
readAllStations: boolean
1719
callingAtCodes: { crsCode: string; name: string; randomId: string }[]
1820
}
1921

2022
const announcementPresets: Readonly<Record<string, ICustomAnnouncementPreset[]>> = {
2123
welcome: [
2224
{
23-
name: 'Birmingham Snow Hill to Worcester Forgate Street',
25+
name: 'Dorridge to Worcester Forgate Street',
2426
state: {
2527
terminatesAtCode: 'WOF',
2628
readAllStations: true,
27-
callingAtCodes: ['JEQ', 'THW', 'SGB', 'ROW', 'CRA', 'SBJ', 'HAG', 'BKD', 'KID', 'HBY', 'DTW'].map(crsToStationItemMapper),
29+
callingAtCodes: ['WMR', 'SOL', 'OLT', 'ACG', 'TYS', 'SMA', 'BMO', 'BSW', 'JEQ', 'THW', 'SGB', 'ROW', 'CRA', 'SBJ', 'HAG', 'BKD', 'KID', 'HBY', 'DTW'].map(crsToStationItemMapper),
2830
},
2931
},
3032
],
@@ -43,6 +45,10 @@ export default class WMTClass172 extends TrainAnnouncementSystem {
4345
files.push('we are now approaching')
4446
files.push({ id: `stations.${options.stationCode}`, opts: { delayStart: 200 } })
4547

48+
if (options.terminatesHere) {
49+
files.push({ id: 'our final destination', opts: { delayStart: 200 } })
50+
}
51+
4652
if (options.ticketsReady) {
4753
files.push({ id: 'please have your tickets ready', opts: { delayStart: 300 } })
4854
}
@@ -63,6 +69,16 @@ export default class WMTClass172 extends TrainAnnouncementSystem {
6369

6470
const files: AudioItem[] = []
6571
files.push('bing bong')
72+
73+
if (options.terminatesHere) {
74+
files.push('this is')
75+
files.push({ id: `stations.${terminatesAtCode}`, opts: { delayStart: 200 } })
76+
files.push({ id: 'our final destination', opts: { delayStart: 200 } })
77+
files.push({ id: 'please mind the gap when leaving the train and step', opts: { delayStart: 500 } })
78+
await this.playAudioFiles(files, download)
79+
return
80+
}
81+
6682
files.push('welcome to this service for')
6783
files.push({ id: `stations.${terminatesAtCode}`, opts: { delayStart: 200 } })
6884

@@ -73,10 +89,7 @@ export default class WMTClass172 extends TrainAnnouncementSystem {
7389

7490
if (callingAtCodes.some(code => !this.validateStationExists(code))) return
7591

76-
if (remainingStops.length === 0) {
77-
// We are at the termination point.
78-
// files.push('this train terminates here all change please ensure')
79-
} else if (remainingStops.length === 1 || !readAllStations) {
92+
if (remainingStops.length === 1 || !readAllStations) {
8093
// Next station is the termination point or we are not reading all stations.
8194
files.push({ id: `the next station is`, opts: { delayStart: 200 } })
8295
files.push(remainingStops[0])
@@ -108,7 +121,10 @@ export default class WMTClass172 extends TrainAnnouncementSystem {
108121
'SBJ',
109122
'SGB',
110123
'SMA',
124+
'SOL',
111125
'THW',
126+
'TYS',
127+
'WMR',
112128
'WOF',
113129
'WOS',
114130
]
@@ -124,6 +140,7 @@ export default class WMTClass172 extends TrainAnnouncementSystem {
124140
component: CustomAnnouncementPane,
125141
defaultState: {
126142
stationCode: this.RealAvailableStationNames[0],
143+
terminatesHere: false,
127144
ticketsReady: true,
128145
mindTheGap: true,
129146
},
@@ -146,6 +163,11 @@ export default class WMTClass172 extends TrainAnnouncementSystem {
146163
type: 'boolean',
147164
default: true,
148165
},
166+
terminatesHere: {
167+
name: 'Train terminates here?',
168+
type: 'boolean',
169+
default: false,
170+
},
149171
},
150172
},
151173
} as CustomAnnouncementTab<keyof IApproachingStationAnnouncementOptions>,
@@ -154,6 +176,7 @@ export default class WMTClass172 extends TrainAnnouncementSystem {
154176
component: CustomAnnouncementPane,
155177
defaultState: {
156178
terminatesAtCode: this.RealAvailableStationNames[0],
179+
terminatesHere: false,
157180
readAllStations: true,
158181
callingAtCodes: [],
159182
},
@@ -172,6 +195,11 @@ export default class WMTClass172 extends TrainAnnouncementSystem {
172195
type: 'boolean',
173196
default: true,
174197
},
198+
terminatesHere: {
199+
name: 'Train terminates here?',
200+
type: 'boolean',
201+
default: false,
202+
},
175203
callingAtCodes: {
176204
name: '',
177205
type: 'custom',

0 commit comments

Comments
 (0)