# bed2
$sleep_loc = 'bed2'

!! Lying in bed hub. From here PC can take various actions, including going to sleep.
!!
!! Moved here from bed_events
!! Going to sleep: move to pre_sleep_events

if $ARGS[0] = 'bed2' or $ARGS[0] = 'start' or $ARGS[0] = '':
	$menu_loc = 'bed2'
	$alarmloc = 'bed2'
	$menu_arg = 'start'
	$alarmarg = 'start'
	menu_off = 0

	if clo_flag['bed'] = 1:
		clo_flag['bed'] = 0
		gs 'clothing', 'wear', $lastwornclothingtype['bed'], lastwornclothingnumber['bed']
		gs 'panties', 'wear', $lastwornpantytype['bed'], lastwornpantynumber['bed']
		gs 'bras', 'wear', $lastwornbratype['bed'], lastwornbranumber['bed']
	end
	gs 'stat'

	gt 'bed2', 'mod_sleeptriggers'
end

if $ARGS[0] = 'mod_sleeptriggers':
	!! This location is here to allow mods to hook into the system.
	!! Either check for: if $sleep_loc = 'bed2' and $ARGS[0] = 'mod_sleeptriggers'
	!!
	!! This is NOT for events!!

	gt 'bed2', 'main'
end


if $ARGS[0] = 'main':
	$menu_loc = 'bed2'
	$alarmloc = 'bed2'
	$menu_arg = 'main'
	$alarmarg = 'main'
	menu_off = 0

	if pcs_makeup ! 1 and cosmetic_tattoo = 0: *nl '<b><font color="red">You need to wash off your makeup before going to bed.</font></b>'

	if $clothingworntype ! 'nude':
		'<center><img <<$set_imgh>> src="images/shared/home/bed.jpg"></center>'
	else
		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/son.jpg"></center>'
	end
	*nl
	'Your <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> during the week and <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>> during the weekend. It is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt ''bed2'', ''main''">OFF</a>.', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt ''bed2'', ''main''">ON</a>.')
	*nl
	gs 'bed2', 'wear_panties_decider'
	*nl
	gs 'bed2', 'wear_buttplug_decider'
	gs 'bed2', 'wear_vibe_decider'


	if pcs_sleep <= 80:
		if $clothingworntype = 'nude':
			act 'Go to bed': gs 'shortgs', 'autosave' & gt 'pre_sleep', 'start'
		else
			act 'Undress and go to bed': gs 'shortgs', 'autosave' & gt 'pre_sleep', 'start'
		end
	end

	act 'Get out of bed': gt 'bed_get_out', 'start'
	gs 'sleep_simple', 'nap_bed'
	gs 'events', 'read'

	if $loc ! 'bedrPar' or locat['Anya_inroom'] = 0 or locat['Anya'] = 1 or locat['Anya'] = 26:
		if mc_inventory['mag_porn'] > 0: gs 'events', 'read_porn'
		if (pcs_horny > 75 and pcs_inhib >= 60) or (pcs_horny > 50 and (fame['pav_slut'] >= 150 or (fame['pav_slut'] >= 50 and pcs_inhib >= 60))):
			act 'Masturbate':
				InSleep = 0
				gt 'selfplay', 'start'
			end
		end
	end
end


if $ARGS[0] = 'wear_panties_decider':
	if hypnoPanty <= 0:
		if sleepVars['bedPanty'] = 0:
			'Will you always wear your underwear to bed? Currently - <a href="exec:sleepVars[''bedPanty''] = 1 & gs ''stat'' & gt ''bed2'', ''main''">AS IS</a>.'
		elseif sleepVars['bedPanty'] = 1:
			'Will you always wear your underwear to bed? Currently - <a href="exec:sleepVars[''bedPanty''] = 2 & gs ''stat'' & gt ''bed2'', ''main''">YES</a>.'
		elseif sleepVars['bedPanty'] = 2:
			'Will you always wear your underwear to bed? Currently - <a href="exec:sleepVars[''bedPanty''] = 0 & gs ''stat'' & gt ''bed2'', ''main''">NO</a>.'
		end
	end
end

if $ARGS[0] = 'wear_buttplug_decider':
	if mc_inventory['buttplug'] = 1:
		if sleepVars['bedAnal'] = 0:
			'Should you always remove your anal plug before bed? Currently - <a href="exec:sleepVars[''bedAnal''] = 1 & gs ''stat'' & gt ''bed2'', ''main''">NO</a>.'
		elseif sleepVars['bedAnal'] = 1:
			'Should you always remove your anal plug before bed? Currently - <a href="exec:sleepVars[''bedAnal''] = 0 & gs ''stat'' & gt ''bed2'', ''main''">YES</a>.'
		end
	end
end

if $ARGS[0] = 'wear_vibe_decider':
	if mc_inventory['vibe'] = 1 and sleepVars['cheatVib'] = 1:
		if sleepVars['bedVibrator'] = 0:
			'Should you always remove your vibrator before bed? Currently - <a href="exec:sleepVars[''bedVibrator''] = 1 & gs ''stat'' & gt ''bed2'', ''main''">NO</a>.'
		elseif sleepVars['bedVibrator'] = 1:
			'Should you always remove your vibrator before bed? Currently - <a href="exec:sleepVars[''bedVibrator''] = 0 & gs ''stat'' & gt ''bed2'', ''main''">YES</a>.'
		end
	end
end

if $ARGS[0] = 'fin':
	if strpos('bedr,bedr2x,korr,korr2x',$loc) > 0: gt 'bedr'
	if $loc = 'uni_dorm': gt 'uni_dorm', 'dorm_room'
	if $loc = 'nichBedroomServant': gt 'nichBedroomServant'
end

--- bed2 ---------------------------------
