:: sex_test[event]
	<<act 'Test2'>>
		<<set $sex = new setup.Sex({
			npcId: $npcs.ids({gender:0,age:{filter:'minMax',min:18,max:100}}).pluck()
		})>>

		<<gt 'sex_ev_foreplay' 'undress'>>
	<</act>>

:: sex[event]
	<<set $settings.sex ??= {
		condoms: {
			preferOwn: true,
			sabotage: false,
			anal:{
				required: true
			},
			vaginal:{
				required: true
			}
		}
	}>>

	<<set $sex = new setup.Sex({
		npcId: $location_var[$here][0]
	})>>
	

	<h2>Sexual interaction</h2>
	<<image $npc($sex.npcId).image>>

	<p>
		You are about to start a sexual interaction with <<npc $sex.npcId>><</npc>>.
	</p>
	
	<hr/>
	<h2>Sex Options</h2>
	<div class="table" style="--columns-count:2">
		<h3>Condoms</h3>
		<p class="explanation">
			Condoms are only used for sex with characters who have a penis.
		</p>
		<p>General</p>
		<ul>
			<li><<checkbox "$settings.sex.condoms.preferOwn" false true autocheck>> Use your own condoms if you have some with you.</li>
			<li><<checkbox "$settings.sex.condoms.sabotage" false true autocheck>> Sabotage your condoms. They still protect against STDs but not against pregnancies. Only applies if your own condom is used. Your partner might find this out before the act.</li>
		</ul>
		<p>Anal Sex</p>
		<ul>
			<li><<checkbox "$settings.sex.condoms.vaginal.required" false true autocheck>> Require the use of condoms for anal sex.</li>
		</ul>
		<p>Vaginal Sex</p>
		<ul>
			<li><<checkbox "$settings.sex.condoms.vaginal.required" false true autocheck>> Require the use of condoms for vaginal sex.</li>
		</ul>
	</div>
	
	
	/*<<act 'Blowjob'>>
		<<set $sex.scenarioId = 'bj'>>
		<<gt 'sex_exec'>>
	<</act>>*/
	<<act 'Vaginal Sex'>>
		<<set $sex.scenarioId = 'vaginal'>>
		<<gt 'sex_exec'>>
	<</act>>
	<<ret 'Change your mind'>>

:: sex_exec[event]
	<<gs `'sex_'+$sex.scenarioId` $location_var[$here][0]>>

:: sex_bj_scripts[script]
	setup.sexScenarios = {
		bj:{
			mode: 'game',
			reactions: ['test1','test2'],
			situations: ['test1','test2']
		},
		vaginal:{

		}
	}
	
	setup.sexSituations = {
		test1:{
			weight: 100,
			desc: 'Test1',
			correct: 'test1'
		},
		test2:{
			weight: 100,
			desc: 'Test2',
			correct: 'test2'
		}
	}

	setup.sexReactions = {
		test1:{
			label: 'Test1',
			desc: 'test1',
			image:''
		},
		test2:{
			label: 'Test2',
			desc: 'test2',
			image:''
		}
	}

:: sex_bj[include]
	<<if $sex.history.length > 0>>
		<<set _lastSituationId	= $sex.history.last()>>
		<<set _lastSituation	= $sex.situation(_lastSituationId)>>
		<<set _correctReaction = _lastSituation.correct>>

		<<set _currentReactionKey = $location_var[$here][0]>>
		<<set _reaction = $sex.reaction(_reactionKey)>>

		<<if _correctReaction == _currentReactionKey>>
			good
		<<else>>
			bad
		<</if>>
	<</if>>

	<<set _situation = $sex.situationNext()>>
	<<=_situation.desc>>
	<<run $sex.history.push(_situation.id)>>


	<<for _reaction range $sex.reactions()>>
		<<act _reaction.label undefined `{capture:['_reaction']}`>>
			<<gt 'sex_exec' _reaction.id>>
		<</act>>
	<</for>>