Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TfW trainfx): wrong script for departing #40

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions src/announcement-data/systems/rolling-stock/TfWTrainFx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ interface IStoppedAtStationAnnouncementOptions {

interface IDepartingStopAnnouncementOptions {
nextStationCode: string
terminatesAtCode: string
terminatesHere: boolean
}

interface IApproachingStopAnnouncementOptions {
nextStationCode: string
terminatesAtCode: string
gapType: 'gap' | 'step' | 'step down' | 'none'
}

Expand Down Expand Up @@ -75,16 +74,14 @@ export default class TfWTrainFx extends TrainAnnouncementSystem {
}

private async playDepartingStopAnnouncement(options: IDepartingStopAnnouncementOptions, download: boolean = false): Promise<void> {
const { nextStationCode, terminatesAtCode } = options
const { nextStationCode, terminatesHere } = options

const files: AudioItem[] = []

if (!this.validateStationExists(nextStationCode, 'high')) {
return
}

files.push(...this.getTerminationInfo(terminatesAtCode, 'low'))

files.push(
{
id: 'conjoiners.the next stop is',
Expand All @@ -93,7 +90,7 @@ export default class TfWTrainFx extends TrainAnnouncementSystem {
`stations.high.${nextStationCode}`,
)

if (nextStationCode === terminatesAtCode) {
if (terminatesHere) {
files.push('conjoiners.our final station')
}

Expand Down Expand Up @@ -544,11 +541,10 @@ export default class TfWTrainFx extends TrainAnnouncementSystem {
options: this.AvailableStationItemMaps.high,
type: 'select',
},
terminatesAtCode: {
name: 'Terminates at',
default: this.AvailableDestinationOptions[0].value,
options: this.AvailableDestinationOptions,
type: 'select',
terminatesHere: {
name: 'Terminates here',
default: false,
type: 'boolean',
},
},
},
Expand Down