/% Entry splash and pre-game setup passage: initializes settings state and renders the settings macro UI. %/
<h2>Welcome to Ashline v0.1.0.</h2>
<div class="small-description">
- Save files are stored in your browser cache. Use the Export/Import tab in Saves to avoid losing them.
<br>
- Please report bugs directly to likea.
<br><br></div>
<<set $settingsExitPassage to "StoryInit">>
<<initsettings>>
<div id="settingsStart">
<<settingsStart>>
</div>/% Core game-state bootstrap passage: initializes player stats, starter train, and station state before entering gameplay. %/
<<if $settingsMode is "Story">>
You are a lone train engineer in a world where dangerous zombies called Foamers endlessly expand the railroad. Your goal is to travel from Punta Arenas, Chile, to Cape Town, South Africa, while surviving on your train.
<<else>>
You are a lone train engineer in a world where dangerous zombies called Foamers endlessly expand the railroad. Your goal is to simply survive, looting the landscape and traveling until you either become a mindless foamer or die an engineer.
<</if>>
<<set $player to {
fatigue: 0,
physicalDamage: 0,
immunity: 100,
mentalHealth: 100,
hunger: 0,
thirst: 0
}>>
<<set $trains to [ [$defaultTrains.steamLoco, $defaultTrains.boxcar] ]>>
<<set $currentStation to 1>>
<<set $stationTracks to {}>>
[[Begin Your Journey|Railyard]]/% Sidebar menu extension passage: keeps utility links (currently Credits dialog) out of gameplay passages. %/
<<link "Credits">><<run setup.showCreditsDialog()>><</link>>/% Station hub passage: resolves returning train placement, generates station tracks when needed, and renders yard interaction UI. %/
<<buildIntegrityNotice>>
<<if typeof $stationTracks[$currentStation] === 'undefined'>>
<<set $stationTracks[$currentStation] = setup.railyard.generateStationTracks($currentStation, $randomSeed)>>
<</if>>
<<if $leavingTrain>>
<<set $leavingTrain.visited = true>>
<<if $currentStation === $enteredStation && typeof $enteredTrackIndex !== 'undefined' && typeof $enteredTrainIndex !== 'undefined'>>
<<run setup.railyard.placeTrainInStationTracks($stationTracks[$currentStation], $leavingTrain, $enteredTrackIndex, $enteredTrainIndex)>>
<<else>>
<<run setup.railyard.placeTrainInStationTracks($stationTracks[$currentStation], $leavingTrain)>>
<</if>>
<<set $leavingTrain = null>>
<</if>>
<<if $debugMode>><<run (function () { if (typeof console !== 'undefined' && typeof console.log === 'function') { console.log('[Ashline Debug] Station ' + State.variables.currentStation + ' railyard tracks:', State.variables.stationTracks[State.variables.currentStation]); } })()>><</if>>
You step into the railyard. Several trains are parked here, each with its own mix of cars and cargo.
<<railyardButtons>>
<<debugTools>>/% On-board navigation passage: tracks current car position, movement through consist, and transition into driving mode. %/
<<buildIntegrityNotice>>
<<if typeof $currentCarIndex === 'undefined'>>
<<set $currentCarIndex = setup.railyard.getBoardingCarIndex($currentTrain)>>
<</if>>
<<if $currentCarIndex < 0 || $currentCarIndex >= $currentTrain.length>>
<<set $currentCarIndex = setup.railyard.getBoardingCarIndex($currentTrain)>>
<</if>>
<<set $currentCar to $currentTrain[$currentCarIndex]>>
You are <<print setup.railyard.getCarLocationText($currentCar)>> of your consist.
<br>
Car <<print $currentCarIndex + 1>> of <<print $currentTrain.length>>.
<<if $currentCarIndex > 0>><<link "Move Toward Front">><<set $currentCarIndex -= 1>><<goto "TrainInterior">><</link>><</if>>
<<if $currentCarIndex > 0 && $currentCarIndex < $currentTrain.length - 1>> | <</if>>
<<if $currentCarIndex < $currentTrain.length - 1>><<link "Move Toward Rear">><<set $currentCarIndex += 1>><<goto "TrainInterior">><</link>><</if>>
<<if $currentCar.tractiveCapacity > 0>>
This is the locomotive. From here, you can start your journey.
<<else>>
This car does not have the controls needed to drive the train.
<</if>>
<<link "Leave Train">><<set $currentTrain.visited = true>><<set $enteredStation = $currentStation>><<if typeof $drivingTrackIndex !== 'undefined'>><<set $enteredTrackIndex = $drivingTrackIndex>><</if>><<set $leavingTrain = $currentTrain>><<set $trains.splice($trains.indexOf($currentTrain), 1)>><<goto "Railyard">><</link>>
<<if $currentCar.tractiveCapacity > 0>><<link "Start Driving">><<goto "DrivingMode">><</link>><</if>>
<<debugTools>>/% Active driving/shunting passage: composes merge, travel, and decoupling controls for the current consist and station context. %/
<<buildIntegrityNotice>>
<<initDrivingModeState>>
You are driving your consist. Current station: <<print $currentStation>>.
<<drivingMergeButtons>>
<<drivingTravelButtons>>
<<drivingShuntingControls>>
<<link "Stop Driving">><<goto "TrainInterior">><</link>>
<<debugTools>>