:: PassageFooter
/*<<if Story.has($here+'_after')>>
	<<include `$here+'_after'`>>
<</if>>*/
<<for _afterPassage range Story.lookup("tags", $here+'_after')>>
	<<run console.log('Included after-passage:',_afterPassage.title)>>
	<<include _afterPassage.title>>
<</for>>

<<if $pc and $pc.gameover>>
	<<done>>
		<<cla>>
			<<include 'gameover'>>
		<</cla>>
	<</done>>
<<elseif $subpassage>>
	<<gt 'subpassage'>>
<<elseif $isEventPassage>>
	<<set _menuDeactivated = true>>
<<else>>
	<<if _tags.includes('indoors') or _tags.includes('outdoors')>>
		<<run $location.update(_thisMainPassage,$location_var[_thisMainPassage])>>
		<<set $menuReturnPassage = _thisMainPassage>>
		<<set _menuDeactivated = false>>
		<<if !_tags.includes('dynamicHousing') && $dynamicHousingRoom>>
			<<unset $dynamicHousingRoom>>
		<</if>>

		<<set _dynamicConnections = $housing.connectionsByFromPassage(_thisMainPassage)>>
		<<for _dynamicConnection range _dynamicConnections>>
			<<set _dynamicConnectionFlags = setup.mergeDeep({capture:['_dynamicConnection']},_dynamicConnection.flags??{})>>
			<<ConnectedLocation _dynamicConnection.label _dynamicConnection.toPassage _dynamicConnection.passageArg _dynamicConnection.image _dynamicConnection.time _dynamicConnectionFlags>>
		<</for>>

		<<set _workActions = $jobs.workActionsByLocation(_thisMainPassage)>>
		<<for _workAction range _workActions>>
			<<set _jobData = $jobs.jobData(_workAction)>>
			<<act `"Work ("+_jobData.title+")"` undefined `{capture:['_jobData']}`>>
				<<gt _jobData.workPassage>>
			<</act>>
		<</for>>

		<<if _tags.includes('outdoors') and _tags.includes('public')>>
			<<actCLA 'Wait'>>
				<<gs 'wait'>>
			<</actCLA>>
		<</if>>
		

	<<elseif _tags.includes('quest')>>
		<!-- This should be able to be returned to -->
		<<set _menuDeactivated = false>>
		<<set $menuReturnPassage = _thisMainPassage>>
	<<elseif _tags.includes('events') or _tags.includes('event') or _tags.includes('activity')>>
		<!-- This can't be returned to -->
		<<set _menuDeactivated = true>>
	<<elseif _tags.includes('menu')>>
		<<set _menuDeactivated = true>>
	<<else>>
		<<warn `"No valid tag settings in passage "+_thisMainPassage`>>
	<</if>>

	<<if _tags.includes('bathroom')>>
		<<include 'bathroom'>>
	<</if>>
	<<if _tags.includes('bedroom')>>
		<<include 'bedroom'>>
	<</if>>
	<<if _tags.includes('kitchen')>>
		<<include 'kitchen_generic'>>
	<</if>>
	<<if _tags.includes('car')>>
		<<gs 'VehiclePassages'>>
	<</if>>
	<<if _tags.includes('beach')>>
		<<gs 'beach'>>
	<</if>>
	<<if _tags.includes('tv_medium')>>
		<<act 'Watch TV'>><<gt 'TV' 'medium'>><</act>>
	<</if>>
	<<if _tags.includes('configurable')>>
		<<include 'configurable'>>
	<</if>>

	<<include 'generic_all'>>

	<<if $npc>>
		<<phoneReceivePendingCall>>
	<</if>>
<</if>>

<<debug>>
	Here: $location.passage ($location.region)
	<div id="callStack"></div>
	<<done>>
		<<tryReplace '#callStack'>>
			<h2>Callstack</h2>
			<table>
				<<for _i, _call range $callStack>>
					<tr>
						<td>_i:</td><td><<='&nbsp;'.repeat(_call[1]*10)>><<=_call[0].replace('_','&#95;')>></td>
					</tr>
				<</for>>
			</table>
		<</tryReplace>>
	<</done>>
<</debug>>
