fix: prevent race end modal from breaking endless route progression

- Add mode detection in checkStationArrivals() to differentiate steam journey vs regular race
- Skip endRace() call when in endless steam journey mode (detected by .route-path element)
- Let handleRouteCompletion() properly handle 100% position in endless mode
- Preserve normal race ending behavior for regular race modes
- Fixes issue where gold/silver/bronze modal would appear instead of route progression

Now steam train journey properly transitions between routes endlessly while maintaining
normal race completion behavior for other game modes.

🚂 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock
2025-09-12 22:19:43 -05:00
parent a2b3e97eba
commit e06be9d121

View File

@@ -13812,9 +13812,19 @@ def generate_web_flashcards(numbers, config, output_path):
timeSinceLastCoal > (config.starvationThreshold * 2); // Much longer grace period
if (journeyComplete) {{
const score = this.totalScore;
const deliveredCount = this.correctAnswers; // Questions answered correctly
this.endRace(`🎉 Journey Complete! Reached Capital Station! Score: ${{score}} points from ${{deliveredCount}} deliveries!`);
// Check if we're in endless steam journey mode or regular race mode
const isEndlessSteamJourney = document.querySelector('.route-path'); // Steam journey has route-path
if (isEndlessSteamJourney) {{
// Don't end race - let the endless route progression handle this
console.log('🚂 Journey complete detected but endless mode active - route progression will handle');
return;
}} else {{
// Regular race mode - end normally
const score = this.totalScore;
const deliveredCount = this.correctAnswers;
this.endRace(`🎉 Journey Complete! Reached Capital Station! Score: ${{score}} points from ${{deliveredCount}} deliveries!`);
}}
}} else if (trainStuck) {{
// Train is truly stuck - but this should be very rare now with adaptive difficulty
const progress = Math.round(this.trainPosition);