'##############
'Cockpit-Script
'##############

'Simuliert alle unmittelbar mit dem Armaturenbrett zusammenhängenden Funktionen

'(c) 23.10.2009 Rüdiger Hülsmann
'(c) 01.11.2012 Marcel Kuhnt
'(c) 27.02.2011 Markus Rabe

'Script Version: 1.0
'Omsi release: 1.0

'Needs:
'- antrieb
'- engine
'- bremse
'- lights
'- wiper?
'- doors


'Revision History:
'- Rüdiger Hülsmann	09.06.2009	Last Change				
'- Marcel Kuhnt		13.06.2009	Added Gearbox switches			
'- Marcel Kuhnt		13.06.2009	Moved some switchvars to other scripts	
'- Rüdiger Hülsmann	19.06.2009	Added Openable Window Triggers
'- Rüdiger Hülsmann	23.10.2009	Added Battery and kinderwagen light
'- Marcel Kuhnt		26.10.2009	Radio switchable with Motorkühlung (replaced with cassette player)
'- Rüdiger Hülsmann	28.10.2009	Added driver door
'- Rüdiger Hülsmann	16.12.2009	Added driver curtain
'- Rüdiger Hülsmann	18.12.2009	Bugfix driver curtain
'- Marcel Kuhnt		15.04.2010	Traegheit debugged
'- Rüdiger Hülsmann	13.05.2010	Engine temperature
'- Rüdiger Hülsmann	03.06.2010	Automatic battery switch on key insertion (For standard-II-buses)
'- Rüdiger Hülsmann	08.06.2010	Automatic battery switch made optional, Auxiliary heating switchable by button or switch
'- Rüdiger Hülsmann	23.06.2010	Added mouse-clickable wiper lever on wheel console
'- Rüdiger Hülsmann	08.07.2010	Wiper lever: Improved usability 
'- Rüdiger Hülsmann	18.07.2010	Wiper lever: soundfix for keyboard operation and new ignition key algorithm 
'- Rüdiger Hülsmann	16.09.2010	Auxheat Switch Bugfix
'- Rüdiger Hülsmann	18.09.2010	Imported microphone switch
'- Rüdiger Hülsmann	17.10.2010	Added pressure warning needle
'- Rüdiger Hülsmann	23.10.2010	Added old-style gear button functionality
'- Rüdiger Hülsmann	06.11.2010	Gear-button "1" functionality removed for old-style gear buttons
'- Rüdiger Hülsmann	16.11.2010	Heating sliders
'- Rüdiger Hülsmann	23.11.2010	Central lubrication, cabin heater sound
'- Rüdiger Hülsmann	23.12.2010	Included 10 "multi-purpose" dummy switches
'- Rüdiger Hülsmann	29.12.2010	ASR switch
'- Rüdiger Hülsmann	04.01.2011	"D-only" gear selector function
'- Rüdiger Hülsmann	05.01.2011	fog lamp switch, high beam lever animation, clock debugged
'- Rüdiger Hülsmann	07.01.2011	Wiper lever sound and function debugges, availybility of several cockpit functions depending on bus type (via constfile)
'- Rüdiger Hülsmann	16.01.2011	Support for wiper turn-switch
'- Rüdiger Hülsmann	18.01.2011	Old-style gear button sounds
'- Rüdiger Hülsmann	26.01.2011	Invertable driver door
'- Rüdiger Hülsmann	26.01.2011	Thermometer
'- Markus Rabe		27.02.2011	lüfter und Wagenheizung Motorabhängig, Leuchtmelder Hintertür an 80er D Wagen angepasst
'- Marcel Kuhnt		25.06.2011	Nebelscheinwerfer-Schalter (cp_licht_nebelschw_sw)
'- Marcel Kuhnt		29.06.2011	Türkontrolle für D92 und D86 integriert
'- Marcel Kuhnt		22.06.2012	Uhr läuft nur, wenn Strom vorhanden
'- Marcel Kuhnt		09.07.2012	Busbar wird als Faktor/Spannung interpretiert
'- Marcel Kuhnt		25.07.2012	Stromverbrauch, Generierung von Leitwert
'- Marcel Kuhnt		01.11.2012	Türentriegelungs-Leuchtmelder
'- Vitaly L.		11.07.2015	Öåķņšąėüķūé ļåšåźėž÷ąņåėü ńāåņą, ģåėźčå ļšąāźč.
'- Vitaly L.		13.09.2015	Ķåāåšī˙ņķą˙ ļīåįåķü.

'------------------------------------------------------------------------------------------
'----------------------
'	Trigger
'----------------------

{trigger:horn}
	
	(L.L.cockpit_hupe) ! (L.L.elec_busbar_main) &&
	{if}
		(T.L.ev_hupe_an)
	{endif}
	1 (S.L.cockpit_hupe)
	
{end}

{trigger:horn_off}	
	
	(L.L.cockpit_hupe) (L.L.elec_busbar_main) &&
	{if}
		(T.L.ev_hupe_aus)
	{endif}
	0 (S.L.cockpit_hupe)	
	
{end}

{trigger:cp_rollo_drag}

	(L.L.cp_rollo_pos) (S.L.cp_rollo_lastpos)

	1 (S.L.cp_rollo_dragged)
	0 (S.L.cp_rollo_speed)
	(L.S.mouse_y) 500 / (L.L.cp_rollo_pos) + (S.L.cp_rollo_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_rollo_pos)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_rollo_pos)
	{endif}

	(L.L.cp_rollo_pos) 0.139 >=
	{if}
		(L.L.part1) 0 =
		{if}
			1 (S.L.part1)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.31 >=
	{if}
		(L.L.part2) 0 =
		{if}
			1 (S.L.part2)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.49 >=
	{if}
		(L.L.part3) 0 =
		{if}
			1 (S.L.part3)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.69 >=
	{if}
		(L.L.part4) 0 =
		{if}
			1 (S.L.part4)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.84 >=
	{if}
		(L.L.part5) 0 =
		{if}
			1 (S.L.part5)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) (L.L.cp_rollo_lastpos) - abs (L.S.Timegap) / (S.L.cp_rollo_speed)

{end}

{trigger:cp_rollo2_drag}

	(L.L.cp_rollo2_pos) (S.L.cp_rollo2_lastpos)

	0 (S.L.cp_rollo2_dragged)
	0 (S.L.cp_rollo2_speed)
	(L.S.mouse_y) 800 / (L.L.cp_rollo2_pos) + (S.L.cp_rollo2_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_rollo2_pos)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_rollo2_pos)
	{endif}
	(L.L.cp_rollo2_pos) 0.138 >=
	{if}
		(L.L.nrl_t_6_visibility) 0 =
		{if}
			1 (S.L.nrl_t_6_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.32 >=
	{if}
		(L.L.nrl_t_7_visibility) 0 =
		{if}
			1 (S.L.nrl_t_7_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.5 >=
	{if}
		(L.L.nrl_t_8_visibility) 0 =
		{if}
			1 (S.L.nrl_t_8_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.68 >=
	{if}
		(L.L.nrl_t_9_visibility) 0 =
		{if}
			1 (S.L.nrl_t_9_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.86 >=
	{if}
		(L.L.nrl_t_10_visibility) 0 =
		{if}
			1 (S.L.nrl_t_10_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) (L.L.cp_rollo2_lastpos) - abs (L.S.Timegap) / (S.L.cp_rollo2_speed)

{end}

{trigger:cp_rollo_off}
	0 (S.L.cp_rollo_dragged)
	(T.L.ev_rollo_end)
{end}

{trigger:cp_rollo2_off}
	0 (S.L.cp_rollo2_dragged)
	(T.L.ev_rollo_end)
{end}

{trigger:cp_rollo_retract}
	(L.L.cp_rollo_bommel) 0 = (L.L.cp_rollo_pos) &&
	{if}
		(T.L.ev_rollo_retract)
	{endif}
	1 (S.L.cp_rollo_bommel) (S.L.cp_rollo_retract)

{end}

{trigger:cp_rollo2_retract}
	(L.L.cp_rollo2_bommel) 0 = (L.L.cp_rollo2_pos) &&
	{if}
		(T.L.ev_rollo_retract)
	{endif}
	1 (S.L.cp_rollo2_bommel) (S.L.cp_rollo2_retract)
{end}

{trigger:cp_rollo2_retract_off}
	0 (S.L.cp_rollo2_bommel) (S.L.cp_rollo2_retract) (S.L.cp_rollo2_speed)
{end}

{trigger:cp_retarder_direkt_toggle}
	(L.L.cp_retarder_sw_direkt) ! (S.L.cp_retarder_sw_direkt) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_avar_mov_drag}
	(L.L.elec_busbar_main)
	(L.L.engine_injection_on) &&
	(L.L.cp_avar_rot) 0.5 > &&
{if}
0 (S.L.engine_injection_on) (S.L.engine_on)
{endif}
        (L.S.mouse_x) -200 / (L.L.cp_avar_rot) + 0 max 1 min (S.L.cp_avar_rot) s0
{endif}
{end}

{trigger:cp_retarder_toggle}
	(C.L.cockpit_has_retarderswitch)
	{if}
		(L.L.cp_retarder_sw) ! (S.L.cp_retarder_sw) s1
		(M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_motorkuehlung_toggle}
	(C.L.cockpit_has_coolingswitch)
	{if}
		(L.L.cp_motorkuehlung_sw) ! (S.L.cp_motorkuehlung_sw) s1
		(M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_fahrerlicht_toggle}
	(L.L.cp_fahrerlicht_sw) ! (S.L.cp_fahrerlicht_sw) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_licht_oberdeck_toggle}
	(L.L.cp_licht_oberdeck_sw) 
	{if}
		0 (S.L.cp_licht_oberdeck_sw) s1
	{else}
		1 (S.L.cp_licht_oberdeck_sw) s1
	{endif}		
	(M.L.kippschaltersound)
{end}

{trigger:cp_licht_unterdeck_toggle}
	(L.L.cp_licht_unterdeck_sw) 
	{if}
		0 (S.L.cp_licht_unterdeck_sw) s1
	{else}
		1 (S.L.cp_licht_unterdeck_sw) s1
	{endif}		
	(M.L.kippschaltersound)
{end}

{trigger:cp_licht_nebelschw_sw}
	(L.L.cp_licht_nebelschw_sw) 
	{if}
		0 (S.L.cp_licht_nebelschw_sw) s1
	{else}
		1 (S.L.cp_licht_nebelschw_sw) s1
	{endif}		
	(M.L.kippschaltersound)
{end}

{trigger:cp_wischer_schnell_toggle}
	(L.L.cp_wischer_schnell_sw) ! (S.L.cp_wischer_schnell_sw) s1
	(M.L.kippschaltersound)
{end}

{trigger:kw_wipermode_up}
	(L.L.cp_wischer_einaus_sw) ! (S.L.cp_wischer_einaus_sw) s1
	{if}
		2 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
		2 3 / (S.L.cockpit_wischerhebel) (S.L.cockpit_wischer_drehschalter)
		(L.L.cp_wischer_intervall_sw) !
		{if}
			(T.L.ev_wischerhebel)
		{endif}
	{else}
		(L.L.cp_wischer_intervall_sw)
		{if}
			1 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
			1 3 / (S.L.cockpit_wischerhebel) 
			0 (S.L.cockpit_wischer_drehschalter)
		{else}
			0 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode) (S.L.cockpit_wischerhebel) 
			1 3 / (S.L.cockpit_wischer_drehschalter)
			(T.L.ev_wischerhebel)
		{endif}
	{endif}
	(C.L.wiper_lever) !
	{if}
		l1 (M.L.kippschaltersound)
	{endif}
{end}

{trigger:kw_wipermode_up1}
	(L.L.cp_wischer_einaus_sw_R) ! (S.L.cp_wischer_einaus_sw_R) s1
	{if}
		2 (S.L.cockpit_wischerhebel_mode_R) (S.L.cockpit_wischer_drehschalter_mode_R)
		2 3 / (S.L.cockpit_wischerhebel_R) (S.L.cockpit_wischer_drehschalter_R)
		(L.L.cp_wischer_intervall_sw_R) !
		{if}
			(T.L.ev_wischerhebel_R)
		{endif}
	{else}
		(L.L.cp_wischer_intervall_sw_R)
		{if}
			1 (S.L.cockpit_wischerhebel_mode_R) (S.L.cockpit_wischer_drehschalter_mode_R)
			1 3 / (S.L.cockpit_wischerhebel_R) 
			0 (S.L.cockpit_wischer_drehschalter_R)
		{else}
			0 (S.L.cockpit_wischerhebel_mode_R) (S.L.cockpit_wischer_drehschalter_mode_R) (S.L.cockpit_wischerhebel_R) 
			1 3 / (S.L.cockpit_wischer_drehschalter_R)
			(T.L.ev_wischerhebel_R)
		{endif}
	{endif}
	(C.L.wiper_lever) !
	{if}
		l1 (M.L.kippschaltersound)
	{endif}
{end}


{trigger:cp_wischer_intervall_toggle}
	(L.L.cp_wischer_intervall_sw) ! (S.L.cp_wischer_intervall_sw) s1
	(L.L.cp_wischer_einaus_sw) ! &&
	{if}
		1 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
		1 3 / (S.L.cockpit_wischerhebel) 
		0 (S.L.cockpit_wischer_drehschalter)
	{else}
		(L.L.cp_wischer_einaus_sw)
		{if}
			2 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
			2 3 / (S.L.cockpit_wischerhebel) (S.L.cockpit_wischer_drehschalter)
		{else}
			0 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode) (S.L.cockpit_wischerhebel)
			1 3 / (S.L.cockpit_wischer_drehschalter)
		{endif}

	{endif}
	(C.L.wiper_lever) !
	{if}
		l1 (M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_wischer_wascher_button}
	
	(C.L.wiper_lever) 1 (S.L.cp_wischer_wascher_sw) s1
	(C.L.wiper_lever) 1 (S.L.cp_wischer_wascher_sw_R) s1
	{if}
		
	{else}
		l1 (M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_wischer_wascher_button_off}
	
	(C.L.wiper_lever) 0 (S.L.cp_wischer_wascher_sw) s1
	(C.L.wiper_lever) 0 (S.L.cp_wischer_wascher_sw_R) s1
	(S.L.wiper_wascher_sw)
	{if}
	{else}
		l1 (M.L.kippschaltersound)
	{endif}
{end}


{trigger:cp_heizluefter_toggle}
	(L.L.cp_heizluefter_sw) s0
	-0.5 <
	{if}
		1 (S.L.cp_heizluefter_sw) 
	{else}
		l0 0.5 >
		{if}
			0 (S.L.cp_heizluefter_sw) 
		{else}
			-1 (S.L.cp_heizluefter_sw) 
		{endif}
	{endif}
	
	(M.L.kippschaltersound)
{end}

{trigger:cp_spiegelheizung_toggle}
	(L.L.cp_spiegelheizung_sw) ! (S.L.cp_spiegelheizung_sw) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_kn_obduv_lob_L}
	(L.L.cp_kn_obduv_lob_L) ! (S.L.cp_kn_obduv_lob_L) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_kn_obduv_lob_P}
	(L.L.cp_kn_obduv_lob_P) ! (S.L.cp_kn_obduv_lob_P) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_lampa_eng}
	(L.L.cp_lampa_eng) ! (S.L.cp_lampa_eng) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_tumanki}
	(L.L.cp_tumanki) ! (S.L.cp_tumanki) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw01_toggle}
	(L.L.cp_dummy_sw01) ! (S.L.cp_dummy_sw01) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw02_toggle}
	(L.L.cp_dummy_sw02) ! (S.L.cp_dummy_sw02) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw03_toggle}
	(L.L.cp_dummy_sw03) ! (S.L.cp_dummy_sw03) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw04_toggle}
	(L.L.cp_dummy_sw04) ! (S.L.cp_dummy_sw04) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw05_toggle}
	(L.L.cp_dummy_sw05) ! (S.L.cp_dummy_sw05) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw06_toggle}
	(L.L.cp_dummy_sw06) ! (S.L.cp_dummy_sw06) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw07_toggle}
	(L.L.cp_dummy_sw07) ! (S.L.cp_dummy_sw07) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw08_toggle}
	(L.L.cp_dummy_sw08) ! (S.L.cp_dummy_sw08) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw09_toggle}
	(L.L.cp_dummy_sw09) ! (S.L.cp_dummy_sw09) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw10_toggle}
	(L.L.cp_dummy_sw10) ! (S.L.cp_dummy_sw10) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_schalter_ASR_off_toggle}
	(L.L.cp_ASR_off) ! (S.L.cp_ASR_off) s1
	(M.L.kippschaltersound)
{end}



{trigger:cp_klimator_toggle}
	(L.L.cp_klimator_sw) s0
	-0.5 <
	{if}
		1 (S.L.cp_klimator_sw) 
	{else}
		l0 0.5 >
		{if}
			0 (S.L.cp_klimator_sw) 
		{else}
			-1 (S.L.cp_klimator_sw) 
		{endif}
	{endif}
	1
	(M.L.kippschaltersound)
{end}

{trigger:cp_fahrerfenster_opn_drag}

	(L.L.cp_fahrerfenster_pos) (S.L.cp_fahrerfenster_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_fahrerfenster_pos) + (S.L.cp_fahrerfenster_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fahrerfenster_pos)
		(L.L.cp_fahrerfenster_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fahrerfenster_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fahrerfenster_pos)
		(L.L.cp_fahrerfenster_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fahrerfenster_endanschlag)
	{endif}

	(L.L.cp_fahrerfenster_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fahrerfenster_endanschlag)
	{endif}

	(L.L.cp_fahrerfenster_pos) (L.L.cp_fahrerfenster_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_fahrerfenster_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_fort_L1_opn_drag}

	(L.L.cp_fort_L1_pos) (S.L.cp_fort_L1_lastpos)

	(L.S.mouse_x) 500 / (L.L.cp_fort_L1_pos) + (S.L.cp_fort_L1_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_L1_pos)
		(L.L.cp_fort_L1_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_L1_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_L1_pos)
		(L.L.cp_fort_L1_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_L1_endanschlag)
	{endif}

	(L.L.cp_fort_L1_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_L1_endanschlag)
	{endif}


	(L.L.cp_fort_L1_pos) (L.L.cp_fort_L1_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fort_L1_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_fort_L2_opn_drag}

	(L.L.cp_fort_L2_pos) (S.L.cp_fort_L2_lastpos)

	(L.S.mouse_x) 500 / (L.L.cp_fort_L2_pos) + (S.L.cp_fort_L2_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_L2_pos)
		(L.L.cp_fort_L2_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_L2_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_L2_pos)
		(L.L.cp_fort_L2_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_L2_endanschlag)
	{endif}

	(L.L.cp_fort_L2_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_L2_endanschlag)
	{endif}


	(L.L.cp_fort_L2_pos) (L.L.cp_fort_L2_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fort_L2_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_fort_L3_opn_drag}

	(L.L.cp_fort_L3_pos) (S.L.cp_fort_L3_lastpos)

	(L.S.mouse_x) 500 / (L.L.cp_fort_L3_pos) + (S.L.cp_fort_L3_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_L3_pos)
		(L.L.cp_fort_L3_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_L3_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_L3_pos)
		(L.L.cp_fort_L3_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_L3_endanschlag)
	{endif}

	(L.L.cp_fort_L3_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_L3_endanschlag)
	{endif}


	(L.L.cp_fort_L3_pos) (L.L.cp_fort_L3_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_fort_L3_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_fort_R1_opn_drag}

	(L.L.cp_fort_R1_pos) (S.L.cp_fort_R1_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_fort_R1_pos) + (S.L.cp_fort_R1_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_R1_pos)
		(L.L.cp_fort_R1_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_R1_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_R1_pos)
		(L.L.cp_fort_R1_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_R1_endanschlag)
	{endif}

	(L.L.cp_fort_R1_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_R1_endanschlag)
	{endif}


	(L.L.cp_fort_R1_pos) (L.L.cp_fort_R1_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fort_R1_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_fort_R2_opn_drag}

	(L.L.cp_fort_R2_pos) (S.L.cp_fort_R2_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_fort_R2_pos) + (S.L.cp_fort_R2_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_R2_pos)
		(L.L.cp_fort_R2_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_R2_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_R2_pos)
		(L.L.cp_fort_R2_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_R2_endanschlag)
	{endif}

	(L.L.cp_fort_R2_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_R2_endanschlag)
	{endif}


	(L.L.cp_fort_R2_pos) (L.L.cp_fort_R2_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_fort_R2_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_fort_pereg_opn_drag}

	(L.L.cp_fort_pereg_pos) (S.L.cp_fort_pereg_lastpos)

	(L.S.mouse_x) 500 / (L.L.cp_fort_pereg_pos) + (S.L.cp_fort_pereg_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_pereg_pos)
		(L.L.cp_fort_pereg_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_pereg_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_pereg_pos)
		(L.L.cp_fort_pereg_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_pereg_endanschlag)
	{endif}

	(L.L.cp_fort_pereg_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_pereg_endanschlag)
	{endif}


	(L.L.cp_fort_pereg_pos) (L.L.cp_fort_pereg_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_fort_pereg_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_cps_mov_drag}

	(L.S.mouse_x) abs (L.S.mouse_y) abs >
	{if}
        (L.S.mouse_x) -60 / (L.L.cp_cps_rot) + 0 max 1 min (S.L.cp_cps_rot) s0
{endif}
	(L.S.mouse_y) -20 / (L.L.cp_cps_trans) + 0 max 1 min (S.L.cp_cps_trans) s1
		l1 0.2 <
		{if}
			0 (S.L.cp_cps_trans_mode) 
		{else} 
			l1 0.8 <
			{if}
				1 (S.L.cp_cps_trans_mode) 
			{else}
				2 (S.L.cp_cps_trans_mode)
			{endif}
		{endif}
	{endif}
{end}

{trigger:cp_cps_mov_off}
	(L.L.cp_cps_trans_mode) 2 / (S.L.cp_cps_trans)

{end}

{trigger:cp_lenkrad_toggle}
	(L.L.cp_lenkrad_visible) ! (S.L.cp_lenkrad_visible)
{end}

{trigger:cp_tabla_toggle}
	(L.L.cp_tabla_visible) ! (S.L.cp_tabla_visible)
{end}

{trigger:cp_tabla1_toggle}
	(L.L.cp_tabla1_visible) ! (S.L.cp_tabla1_visible)
{end}

{trigger:cp_kr_phedohranitel_vint_drag}
	(L.S.mouse_x) -250 / (L.L.cp_kr_phedohranitel_vint_pos) + 0 max 1 min (S.L.cp_kr_phedohranitel_vint_pos)
{end}

{trigger:cp_kr_phedohranitel}
  (L.L.cp_kr_phedohranitel_vint_pos) 0.4 >
{if}
  (L.L.cp_kr_phedohranitel_visible) ! (S.L.cp_kr_phedohranitel_visible) s1
  (M.L.klappfenstersound)
{end}

{trigger:cp_massa}
	(L.L.elec_busbar_main_sw) ! (S.L.elec_busbar_main_sw)
		1 (S.L.cp_massa)
	(M.L.kippschaltersound)			
{end}
			
{trigger:cp_massa_off}	
	0 (S.L.cp_massa)		
{end}

{trigger:cp_klappfenster_OR1}
	(L.L.cp_klappfenster_OR1) ! (S.L.cp_klappfenster_OR1) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OR2}
	(L.L.cp_klappfenster_OR2) ! (S.L.cp_klappfenster_OR2) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OR3}
	(L.L.cp_klappfenster_OR3) ! (S.L.cp_klappfenster_OR3) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OR4}
	(L.L.cp_klappfenster_OR4) ! (S.L.cp_klappfenster_OR4) s1
	(M.L.klappfenstersound)
{end}


{trigger:cp_klappfenster_OL1}
	(L.L.cp_klappfenster_OL1) ! (S.L.cp_klappfenster_OL1) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OL2}
	(L.L.cp_klappfenster_OL2) ! (S.L.cp_klappfenster_OL2) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OL3}
	(L.L.cp_klappfenster_OL3) ! (S.L.cp_klappfenster_OL3) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OL4}
	(L.L.cp_klappfenster_OL4) ! (S.L.cp_klappfenster_OL4) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UR1}
	(L.L.cp_klappfenster_UR1) ! (S.L.cp_klappfenster_UR1) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UR2}
	(L.L.cp_klappfenster_UR2) ! (S.L.cp_klappfenster_UR2) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UR3}
	(L.L.cp_klappfenster_UR3) ! (S.L.cp_klappfenster_UR3) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UR4}
	(L.L.cp_klappfenster_UR4) ! (S.L.cp_klappfenster_UR4) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UL1}
	(L.L.cp_klappfenster_UL1) ! (S.L.cp_klappfenster_UL1) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UL2}
	(L.L.cp_klappfenster_UL2) ! (S.L.cp_klappfenster_UL2) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_luk_1_ruchka_1_drag}
        (L.S.mouse_x) 100 / (L.L.cp_luk_1_ruchka_1_pos) + 0 max 1 min (S.L.cp_luk_1_ruchka_1_pos) s0
{end}

{trigger:cp_luk_1_ruchka_2_drag}
        (L.S.mouse_x) 100 / (L.L.cp_luk_1_ruchka_2_pos) + 0 max 1 min (S.L.cp_luk_1_ruchka_2_pos) s0
{end}

{trigger:cp_luk_1}
	(L.L.cp_luk_1_ruchka_1_pos) (L.L.cp_luk_1_ruchka_2_pos) 0.8 >
	{if}
	(L.L.cp_luk_1_full) ! (S.L.cp_luk_1_full) s1
	{endif}
	(L.L.cp_luk_1) ! (S.L.cp_luk_1) s1
(M.L.klappfenstersound)
{end}

{trigger:cp_luk_2_ruchka_1_drag}
        (L.S.mouse_x) 100 / (L.L.cp_luk_2_ruchka_1_pos) + 0 max 1 min (S.L.cp_luk_2_ruchka_1_pos) s0
{end}

{trigger:cp_luk_2_ruchka_2_drag}
        (L.S.mouse_x) 100 / (L.L.cp_luk_2_ruchka_2_pos) + 0 max 1 min (S.L.cp_luk_2_ruchka_2_pos) s0
{end}

{trigger:cp_luk_2}
	(L.L.cp_luk_2_ruchka_1_pos) (L.L.cp_luk_2_ruchka_2_pos) 0.8 >
	{if}
	(L.L.cp_luk_2_full) ! (S.L.cp_luk_2_full) s1
	{endif}
	(L.L.cp_luk_2) ! (S.L.cp_luk_2) s1
(M.L.klappfenstersound)
{end}

{trigger:cp_zapaska}
	(L.L.Velocity) 0.01 <
	{if}
	(L.L.cp_zapaska) ! (S.L.cp_zapaska) s1
	{endif}
{end}


{trigger:cp_fan}
	(L.L.cp_fan) ! (S.L.cp_fan) s0
	(M.L.kippschaltersound)
{end}

{trigger:cp_fan_spd}
	(L.L.cp_fan_spd) ! (S.L.cp_fan_spd) s0
	(M.L.kippschaltersound)
{end}

{trigger:cp_extra1}
	(L.L.cp_extra1) ! (S.L.cp_extra1) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra2}
	(L.L.cp_extra2) ! (S.L.cp_extra2) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra3}
	(L.L.cp_extra3) ! (S.L.cp_extra3) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra4}
	(L.L.cp_extra4) ! (S.L.cp_extra4) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra5}
	(L.L.cp_extra5) ! (S.L.cp_extra5) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra6}
	(L.L.cp_extra6) ! (S.L.cp_extra6) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra7}
	(L.L.cp_extra7) ! (S.L.cp_extra7) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra8}
	(L.L.cp_extra8) ! (S.L.cp_extra8) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra9}
	(L.L.cp_extra9) ! (S.L.cp_extra9) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra10}
	(L.L.cp_extra10) ! (S.L.cp_extra10) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra11}
	(L.L.cp_extra11) ! (S.L.cp_extra11) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra12}
	(L.L.cp_extra12) ! (S.L.cp_extra12) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra13}
	(L.L.cp_extra13) ! (S.L.cp_extra13) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra14}
	(L.L.cp_extra14) ! (S.L.cp_extra14) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra15}
	(L.L.cp_extra17) 0.1 <
	{if}
	(L.L.cp_extra15) ! (S.L.cp_extra15) s1
(M.L.extra_sound)
	{endif}
{end}

{trigger:cp_extra16}
	(L.L.cp_extra16) ! (S.L.cp_extra16) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra17}
	(L.L.cp_extra17) ! (S.L.cp_extra17) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra18}
	(L.L.cp_extra18) ! (S.L.cp_extra18) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra19}
	(L.L.cp_extra19) ! (S.L.cp_extra19) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra20}
	(L.L.cp_extra20) ! (S.L.cp_extra20) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra21}
	(L.L.cp_extra21) ! (S.L.cp_extra21) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra22}
	(L.L.cp_extra22) ! (S.L.cp_extra22) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra23}
	(L.L.cp_extra23) ! (S.L.cp_extra23) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra24}
	(L.L.cp_extra24) ! (S.L.cp_extra24) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra25}
	(L.L.cp_extra25) ! (S.L.cp_extra25) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra26}
	(L.L.cp_extra26) ! (S.L.cp_extra26) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra27}
	(L.L.cp_extra27) ! (S.L.cp_extra27) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra28}
	(L.L.cp_extra28) ! (S.L.cp_extra28) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra29}
	(L.L.cp_extra29) ! (S.L.cp_extra29) s1
(M.L.extra_sound)
{end}

{trigger:cp_extra30}
	(L.L.cp_extra30) ! (S.L.cp_extra30) s1
(M.L.extra_sound)
{end}

{trigger:cp_Fahrertuer_drag}

	1 (S.L.cp_fahrertuer_dragged)
	(L.L.cp_fahrertuer_pos) (S.L.cp_fahrertuer_lastpos)

	(L.S.mouse_x) 500 / (L.L.cp_fahrertuer_pos) + (S.L.cp_fahrertuer_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fahrertuer_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fahrertuer_pos)
	{endif}

	(L.L.cp_fahrertuer_pos) (L.L.cp_fahrertuer_lastpos) - (L.S.Timegap) / (S.L.cp_fahrertuer_speed)
{end}

{trigger:cp_Fahrertuer_off}
	0 (S.L.cp_fahrertuer_dragged)
{end}


{trigger:cp_luk_gaz_drag}

	1 (S.L.cp_luk_gaz_dragged)
	(L.L.cp_luk_gaz_pos) (S.L.cp_luk_gaz_lastpos)

	(L.S.mouse_x) 500 / (L.L.cp_luk_gaz_pos) + (S.L.cp_luk_gaz_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_luk_gaz_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_luk_gaz_pos)
	{endif}

	(L.L.cp_luk_gaz_pos) (L.L.cp_luk_gaz_lastpos) - (L.S.Timegap) / (S.L.cp_luk_gaz_speed)
{end}

{trigger:cp_luk_gaz_off}
	0 (S.L.cp_luk_gaz_dragged)
{end}

{trigger:cp_kr_radiator_drag}
       (L.L.cp_kr_radiator_fix) 1 =
	{if}
		(L.L.cp_kr_radiator_pos) 0.22 <
		{if}
			0.21 (S.L.cp_kr_radiator_pos) 
		{endif}
	{endif}

	1 (S.L.cp_kr_radiator_dragged)
	(L.L.cp_kr_radiator_pos) (S.L.cp_kr_radiator_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_kr_radiator_pos) + (S.L.cp_kr_radiator_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_kr_radiator_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_kr_radiator_pos)
	{endif}

	(L.L.cp_kr_radiator_pos) (L.L.cp_kr_radiator_lastpos) - (L.S.Timegap) / (S.L.cp_kr_radiator_speed)
{end}

{trigger:cp_kr_radiator_off}
	0 (S.L.cp_kr_radiator_dragged)
{end}

{trigger:cp_kr_radiator_fix}
	(L.L.cp_kr_radiator_pos) 0.2 >
	{if}
		(L.L.cp_kr_radiator_fix) ! (S.L.cp_kr_radiator_fix)
{end}

{trigger:cp_kr_radiator_vent_drag}
        (L.S.mouse_x) 200 / (L.L.cp_kr_radiator_vent_pos) + 0 max 1 min (S.L.cp_kr_radiator_vent_pos) s0

{end}

{trigger:cp_otop_luk_drag}
        (L.S.mouse_y) 200 / (L.L.cp_otop_luk_pos) + 0 max 1 min (S.L.cp_otop_luk_pos) s0

{end}

{trigger:KR_play}
	(L.L.cockpit_KR_play) 0.1 < 
	{if}
		(T.L.ev_kr_play)
	{endif}
	1 (S.L.cockpit_KR_play) (S.L.Snd_Radio)
{end}


{trigger:KR_play_off}
	0.8 (S.L.cockpit_KR_play)
{end}

{trigger:KR_stop}
	1 (S.L.cockpit_KR_stop)
	0 (S.L.cockpit_KR_play) (S.L.Snd_Radio)
	(T.L.ev_kr_stop)
{end}


{trigger:KR_stop_off}
	0 (S.L.cockpit_KR_stop)
{end}


{trigger:taster_standheizung}

	(L.L.cp_taster_standheizung_target) ! (S.L.cp_taster_standheizung_target) s1

	1 (S.L.cp_taster_standheizung)

	(C.L.auxheat_via_button) !
	{if}
		l1 (M.L.kippschaltersound)
		l0 (S.L.cp_taster_standheizung)
	{endif}
		
{end}

{trigger:taster_standheizung_off}
	
	(L.L.cp_taster_standheizung_target)
	{if}
		0 (S.L.cp_taster_standheizung)
	{else}
		0.6 (S.L.cp_taster_standheizung)
	{endif}

{end}


{trigger:taster_nebelschluss}

	(L.L.cp_taster_nebelschluss_target) ! (S.L.cp_taster_nebelschluss_target) s1
	(M.L.kippschaltersound)	
	1 (S.L.cp_taster_nebelschluss)		
{end}

{trigger:taster_nebelschluss_off}
	
	(L.L.cp_taster_nebelschluss_target)
	{if}
		0.6 (S.L.cp_taster_nebelschluss)
	{else}
		0 (S.L.cp_taster_nebelschluss)
	{endif}

{end}


{trigger:cp_wiperlever_drag}

'	Fallunterscheidung: Hebel in x- oder y-Richtung?

	(C.L.wiper_lever)
	{if}
	
		(L.S.mouse_y) abs (L.S.mouse_x) abs >=
		{if}
			(L.S.mouse_y) -50 / (L.L.cockpit_wischerhebel) + 0 max 1 min (S.L.cockpit_wischerhebel) s0
		
'			Stufen:
'			0: Aus
'			1: Intervall
'			2: Langsam
'			3: Schnell

			l0 0.17 <
			{if}
				0 (S.L.cockpit_wischerhebel_mode) (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
			{else} 
				l0 0.5 <
				{if}
					1 (S.L.cockpit_wischerhebel_mode) (S.L.cp_wischer_intervall_sw)
					0 (S.L.cp_wischer_schnell_sw) (S.L.cp_wischer_einaus_sw)
				{else}
					l0 0.83 <
					{if}
						2 (S.L.cockpit_wischerhebel_mode)
						1 (S.L.cp_wischer_einaus_sw)
						0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_schnell_sw)
					{else}
						3 (S.L.cockpit_wischerhebel_mode)
						1 (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
						0 (S.L.cp_wischer_intervall_sw)
					{endif}
				{endif}
			{endif}
		{else}
			(L.S.mouse_x) -50 / (L.L.cockpit_wischerhebel_x) + 0 max 1 min (S.L.cockpit_wischerhebel_x) s1

'			Waschanlage (Hebel nach oben)	
			l1 0.9 >
			{if}
				(L.L.cp_wischer_wascher_sw) !
				{if}
					(T.L.ev_wischerhebel)
				{endif}
				1 (S.L.cp_wischer_wascher_sw)
			{else}
				(L.L.cp_wischer_wascher_sw)
				{if}
					(T.L.ev_wischerhebel)
				{endif}
				0 (S.L.cp_wischer_wascher_sw)
			{endif}

		{endif}
	{endif}

{end}

'			Waschanlage (Hebel nach oben)	
			l1 0.9 >
			{if}
				(L.L.cp_wischer_wascher_sw_R) !
				{if}
					(T.L.ev_wischerhebel)
				{endif}
				1 (S.L.cp_wischer_wascher_sw)
			{else}
				(L.L.cp_wischer_wascher_sw)
				{if}
					(T.L.ev_wischerhebel)
				{endif}
				0 (S.L.cp_wischer_wascher_sw_R)
			{endif}

		{endif}
	{endif}

{end}

{trigger:cp_wiperlever_off}

'	Einrasten auf den festen Positionen:
	(L.L.cockpit_wischerhebel_mode) 3 / (S.L.cockpit_wischerhebel)
	(L.L.cp_wischer_wascher_sw)
	{if}
		(T.L.ev_wischerhebel)
		0 (S.L.cockpit_wischerhebel_x) (S.L.cp_wischer_wascher_sw)
	{endif}
{end}

'	Einrasten auf den festen Positionen:
	(L.L.cockpit_wischerhebel_mode) 3 / (S.L.cockpit_wischerhebel)
	(L.L.cp_wischer_wascher_sw)
	{if}
		(T.L.ev_wischerhebel)
		0 (S.L.cockpit_wischerhebel_x) (S.L.cp_wischer_wascher_sw_R)
	{endif}
{end}


{trigger:cp_wiper_turnswitch_R_drag}

'	(C.L.wiper_turnswitch)
'	{if}
	
		(L.S.mouse_y) -50 / (L.L.cockpit_wischer_drehschalter_R) + 0 max 1 min (S.L.cockpit_wischer_drehschalter_R) s0
	
'		Stufen:
'		0: Intervall
'		1: Aus
'		2: Langsam
'		3: Schnell

		l0 0.17 <
		{if}
			1 (S.L.cp_wischer_intervall_sw_R)
			0 (S.L.cockpit_wischer_drehschalter_mode_R) (S.L.cp_wischer_schnell_sw_R) (S.L.cp_wischer_einaus_sw_R)		
		{else} 
			l0 0.5 <
			{if}
				0 (S.L.cp_wischer_intervall_sw_R) (S.L.cp_wischer_einaus_sw_R) (S.L.cp_wischer_schnell_sw_R)
				1 (S.L.cockpit_wischer_drehschalter_mode_R)
			{else}
				l0 0.83 <
				{if}
					2 (S.L.cockpit_wischer_drehschalter_mode_R)
					1 (S.L.cp_wischer_einaus_sw_R)
					0 (S.L.cp_wischer_intervall_sw_R) (S.L.cp_wischer_schnell_sw_R)
				{else}
					3 (S.L.cockpit_wischer_drehschalter_mode_R)
					1 (S.L.cp_wischer_einaus_sw_R) (S.L.cp_wischer_schnell_sw_R)
					0 (S.L.cp_wischer_intervall_sw_R)
				{endif}
			{endif}
		{endif}
'	{endif}

{end}

{trigger:cp_wiper_turnswitch_R_off}

'	Einrasten auf den festen Positionen:
	(L.L.cockpit_wischer_drehschalter_mode_R) 3 / (S.L.cockpit_wischer_drehschalter_R)
{end}

	
{trigger:cp_microphone}
	1 (S.L.cp_microphone_sw)
{end}

{trigger:cp_microphone_off}
	0 (S.L.cp_microphone_sw)
{end}



{trigger:cp_heizregler_defrost_drag}
	(L.S.mouse_x) -70 / (L.L.cockpit_heizregler_defrost) + 0 max 1 min (S.L.cockpit_heizregler_defrost)
{end}

{trigger:cp_heizregler_fussraum_drag}
	(L.S.mouse_y) -150 / (L.L.cockpit_heizregler_fussraum) + 0 max 1 min (S.L.cockpit_heizregler_fussraum)
{end}

{trigger:cp_heizregler_temp_drag}
	(L.S.mouse_y) -150 / (L.L.cockpit_heizregler_temp) + 0 max 1 min (S.L.cockpit_heizregler_temp)
{end}

{trigger:cp_heizregler_bug_drag}
	(L.S.mouse_y) -150 / (L.L.cockpit_heizregler_bug) + 0 max 1 min (S.L.cockpit_heizregler_bug)
{end}

{trigger:cp_heizregler_umluft_drag}
	(L.S.mouse_y) -150 / (L.L.cockpit_heizregler_umluft) + 0 max 1 min (S.L.cockpit_heizregler_umluft) s0

'	Stufen:
'	0: Umluftheizung
'	1: Direktbelüftung
'	2: Frischluftheizung

	l0 0.2 <
	{if}
		0 (S.L.cockpit_heizregler_ventilation_mode)
	{else}
		l0 0.8 <
		{if}
			1 (S.L.cockpit_heizregler_ventilation_mode)
		{else}
			2 (S.L.cockpit_heizregler_ventilation_mode)
		{endif}
	{endif}

{end}

{trigger:cp_heizregler_umluft_off}
	(L.L.cockpit_heizregler_ventilation_mode) 2 / (S.L.cockpit_heizregler_umluft)

{end}


{trigger:Motortuer_drag}

	1 (S.L.motortuer_dragged)
	(L.L.motortuer_pos) (S.L.motortuer_lastpos)

	(L.S.mouse_x) -200 / (L.L.motortuer_pos) + (S.L.motortuer_pos) s0
	l0 0 <
	{if}
		0 (S.L.motortuer_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.motortuer_pos)
	{endif}
	
	(L.L.bottle_visible) 1 =
	{if}
		(L.L.motortuer_pos) 0.08 <
		{if}
			0.08 (S.L.motortuer_pos)
		{endif}
	{endif}

	(L.L.motortuer_pos) (L.L.motortuer_lastpos) - (L.S.Timegap) / (S.L.motortuer_speed)
{end}

{trigger:Motortuer_off}
	0 (S.L.motortuer_dragged)
{end}

{trigger:Bottle}
	(L.L.motortuer_pos) 0.05 >
	{if}
		(L.L.bottle_visible) ! (S.L.bottle_visible)
	{endif}
{end}
{trigger:bagaznik1_drag}

	1 (S.L.bagaznik1_dragged)
	(L.L.bagaznik1_pos) (S.L.bagaznik1_lastpos)

	(L.S.mouse_x) -200 / (L.L.bagaznik1_pos) + (S.L.bagaznik1_pos) s0
	l0 0 <
	{if}
		0 (S.L.bagaznik1_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.bagaznik1_pos)
	{endif}
	
	(L.L.bagaznik1_pos) (L.L.bagaznik1_lastpos) - (L.S.Timegap) / (S.L.bagaznik1_speed)
{end}

{trigger:bagaznik1_off}
	0 (S.L.bagaznik1_dragged)
{end}

{trigger:bagaznik2_drag}

	1 (S.L.bagaznik2_dragged)
	(L.L.bagaznik2_pos) (S.L.bagaznik2_lastpos)

	(L.S.mouse_x) -200 / (L.L.bagaznik2_pos) + (S.L.bagaznik2_pos) s0
	l0 0 <
	{if}
		0 (S.L.bagaznik2_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.bagaznik2_pos)
	{endif}
	
	(L.L.bagaznik2_pos) (L.L.bagaznik2_lastpos) - (L.S.Timegap) / (S.L.bagaznik2_speed)
{end}

{trigger:bagaznik2_off}
	0 (S.L.bagaznik2_dragged)
{end}

{trigger:bagaznik3_drag}

	1 (S.L.bagaznik3_dragged)
	(L.L.bagaznik3_pos) (S.L.bagaznik3_lastpos)

	(L.S.mouse_x) -200 / (L.L.bagaznik3_pos) + (S.L.bagaznik3_pos) s0
	l0 0 <
	{if}
		0 (S.L.bagaznik3_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.bagaznik3_pos)
	{endif}

	(L.L.bagaznik3_pos) (L.L.bagaznik3_lastpos) - (L.S.Timegap) / (S.L.bagaznik3_speed)
{end}

{trigger:bagaznik3_off}
	0 (S.L.bagaznik3_dragged)
{end}

{trigger:bagaznik4_drag}

	1 (S.L.bagaznik4_dragged)
	(L.L.bagaznik4_pos) (S.L.bagaznik4_lastpos)

	(L.S.mouse_x) -200 / (L.L.bagaznik4_pos) + (S.L.bagaznik4_pos) s0
	l0 0 <
	{if}
		0 (S.L.bagaznik4_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.bagaznik4_pos)
	{endif}
	
	(L.L.bagaznik4_pos) (L.L.bagaznik4_lastpos) - (L.S.Timegap) / (S.L.bagaznik4_speed)
{end}

{trigger:bagaznik4_off}
	0 (S.L.bagaznik4_dragged)
{end}

{trigger:bagaznik5_drag}

	1 (S.L.bagaznik5_dragged)
	(L.L.bagaznik5_pos) (S.L.bagaznik5_lastpos)

	(L.S.mouse_x) -200 / (L.L.bagaznik5_pos) + (S.L.bagaznik5_pos) s0
	l0 0 <
	{if}
		0 (S.L.bagaznik5_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.bagaznik5_pos)
	{endif}

	(L.L.bagaznik5_pos) (L.L.bagaznik5_lastpos) - (L.S.Timegap) / (S.L.bagaznik5_speed)
{end}

{trigger:bagaznik5_off}
	0 (S.L.bagaznik5_dragged)
{end}

{trigger:bagaznik6_drag}

	1 (S.L.bagaznik6_dragged)
	(L.L.bagaznik6_pos) (S.L.bagaznik6_lastpos)

	(L.S.mouse_x) -200 / (L.L.bagaznik6_pos) + (S.L.bagaznik6_pos) s0
	l0 0 <
	{if}
		0 (S.L.bagaznik6_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.bagaznik6_pos)
	{endif}
	
	(L.L.bagaznik6_pos) (L.L.bagaznik6_lastpos) - (L.S.Timegap) / (S.L.bagaznik6_speed)
{end}

{trigger:bagaznik6_off}
	0 (S.L.bagaznik6_dragged)
{end}

{trigger:bagaznik7_drag}

	1 (S.L.bagaznik7_dragged)
	(L.L.bagaznik7_pos) (S.L.bagaznik7_lastpos)

	(L.S.mouse_x) -200 / (L.L.bagaznik7_pos) + (S.L.bagaznik7_pos) s0
	l0 0 <
	{if}
		0 (S.L.bagaznik7_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.bagaznik7_pos)
	{endif}
	
	(L.L.bagaznik7_pos) (L.L.bagaznik7_lastpos) - (L.S.Timegap) / (S.L.bagaznik7_speed)
{end}

{trigger:bagaznik7_off}
	0 (S.L.bagaznik7_dragged)
{end}

'----------------------
'	Init
'----------------------

{macro:cockpit_init}
	0 (S.L.cockpit_hupe_volume) (S.L.cockpit_gangR_volume) (S.L.door_handsteuerung) (S.L.cp_tabla_visible) (S.L.cp_tabla1_visible)
	1 (S.L.cp_retarder_sw) (S.L.cp_lenkrad_visible) (S.L.cp_taster_warnblinker) (S.L.cockpit_wischer_drehschalter_mode) 

	0.6 (S.L.cp_taster_warnblinker) (S.L.cp_taster_standheizung)

	(C.L.cockpit_zentralschmierung_dist) random (S.L.cp_zentralschmierung_nextkm)

	0.333 (S.L.cockpit_wischer_drehschalter)

	
{end}

'----------------------
'	Frame
'----------------------
{macro:cockpit_frame}
'Übertragen der Schalterstellungen:
	(L.L.cp_retarder_sw) (S.L.antrieb_retarder_sw)
	(L.L.cp_retarder_sw_direkt) (S.L.antrieb_retarder_sw_direkt)
	(L.L.cp_wischer_schnell_sw) (S.L.wiper_schnell_sw)
	(L.L.cp_wischer_einaus_sw) (S.L.wiper_einaus_sw)
	(L.L.cp_wischer_intervall_sw) (S.L.wiper_intervall_sw)
	(L.L.cp_wischer_wascher_sw) (S.L.wiper_wascher_sw)
	(L.L.cp_wischer_schnell_sw_R) (S.L.wiper_schnell_sw_R)
	(L.L.cp_wischer_einaus_sw_R) (S.L.wiper_einaus_sw_R)
	(L.L.cp_wischer_intervall_sw_R) (S.L.wiper_intervall_sw_R)
	(L.L.cp_wischer_wascher_sw_R) (S.L.wiper_wascher_sw_R)

	(M.L.tacho_frame)
	(M.L.uhr_frame)
	(M.L.drehzahlmesser_frame)
	(M.L.hupe_frame)
	(M.L.gangR_frame)
	(M.L.blinkerhebel_frame)
	(M.L.wischerhebel_frame)
	(M.L.wischer_drehschalter_frame)
	(M.L.wischerhebel_R_frame)
	(M.L.wischer_drehschalter_R_frame)
	(M.L.oeldruck_frame)
	(M.L.tankuhr_frame)
	(M.L.cockpitlights_frame)
	(M.L.klimator_frame)
	(M.L.odometer_frame)
	(M.L.fahrertuer_frame) 
	(M.L.rollo_frame)
	(M.L.rollo2_frame)
	(M.L.engine_thermometer_frame)
	(M.L.microphone_frame)
	(M.L.pressure_warning_needle_frame)
	(M.L.zentralschmierung_frame)
	(M.L.Thermometer_frame)
	(M.L.brizgovik_frame)
	(M.L.bagazniki_frame)
	(M.L.engine_shkiv_frame)
	(M.L.ampermetr_frame)
	(M.L.cps_frame)
	(M.L.luki_frame)
	(M.L.extra_frame)
	(M.L.windows_frame)
	(M.L.cp_rotor)
{end}

{macro:tacho_frame}
	(L.L.Velocity) (F.L.cockpit_tacholinie) (S.L.cockpit_tachowinkel)
{end}

{macro:uhr_frame}
	(L.L.elec_busbar_avail) 0.5 >
	{if}
		(L.S.Time) s0 60 / (S.L.cockpit_uhr_min) 12 / (S.L.cockpit_uhr_std)
		l0 trunc (S.L.cockpit_uhr_sek)
	{endif}
{end} 

{macro:drehzahlmesser_frame}
	(L.L.engine_n) 3000 270 / / (S.L.cockpit_drehzahlwinkel)
{end}

{macro:hupe_frame}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		(L.L.cockpit_hupe) 1 =
		{if}
			(L.L.cockpit_hupe_volume) 1 <
			{if}
				(L.L.cockpit_hupe_volume) (L.S.Timegap) 10 * + (S.L.cockpit_hupe_volume)
			{else}
				1 (S.L.cockpit_hupe_volume)
			{endif}
		{else}
			(L.L.cockpit_hupe_volume) 0 >
			{if}
				(L.L.cockpit_hupe_volume) (L.S.Timegap) 10 * - (S.L.cockpit_hupe_volume)
			{else}
				0 (S.L.cockpit_hupe_volume)
			{endif}
		{endif}
	{else}
		(L.L.cockpit_hupe_volume) 0 >
		{if}
			(L.L.cockpit_hupe_volume) (L.S.Timegap) 10 * - (S.L.cockpit_hupe_volume)
		{else}
			0 (S.L.cockpit_hupe_volume)
		{endif}
	{endif}	
	
{end}

{macro:gangR_frame}
	(L.L.elec_busbar_main)
	{if}
		(L.L.antrieb_getr_gang) -1 =
		{if}
			(L.L.cockpit_gangR_volume) 1 <
			{if}
				(L.L.cockpit_gangR_volume) (L.S.Timegap) 10 * + (S.L.cockpit_gangR_volume)
			{else}
				1 (S.L.cockpit_gangR_volume)
			{endif}
		{else}
			(L.L.cockpit_gangR_volume) 0 >
			{if}
				(L.L.cockpit_gangR_volume) (L.S.Timegap) 10 * - (S.L.cockpit_gangR_volume)
			{else}
				0 (S.L.cockpit_gangR_volume)
			{endif}
		{endif}
	{else}
		(L.L.cockpit_gangR_volume) 0 >
		{if}
			(L.L.cockpit_gangR_volume) (L.S.Timegap) 10 * - (S.L.cockpit_gangR_volume)
		{else}
			0 (S.L.cockpit_gangR_volume)
		{endif}
	{endif}	
	
{end}

{macro:blinkerhebel_frame}
	(L.L.lights_sw_blinker) 1 =
	{if}	
		-1 (S.L.cockpit_blinkerhebel)
	{else}
		(L.L.lights_sw_blinker) 2 =
		{if}
			1 (S.L.cockpit_blinkerhebel)
		{else}
			0 (S.L.cockpit_blinkerhebel)
		{endif}
	{endif}

'	Hebel-Animation für Fernlicht
	(L.L.lights_sw_fern)
	{if}	
		(L.L.cockpit_fernlichthebel) -1 = !
		{if}
			1 (S.L.cockpit_fernlichthebel)
		{endif}

		(L.L.cp_cps_trans) 0.8 >
		{if}
			-1 (S.L.cockpit_fernlichthebel)
		{endif}
	{else}
		0 (S.L.cockpit_fernlichthebel)
	{endif}


{end}

{macro:cps_frame}

	(L.L.cp_cps_trans_lastmode) (L.L.cp_cps_trans_mode) = !
	{if}
		(T.L.ev_schluessel_steck)
	{endif}
	(L.L.cp_cps_trans_mode) (S.L.cp_cps_trans_lastmode)
{end}

{macro:wischerhebel_frame}

	(L.L.cockpit_wischerhebel_lastmode) (L.L.cockpit_wischerhebel_mode) = !
	{if}
		(T.L.ev_wischerhebel)
	{endif}
	(L.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischerhebel_lastmode)
{end}

{macro:wischer_drehschalter_frame}

	(L.L.cockpit_wischer_drehschalter_lastmode) (L.L.cockpit_wischer_drehschalter_mode) = !
	{if}
		(T.L.ev_wischerhebel)
	{endif}
	(L.L.cockpit_wischer_drehschalter_mode) (S.L.cockpit_wischer_drehschalter_lastmode)
{end}

{macro:wischerhebel_R_frame}

	(L.L.cockpit_wischerhebel_lastmode_R) (L.L.cockpit_wischerhebel_mode_R) = !
	{if}
		(T.L.ev_wischerhebel)
	{endif}
	(L.L.cockpit_wischerhebel_mode_R) (S.L.cockpit_wischerhebel_lastmode_R)
{end}

{macro:wischer_drehschalter_R_frame}

	(L.L.cockpit_wischer_drehschalter_lastmode_R) (L.L.cockpit_wischer_drehschalter_mode_R) = !
	{if}
		(T.L.ev_wischerhebel)
	{endif}
	(L.L.cockpit_wischer_drehschalter_mode_R) (S.L.cockpit_wischer_drehschalter_lastmode_R)
{end}



{macro:cockpitlights_frame}

    (L.L.elec_busbar_main) 0.2 >
    {if}
    (L.L.cp_cps_rot) (F.L.podsvet_prib_light) (S.L.cockpit_light_prib)	
    {else}
    0 (S.L.cockpit_light_prib)
 {endif}

'	Čķäčźąņīš ąāąščéķīé īńņąķīāźč äāčćąņåė˙
	(L.L.elec_busbar_main) (L.L.cp_avar_rot) 0.5 > &&
	(S.L.cockpit_light_avar_stop)

'	Čķäčźąņīšū ņīšģīēķīé ńčńņåģū

	(L.L.bremse_p_tank01) 400000 <
	(L.L.bremse_p_tank02) 400000 < ||
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_davlenie)

	(L.L.lights_brems) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_tormoz_1)

	(L.L.lights_brems)
	(L.L.bremse_p_tank01) 650000 < ||
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_tormoz_2)

	(L.L.lights_brems)
	(L.L.bremse_p_tank02) 650000 < ||
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_tormoz_3)

'	Batterie
	(L.L.elec_ladekontrolle) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_batterie)

'	Türkontrolle
	(C.L.cockpit_aftdoorlight_condition_D92)
	{if}
		(L.L.door_1L) 0 = 
		(L.L.door_2L) 0 = && !
	{else}
		(L.L.door_1L) 0.11 > 
		(L.L.door_2L) 0.11 > ||
	{endif}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) > &&
	(S.L.cockpit_light_tuerkontrolle)

'	Kontrolle Feststellbremse
	(L.L.bremse_p_Brzyl_FBA) 650000 <
	(L.L.elec_busbar_main) *
	(S.L.cockpit_light_feststellbremse)

'	Geschwindigkeitswarnung
	(L.L.Velocity) 54 > (L.L.elec_busbar_main) *
	(S.L.cockpit_light_speedwarning)
	
'	Kippschalter-Beleuchtung
	(L.L.cp_retarder_sw_direkt) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_retarder_direkt)

	(L.L.cp_retarder_sw) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_retarder)

	(L.L.cp_fahrerlicht_sw) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_fahrerlicht)

	(L.L.cp_licht_unterdeck_sw) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_licht_unterdeck)

	(L.L.cp_licht_oberdeck_sw) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_licht_oberdeck)

	(L.L.cp_wischer_schnell_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_schnell)

	(L.L.cp_wischer_einaus_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_einaus)

	(L.L.cp_wischer_intervall_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_intervall)
	
	(L.L.cp_wischer_wascher_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_wascher)

	(L.L.cp_wischer_wascher_sw_r) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_wascher)

	(L.L.cp_heizluefter_sw) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_heizluefter)
	
	(L.L.cp_spiegelheizung_sw) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_spiegelheizung)

	(L.L.cp_motorkuehlung_sw) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_motorkuehlung)

	(L.L.door_handsteuerung) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_tuer_handsteuerung)

	(L.L.door_light_2) (L.L.lights_stand) *
	(S.L.cockpit_light_door_2)

	(L.L.cp_lampa_eng) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_lampa_eng)

	(L.L.cp_ASR_off) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_ASR_off)

	(L.L.cockpit_gangR) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gangR)

	(L.L.cp_wischer_wascher_sw_r) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_wascher)

	(L.L.cp_tumanki) (L.L.elec_busbar_main) &&
	(S.L.cp_light_tumanki)

	(L.L.cp_kn_obduv_lob_L) 1 = (L.L.elec_busbar_main) &&
	(S.L.obduv_l)

	(L.L.cp_kn_obduv_lob_P) 1 = (L.L.elec_busbar_main) &&
	(S.L.obduv_p)

'	Dummy-Schalter:

	(L.L.cp_dummy_sw01) (L.L.elec_busbar_main) *
	(S.L.cp_dummy_func01)

	(L.L.cp_dummy_sw02) (L.L.elec_busbar_main) *
	(S.L.cp_dummy_func02)

	(L.L.cp_dummy_sw03) (L.L.elec_busbar_main) *
	(S.L.cp_dummy_func03)

	(L.L.cp_dummy_sw04) (L.L.elec_busbar_main) *
	(S.L.cp_dummy_func04)

	(L.L.cp_dummy_sw05) (L.L.elec_busbar_main) *
	(S.L.cp_dummy_func05)

	(L.L.cp_dummy_sw06) (L.L.elec_busbar_main) *
	(S.L.cp_dummy_func06)

	(L.L.cp_dummy_sw07) (L.L.elec_busbar_main) *
	(S.L.cp_dummy_func07)

	(L.L.cp_dummy_sw08) (L.L.elec_busbar_main) *
	(S.L.cp_dummy_func08)

	(L.L.cp_dummy_sw09) (L.L.elec_busbar_main) *
	(S.L.cp_dummy_func09)

	(L.L.cp_dummy_sw10) (L.L.elec_busbar_main) *
	(S.L.cp_dummy_func10)
{end}

{macro:oeldruck_frame}
	(L.L.engine_n) (F.L.cockpit_oeldruck) (L.L.elec_busbar_main) * s0

	(L.L.cockpit_oeldruck) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_oeldruck)
{end}

{macro:tankuhr_frame}
	(L.L.engine_tank_content) (L.L.elec_busbar_main) * s0

	(L.L.cockpit_tankuhr) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_tankuhr)
	
	(L.L.engine_n) trunc " 4" $IntToStrEnh
	(S.$.cockpit_rpm)
{end}

{macro:engine_thermometer_frame}
	(L.L.engine_temperature) (F.L.cockpit_engine_temperature) (L.L.elec_busbar_main) * s0

	(L.L.cockpit_motortemperaturwinkel) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_motortemperaturwinkel)
{end}
	

{macro:kippschaltersound}
	l1
	{if}
		(T.L.ev_kippschalter_ein)
	{else}
		(T.L.ev_kippschalter_aus)
	{endif}	
{end}

{macro:extra_sound}
	l1
	{if}
		(T.L.ev_extra_ein)
	{else}
		(T.L.ev_extra_aus)
	{endif}	
{end}

{macro:klappfenstersound}
	l1
	{if}
		(T.L.ev_klappfenster_opn)
	{else}
		(T.L.ev_klappfenster_cls)
	{endif}	
{end}

{macro:klimator_frame}



	(L.L.cp_klimator_sw) (L.L.elec_busbar_main) * s1
	-0.5 <
	{if}
		0.6 (L.L.elec_busbar_main) * s1
	{endif}


	l1 100 * (L.L.cp_klimator_RPM) > 
	{if}
		1.5 s0
	{else}
		0.5 s0
	{endif}


	l1 100 * 

	(L.L.cp_klimator_RPM)

	- s0 * (L.S.Timegap) *

	(L.L.cp_klimator_RPM) + (S.L.cp_klimator_RPM)

	(L.L.cp_klimator_sw) 0.5 >
	{if}
		(L.L.elec_busbar_Rinv_summe) (C.L.cp_klimator_Rinv) + (S.L.elec_busbar_Rinv_summe)
	{else}
		(L.L.cp_klimator_sw) -0.5 <
		{if}
			(L.L.elec_busbar_Rinv_summe) (C.L.cp_klimator_Rinv) 0.6 * + (S.L.elec_busbar_Rinv_summe)
		{endif}
	{endif}
	
	(L.L.cp_heizluefter_sw) (L.L.elec_busbar_main) * s1
	-0.5 <
	{if}
		0.6 (L.L.elec_busbar_main) * s1
	{endif}

	l1 100 * (L.L.cp_cabinheater_RPM) > 
	{if}
		6 s0
	{else}
		1.0 s0
	{endif}

	l1 100 * 
	(L.L.cp_cabinheater_RPM)
	- s0 * (L.S.Timegap) *
	(L.L.cp_cabinheater_RPM) + (S.L.cp_cabinheater_RPM)

	(L.L.cp_heizluefter_sw) 0.5 >
	{if}
		(L.L.elec_busbar_Rinv_summe) (C.L.cp_cabinheater_Rinv) + (S.L.elec_busbar_Rinv_summe)
	{else}
		(L.L.cp_heizluefter_sw) -0.5 <
		{if}
			(L.L.elec_busbar_Rinv_summe) (C.L.cp_cabinheater_Rinv) 0.6 * + (S.L.elec_busbar_Rinv_summe)
		{endif}
	{endif}


{end}

{macro:traegheit}

'Simuliert träges Verhalten (exponentiell)

'Ladekonventionen:
'	Sollwert		l0
'	Istwert			l1
'	Konstante Anlauf	l2 (Einheiten/s)
'	Konstante Ablauf	l3 (Einheiten/s)

'Anlauf oder Auslauf?
	l0 l1 > 
	{if}
		l2 (L.S.Timegap) * 1 min -1 max s4
	{else}
		l3 (L.S.Timegap) * 1 min -1 max s4
	{endif}


'Sollwert:
	l0
'Istwert:
	l1
'Beschleunigung:
	- l4 *
'Addition zum Istwert:
	l1 + s1
{end}


{macro:odometer_frame}
	(L.L.kmcounter_km) (L.L.kmcounter_m) 1000 / + 10 *
	(S.L.cp_odometer_01)

	(L.L.cp_odometer_01) 10 / trunc 
	(L.L.cp_odometer_01) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_1)

	(L.L.cp_odometer_1) 10 / trunc 
	(L.L.cp_odometer_1) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_10)

	(L.L.cp_odometer_10) 10 / trunc 
	(L.L.cp_odometer_10) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_100)

	(L.L.cp_odometer_100) 10 / trunc 
	(L.L.cp_odometer_100) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_1000)

	(L.L.cp_odometer_1000) 10 / trunc 
	(L.L.cp_odometer_1000) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_10000)

	(L.L.cp_odometer_10000) 10 / trunc 
	(L.L.cp_odometer_10000) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_100000)


	(L.L.kmcounter_m) 100 / (S.L.cp_odometer_01)
{end}


{macro:fahrertuer_frame}

	(L.L.cp_fahrertuer_dragged) !
	{if}
		(L.L.cp_fahrertuer_pos) (L.S.Timegap) (L.L.cp_fahrertuer_speed) * + (S.L.cp_fahrertuer_pos)

		(L.L.cp_fahrertuer_pos) 1 >
		{if}
			1 (S.L.cp_fahrertuer_pos)
			(L.L.cp_fahrertuer_speed) /-/ 0.7 * (S.L.cp_fahrertuer_speed)
		{endif}
		(L.L.cp_fahrertuer_pos) 0 <
		{if}
			0 (S.L.cp_fahrertuer_speed) (S.L.cp_fahrertuer_pos)
		{endif}

		(L.L.cp_fahrertuer_pos) 0 >
		{if}
			(L.L.cp_fahrertuer_speed) (L.S.Timegap) (L.L.A_Trans_Y) (C.L.cp_fahrertuer_anschlagseite) * (L.L.A_Trans_X) /-/ + 0.3 * (L.L.cp_fahrertuer_globalangle) * * + (S.L.cp_fahrertuer_speed)
		{endif}
	
		(L.L.cp_fahrertuer_speed) s0 (S.L.cp_fahrertuer_lastspeed)
		l0 0 >
		{if}
			l0 (L.S.Timegap) 0.2 * - (S.L.cp_fahrertuer_speed)
		{endif}
		l0 0 <
		{if}
			l0 (L.S.Timegap) 0.2 * + (S.L.cp_fahrertuer_speed)
		{endif}


		(L.L.cp_fahrertuer_speed) 0 > (L.L.cp_fahrertuer_lastspeed) 0 < &&
		(L.L.cp_fahrertuer_speed) 0 < (L.L.cp_fahrertuer_lastspeed) 0 > && ||
		{if}
			0 (S.L.cp_fahrertuer_speed)
		{endif}	 
	
	{endif}

	(L.L.cp_fahrertuer_pos) 0 > (L.L.cp_fahrertuer_open) ! &&
	{if}
		(T.L.ev_fahrertuer_auf)
		1 (S.L.cp_fahrertuer_open)
	{endif}

	(L.L.cp_fahrertuer_pos) 0 = (L.L.cp_fahrertuer_open) &&
	{if}
		(T.L.ev_fahrertuer_zu)
		0 (S.L.cp_fahrertuer_open)
	{endif}

	(L.L.cp_fahrertuer_pos) 140 * 27 + 3.14 * 180 / sin (S.L.cp_fahrertuer_globalangle) 

	(L.L.velocity) (L.L.cp_velocity_last) - (S.L.cp_acceleration)
	(L.L.velocity) (S.L.cp_velocity_last)
{endif}

	(L.L.cp_luk_gaz_dragged) !
	{if}
		(L.L.cp_luk_gaz_pos) (L.S.Timegap) (L.L.cp_luk_gaz_speed) * + (S.L.cp_luk_gaz_pos)

		(L.L.cp_luk_gaz_pos) 1 >
		{if}
			1 (S.L.cp_luk_gaz_pos)
			(L.L.cp_luk_gaz_speed) /-/ 0.7 * (S.L.cp_luk_gaz_speed)
		{endif}
		(L.L.cp_luk_gaz_pos) 0 <
		{if}
			0 (S.L.cp_luk_gaz_speed) (S.L.cp_luk_gaz_pos)
		{endif}

		(L.L.cp_luk_gaz_pos) 0 >
		{if}
			(L.L.cp_luk_gaz_speed) (L.S.Timegap) (L.L.A_Trans_Y) (C.L.cp_fahrertuer_anschlagseite) * (L.L.A_Trans_X) /-/ + 0.3 * (L.L.cp_luk_gaz_globalangle) * * + (S.L.cp_luk_gaz_speed)
		{endif}
	
		(L.L.cp_luk_gaz_speed) s0 (S.L.cp_luk_gaz_lastspeed)
		l0 0 >
		{if}
			l0 (L.S.Timegap) 0.2 * - (S.L.cp_luk_gaz_speed)
		{endif}
		l0 0 <
		{if}
			l0 (L.S.Timegap) 0.2 * + (S.L.cp_luk_gaz_speed)
		{endif}


		(L.L.cp_luk_gaz_speed) 0 > (L.L.cp_luk_gaz_lastspeed) 0 < &&
		(L.L.cp_luk_gaz_speed) 0 < (L.L.cp_luk_gaz_lastspeed) 0 > && ||
		{if}
			0 (S.L.cp_luk_gaz_speed)
		{endif}	 
	
	{endif}

	(L.L.cp_luk_gaz_pos) 0 > (L.L.cp_luk_gaz_open) ! &&
	{if}
		(T.L.ev_luk_gaz_auf)
		1 (S.L.cp_luk_gaz_open)
	{endif}

	(L.L.cp_luk_gaz_pos) 0 = (L.L.cp_luk_gaz_open) &&
	{if}
		(T.L.ev_luk_gaz_zu)
		0 (S.L.cp_luk_gaz_open)
	{endif}

	(L.L.cp_luk_gaz_pos) 140 * 27 + 3.14 * 180 / sin (S.L.cp_luk_gaz_globalangle) 

	(L.L.velocity) (L.L.cp_velocity_last) - (S.L.cp_acceleration)
	(L.L.velocity) (S.L.cp_velocity_last)
{endif}

'-----------------------------------------------
'ōčźńąņīš
'-----------------------------------------------

		(L.L.cp_kr_radiator_fix) 1 =
		{if}
			(L.L.cp_kr_radiator_pos) 0.22 <
			{if}
				0.21 (S.L.cp_kr_radiator_pos)
				(L.L.cp_kr_radiator_speed) /-/ 0.1 * 0.2 min (S.L.cp_kr_radiator_speed) 
			{endif}
		{endif}
	{endif}

'-----------------------------------------------

(L.L.cp_kr_radiator_dragged) !
	{if}
		(L.L.cp_kr_radiator_pos) (L.S.Timegap) (L.L.cp_kr_radiator_speed) * + (S.L.cp_kr_radiator_pos)

		(L.L.cp_kr_radiator_pos) 1 >
		{if}
			1 (S.L.cp_kr_radiator_pos)
			(L.L.cp_kr_radiator_speed) /-/ 0.7 * (S.L.cp_kr_radiator_speed)
		{endif}
		(L.L.cp_kr_radiator_pos) 0 <
		{if}
			0 (S.L.cp_kr_radiator_speed) (S.L.cp_kr_radiator_pos)
		{endif}

		(L.L.cp_kr_radiator_pos) 0 >
		{if}
			(L.L.cp_kr_radiator_speed) (L.S.Timegap) (L.L.A_Trans_Y) (C.L.cp_fahrertuer_anschlagseite) * (L.L.A_Trans_X) /-/ + 0.3 * (L.L.cp_kr_radiator_globalangle) * * + (S.L.cp_kr_radiator_speed)
		{endif}
	
		(L.L.cp_kr_radiator_speed) s0 (S.L.cp_kr_radiator_lastspeed)
		l0 0 >
		{if}
			l0 (L.S.Timegap) 0.2 * - (S.L.cp_kr_radiator_speed)
		{endif}
		l0 0 <
		{if}
			l0 (L.S.Timegap) 0.2 * + (S.L.cp_kr_radiator_speed)
		{endif}


		(L.L.cp_kr_radiator_speed) 0 > (L.L.cp_kr_radiator_lastspeed) 0 < &&
		(L.L.cp_kr_radiator_speed) 0 < (L.L.cp_kr_radiator_lastspeed) 0 > && ||
		{if}
			0 (S.L.cp_kr_radiator_speed)
		{endif}	 
	
	{endif}

	(L.L.cp_kr_radiator_pos) 0 > (L.L.cp_kr_radiator_open) ! &&
	{if}
		(T.L.ev_kr_radiator_auf)
		1 (S.L.cp_kr_radiator_open)
	{endif}

	(L.L.cp_kr_radiator_pos) 0 = (L.L.cp_kr_radiator_open) &&
	{if}
		(T.L.ev_kr_radiator_zu)
		0 (S.L.cp_kr_radiator_open)
	{endif}

	(L.L.cp_kr_radiator_pos) 140 * 27 + 3.14 * 180 / sin (S.L.cp_kr_radiator_globalangle) 

	(L.L.velocity) (L.L.cp_velocity_last) - (S.L.cp_acceleration)
	(L.L.velocity) (S.L.cp_velocity_last)
	
{end}

{trigger:cp_rollo_retract_off}
	0 (S.L.cp_rollo_bommel) (S.L.cp_rollo_retract) (S.L.cp_rollo_speed)
{end}

	(M.L.rollo_frame)

{macro:rollo_frame}
	(L.L.cp_rollo_pos) (L.L.cp_rollo_rastpos) max (S.L.cp_rollo_rastpos)

	(L.L.cp_rollo_dragged) !
	{if}
		(L.L.cp_rollo_retract)
		{if}
			(L.L.cp_rollo_speed) (L.S.Timegap) (L.L.cp_rollo_pos) 14 * * - (S.L.cp_rollo_speed)
			(L.L.cp_rollo_pos) (L.S.Timegap) (L.L.cp_rollo_speed) * + (S.L.cp_rollo_pos) (S.L.cp_rollo_rastpos)
					
		{else}
			(L.L.cp_rollo_pos) (L.L.cp_rollo_rastpos) < 
			{if}
				(L.L.cp_rollo_speed) (L.S.Timegap) 14 * + (S.L.cp_rollo_speed)
				(L.L.cp_rollo_pos) (L.S.Timegap) (L.L.cp_rollo_speed) * + (L.L.cp_rollo_rastpos) min (S.L.cp_rollo_pos)
			{else}
				0 (S.L.cp_rollo_speed)
			{endif}
		{endif}

		(L.L.cp_rollo_pos) 1 >
		{if}
			1 (S.L.cp_rollo_pos) (S.L.cp_rollo_rastpos)
		{else}
			(L.L.cp_rollo_pos) 0 <
			{if}
			0 (S.L.cp_rollo_pos) (S.L.cp_rollo_retract) (S.L.cp_rollo_rastpos)
			{endif}
		{endif}

	{endif}
	(L.L.cp_rollo_pos) 0.138 <=
	{if}
		(L.L.part1) 1 =
		{if}
			0 (S.L.part1)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.32 <=
	{if}
		(L.L.part2) 1 =
		{if}
			0 (S.L.part2)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.5 <=
	{if}
		(L.L.part3) 1 =
		{if}
			0 (S.L.part3)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.68 <=
	{if}
		(L.L.part4) 1 =
		{if}
			0 (S.L.part4)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.86 <=
	{if}
		(L.L.part5) 1 =
		{if}
			0 (S.L.part5)
		{endif}
	{endif}
{end}

{macro:rollo2_frame}
	(L.L.cp_rollo2_pos) (L.L.cp_rollo2_rastpos) max (S.L.cp_rollo2_rastpos)

	(L.L.cp_rollo2_dragged) !
	{if}
		(L.L.cp_rollo2_retract)
		{if}
			(L.L.cp_rollo2_speed) (L.S.Timegap) (L.L.cp_rollo2_pos) 14 * * - (S.L.cp_rollo2_speed)
			(L.L.cp_rollo2_pos) (L.S.Timegap) (L.L.cp_rollo2_speed) * + (S.L.cp_rollo2_pos) (S.L.cp_rollo2_rastpos)
					
		{else}
			(L.L.cp_rollo2_pos) (L.L.cp_rollo2_rastpos) < 
			{if}
				(L.L.cp_rollo2_speed) (L.S.Timegap) 14 * + (S.L.cp_rollo2_speed)
				(L.L.cp_rollo2_pos) (L.S.Timegap) (L.L.cp_rollo2_speed) * + (L.L.cp_rollo2_rastpos) min (S.L.cp_rollo2_pos)
			{else}
				0 (S.L.cp_rollo2_speed)
			{endif}
		{endif}

		(L.L.cp_rollo2_pos) 1 >
		{if}
			1 (S.L.cp_rollo2_pos) (S.L.cp_rollo2_rastpos)
		{else}
			(L.L.cp_rollo2_pos) 0 <
			{if}
			0 (S.L.cp_rollo2_pos) (S.L.cp_rollo2_retract) (S.L.cp_rollo2_rastpos)
			{endif}
		{endif}

	{endif}
	(L.L.cp_rollo2_pos) 0.138 <=
	{if}
		(L.L.nrl_t_6_visibility) 1 =
		{if}
			0 (S.L.nrl_t_6_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.32 <=
	{if}
		(L.L.nrl_t_7_visibility) 1 =
		{if}
			0 (S.L.nrl_t_7_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.5 <=
	{if}
		(L.L.nrl_t_8_visibility) 1 =
		{if}
			0 (S.L.nrl_t_8_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.68 <=
	{if}
		(L.L.nrl_t_9_visibility) 1 =
		{if}
			0 (S.L.nrl_t_9_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.86 <=
	{if}
		(L.L.nrl_t_10_visibility) 1 =
		{if}
			0 (S.L.nrl_t_10_visibility)
		{endif}
	{endif}
{end}

{macro:microphone_frame}

	(L.L.Clutch) 1.2 > (L.L.cp_microphone_sw) ||
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) > && s0
	(L.L.Snd_Microphone) s1


	l0 l1 ! &&
	{if}
		(T.L.micro_lautsprecherknack_start)
	{endif}

	l0 ! l1 &&
	{if}
		(T.L.micro_lautsprecherknack_end)
	{endif}


	l0 (S.L.Snd_Microphone)
{end}


{macro:pressure_warning_needle_frame}

	(L.L.bremse_p_Tank01) (L.L.bremse_p_Tank02) + 2 / (S.L.cockpit_warndruck) (F.L.cockpit_warndruck) (S.L.cockpit_warndruckwinkel)

{end}

{macro:zentralschmierung_frame}

	(L.L.cp_zentralschmierung_nextkm) (L.L.velocity) 3600 / (L.S.Timegap) * + (S.L.cp_zentralschmierung_nextkm)
	(C.L.cockpit_zentralschmierung_dist) >
	(L.L.cp_zentralschmierung_runtime) (C.L.cockpit_zentralschmierung_maxtime) < &&
	{if}
		1 (S.L.cockpit_light_zentralschmierung)
		(L.L.cp_zentralschmierung_runtime) (L.S.Timegap) + (S.L.cp_zentralschmierung_runtime)
	{else}
		(L.L.cockpit_light_zentralschmierung)
		{if}
			0 (S.L.cp_zentralschmierung_nextkm)
		{endif}
		0 (S.L.cockpit_light_zentralschmierung) (S.L.cp_zentralschmierung_runtime)
	{endif}	

{end}

{macro:Thermometer_frame}
	50 (L.L.Cabinair_Temp) + trunc 0 max 100 min s1
	"C" 100 $* l1 $SetLengthL (S.$.cockpit_spirt_termometr)
{end}

{macro:brizgovik_frame}
	(L.L.A_Trans_Y) 9.81 / 1.5 min -1.5 max
	(L.L.cp_brizgovik) - 0.05 *
	(L.S.Timegap) /
	(L.S.Timegap) 6 * /-/ exp
	(L.L.cp_brizgovik_Speed) * + (S.L.cp_brizgovik_Speed)
	(L.S.Timegap) * (L.L.cp_brizgovik) + (S.L.cp_brizgovik)
{end}

{macro:bagazniki_frame}

	(L.L.motortuer_pos) 0.1 >
	{if}
	(L.L.motortuer_speed) abs (S.L.motortuer_volcurve)
'		(L.L.motortuer_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.motortuer_volcurve)
'		{else}
'			l0 (S.L.motortuer_volcurve)
'		{endif}
	{endif}

	(L.L.motortuer_dragged) !
	{if}
		(L.L.motortuer_pos) (L.S.Timegap) (L.L.motortuer_speed) * + (S.L.motortuer_pos)
		
		(L.L.motortuer_pos) 0.35 >
		{if}
			(L.L.motortuer_speed) (L.S.Timegap) + (S.L.motortuer_speed)
		{endif}
		
		(L.L.motortuer_pos) 0.35 <
		{if}
			(L.L.motortuer_speed) (L.S.Timegap) -1 * + (S.L.motortuer_speed)
		{endif}

		(L.L.motortuer_pos) 1 >
		{if}
			1 (S.L.motortuer_pos)
			(L.L.motortuer_speed) /-/ 0.2 * 0.2 min (S.L.motortuer_speed)
		{endif}
		(L.L.motortuer_pos) 0 <
		{if}
			0 (S.L.motortuer_speed) (S.L.motortuer_pos)
		{endif}
	
		(L.L.motortuer_speed) 0 = !
		{if}
			(L.L.motortuer_pos) 0.005 < (L.L.motortuer_pos) 0.995 > ||
			{if}
				(L.L.empty_02) 1 <
				{if}
					(L.L.empty_02) (L.S.Timegap) + (S.L.empty_02)
				{else}
					0 (S.L.motortuer_speed)
				{endif}
			{else}
				0 (S.L.empty_02)
			{endif}
		{endif}
		
		(L.L.bottle_visible) 1 =
		{if}
			(L.L.motortuer_pos) 0.08 <
			{if}
				0.08 (S.L.motortuer_pos)
				(L.L.motortuer_speed) /-/ 0.1 * 0.2 min (S.L.motortuer_speed) 
			{endif}
		{endif}
	{endif}

	(L.L.motortuer_pos) 0 > (L.L.motortuer_open) ! &&
	{if}
		1 (S.L.motortuer_open)
	{endif}

	(L.L.motortuer_pos) 0 = (L.L.motortuer_open) &&
	{if}
		(T.L.ev_motortuer_cls)
		0 (S.L.motortuer_open)
        {endif}
        (L.L.motortuer_pos) (F.L.motortuer_mehamizm_trans) 
        (S.L.motortuer_mehamizm_trans)
        {endif}
        (L.L.motortuer_pos) (F.L.motortuer_mehamizm_rot) 
        (S.L.motortuer_mehamizm_rot)
	{endif}

	(L.L.bagaznik1_pos) 0.1 >
	{if}
	(L.L.bagaznik1_speed) abs (S.L.bagaznik1_volcurve)
'		(L.L.bagaznik1_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik1_volcurve)
'		{else}
'			l0 (S.L.bagaznik1_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik1_dragged) !
	{if}
		(L.L.bagaznik1_pos) (L.S.Timegap) (L.L.bagaznik1_speed) * + (S.L.bagaznik1_pos)
		
		(L.L.bagaznik1_pos) 0.35 >
		{if}
			(L.L.bagaznik1_speed) (L.S.Timegap) + (S.L.bagaznik1_speed)
		{endif}
		
		(L.L.bagaznik1_pos) 0.35 <
		{if}
			(L.L.bagaznik1_speed) (L.S.Timegap) -1 * + (S.L.bagaznik1_speed)
		{endif}

		(L.L.bagaznik1_pos) 1 >
		{if}
			1 (S.L.bagaznik1_pos)
			(L.L.bagaznik1_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik1_speed)
		{endif}
		(L.L.bagaznik1_pos) 0 <
		{if}
			0 (S.L.bagaznik1_speed) (S.L.bagaznik1_pos)
		{endif}
	
		(L.L.bagaznik1_speed) 0 = !
		{if}
			(L.L.bagaznik1_pos) 0.005 < (L.L.bagaznik1_pos) 0.995 > ||
			{if}

		(L.L.empty_04) 1 <
				{if}
					(L.L.empty_04) (L.S.Timegap) + (S.L.empty_04)
				{else}
					0 (S.L.bagaznik1_speed)
				{endif}
			{else}
				0 (S.L.empty_04)
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik1_pos) 0 > (L.L.bagaznik1_open) ! &&
	{if}
		1 (S.L.bagaznik1_open)
	{endif}

	(L.L.bagaznik1_pos) 0 = (L.L.bagaznik1_open) &&
	{if}
		(T.L.ev_bagaznik1_cls)
		0 (S.L.bagaznik1_open)
	{endif}

	(L.L.bagaznik2_pos) 0.1 >
	{if}
	(L.L.bagaznik2_speed) abs (S.L.bagaznik2_volcurve)
'		(L.L.bagaznik2_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik2_volcurve)
'		{else}
'			l0 (S.L.bagaznik2_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik2_dragged) !
	{if}
		(L.L.bagaznik2_pos) (L.S.Timegap) (L.L.bagaznik2_speed) * + (S.L.bagaznik2_pos)
		
		(L.L.bagaznik2_pos) 0.35 >
		{if}
			(L.L.bagaznik2_speed) (L.S.Timegap) + (S.L.bagaznik2_speed)
		{endif}
		
		(L.L.bagaznik2_pos) 0.35 <
		{if}
			(L.L.bagaznik2_speed) (L.S.Timegap) -1 * + (S.L.bagaznik2_speed)
		{endif}

		(L.L.bagaznik2_pos) 1 >
		{if}
			1 (S.L.bagaznik2_pos)
			(L.L.bagaznik2_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik2_speed)
		{endif}
		(L.L.bagaznik2_pos) 0 <
		{if}
			0 (S.L.bagaznik2_speed) (S.L.bagaznik2_pos)
		{endif}
	
		(L.L.bagaznik2_speed) 0 = !
		{if}
			(L.L.bagaznik2_pos) 0.005 < (L.L.bagaznik2_pos) 0.995 > ||
			{if}

		(L.L.empty_05) 1 <
				{if}
					(L.L.empty_05) (L.S.Timegap) + (S.L.empty_05)
				{else}
					0 (S.L.bagaznik2_speed)
				{endif}
			{else}
				0 (S.L.empty_05)
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik2_pos) 0 > (L.L.bagaznik2_open) ! &&
	{if}
		1 (S.L.bagaznik2_open)
	{endif}

	(L.L.bagaznik2_pos) 0 = (L.L.bagaznik2_open) &&
	{if}
		(T.L.ev_bagaznik2_cls)
		0 (S.L.bagaznik2_open)
	{endif}

	(L.L.bagaznik3_pos) 0.1 >
	{if}
	(L.L.bagaznik3_speed) abs (S.L.bagaznik3_volcurve)
'		(L.L.bagaznik3_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik3_volcurve)
'		{else}
'			l0 (S.L.bagaznik3_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik3_dragged) !
	{if}
		(L.L.bagaznik3_pos) (L.S.Timegap) (L.L.bagaznik3_speed) * + (S.L.bagaznik3_pos)
		
		(L.L.bagaznik3_pos) 0.35 >
		{if}
			(L.L.bagaznik3_speed) (L.S.Timegap) + (S.L.bagaznik3_speed)
		{endif}
		
		(L.L.bagaznik3_pos) 0.35 <
		{if}
			(L.L.bagaznik3_speed) (L.S.Timegap) -1 * + (S.L.bagaznik3_speed)
		{endif}

		(L.L.bagaznik3_pos) 1 >
		{if}
			1 (S.L.bagaznik3_pos)
			(L.L.bagaznik3_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik3_speed)
		{endif}
		(L.L.bagaznik3_pos) 0 <
		{if}
			0 (S.L.bagaznik3_speed) (S.L.bagaznik3_pos)
		{endif}
	
		(L.L.bagaznik3_speed) 0 = !
		{if}
			(L.L.bagaznik3_pos) 0.005 < (L.L.bagaznik3_pos) 0.995 > ||
			{if}

		(L.L.empty_06) 1 <
				{if}
					(L.L.empty_06) (L.S.Timegap) + (S.L.empty_06)
				{else}
					0 (S.L.bagaznik3_speed)
				{endif}
			{else}
				0 (S.L.empty_06)
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik3_pos) 0 > (L.L.bagaznik3_open) ! &&
	{if}
		1 (S.L.bagaznik3_open)
	{endif}

	(L.L.bagaznik3_pos) 0 = (L.L.bagaznik3_open) &&
	{if}
		(T.L.ev_bagaznik3_cls)
		0 (S.L.bagaznik3_open)
	{endif}

	(L.L.bagaznik4_pos) 0.1 >
	{if}
	(L.L.bagaznik4_speed) abs (S.L.bagaznik4_volcurve)
'		(L.L.bagaznik4_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik4_volcurve)
'		{else}
'			l0 (S.L.bagaznik4_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik4_dragged) !
	{if}
		(L.L.bagaznik4_pos) (L.S.Timegap) (L.L.bagaznik4_speed) * + (S.L.bagaznik4_pos)
		
		(L.L.bagaznik4_pos) 0.35 >
		{if}
			(L.L.bagaznik4_speed) (L.S.Timegap) + (S.L.bagaznik4_speed)
		{endif}
		
		(L.L.bagaznik4_pos) 0.35 <
		{if}
			(L.L.bagaznik4_speed) (L.S.Timegap) -1 * + (S.L.bagaznik4_speed)
		{endif}

		(L.L.bagaznik4_pos) 1 >
		{if}
			1 (S.L.bagaznik4_pos)
			(L.L.bagaznik4_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik4_speed)
		{endif}
		(L.L.bagaznik4_pos) 0 <
		{if}
			0 (S.L.bagaznik4_speed) (S.L.bagaznik4_pos)
		{endif}
	
		(L.L.bagaznik4_speed) 0 = !
		{if}
			(L.L.bagaznik4_pos) 0.005 < (L.L.bagaznik4_pos) 0.995 > ||
			{if}

		(L.L.empty_07) 1 <
				{if}
					(L.L.empty_07) (L.S.Timegap) + (S.L.empty_07)
				{else}
					0 (S.L.bagaznik4_speed)
				{endif}
			{else}
				0 (S.L.empty_07)
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik4_pos) 0 > (L.L.bagaznik4_open) ! &&
	{if}
		1 (S.L.bagaznik3_open)
	{endif}

	(L.L.bagaznik4_pos) 0 = (L.L.bagaznik4_open) &&
	{if}
		(T.L.ev_bagaznik4_cls)
		0 (S.L.bagaznik4_open)
	{endif}

	(L.L.bagaznik5_pos) 0.1 >
	{if}
	(L.L.bagaznik5_speed) abs (S.L.bagaznik5_volcurve)
'		(L.L.bagaznik5_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik5_volcurve)
'		{else}
'			l0 (S.L.bagaznik5_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik5_dragged) !
	{if}
		(L.L.bagaznik5_pos) (L.S.Timegap) (L.L.bagaznik5_speed) * + (S.L.bagaznik5_pos)
		
		(L.L.bagaznik5_pos) 0.35 >
		{if}
			(L.L.bagaznik5_speed) (L.S.Timegap) + (S.L.bagaznik5_speed)
		{endif}
		
		(L.L.bagaznik5_pos) 0.35 <
		{if}
			(L.L.bagaznik5_speed) (L.S.Timegap) -1 * + (S.L.bagaznik5_speed)
		{endif}

		(L.L.bagaznik5_pos) 1 >
		{if}
			1 (S.L.bagaznik5_pos)
			(L.L.bagaznik5_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik5_speed)
		{endif}
		(L.L.bagaznik5_pos) 0 <
		{if}
			0 (S.L.bagaznik5_speed) (S.L.bagaznik5_pos)
		{endif}
	
		(L.L.bagaznik5_speed) 0 = !
		{if}
			(L.L.bagaznik5_pos) 0.005 < (L.L.bagaznik5_pos) 0.995 > ||
			{if}

		(L.L.empty_08) 1 <
				{if}
					(L.L.empty_08) (L.S.Timegap) + (S.L.empty_08)
				{else}
					0 (S.L.bagaznik5_speed)
				{endif}
			{else}
				0 (S.L.empty_08)
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik5_pos) 0 > (L.L.bagaznik5_open) ! &&
	{if}
		1 (S.L.bagaznik5_open)
	{endif}

	(L.L.bagaznik5_pos) 0 = (L.L.bagaznik5_open) &&
	{if}
		(T.L.ev_bagaznik5_cls)
		0 (S.L.bagaznik5_open)
	{endif}

	(L.L.bagaznik6_pos) 0.1 >
	{if}
	(L.L.bagaznik6_speed) abs (S.L.bagaznik6_volcurve)
'		(L.L.bagaznik6_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik6_volcurve)
'		{else}
'			l0 (S.L.bagaznik6_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik6_dragged) !
	{if}
		(L.L.bagaznik6_pos) (L.S.Timegap) (L.L.bagaznik6_speed) * + (S.L.bagaznik6_pos)
		
		(L.L.bagaznik6_pos) 0.35 >
		{if}
			(L.L.bagaznik6_speed) (L.S.Timegap) + (S.L.bagaznik6_speed)
		{endif}
		
		(L.L.bagaznik6_pos) 0.35 <
		{if}
			(L.L.bagaznik6_speed) (L.S.Timegap) -1 * + (S.L.bagaznik6_speed)
		{endif}

		(L.L.bagaznik6_pos) 1 >
		{if}
			1 (S.L.bagaznik6_pos)
			(L.L.bagaznik6_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik6_speed)
		{endif}
		(L.L.bagaznik6_pos) 0 <
		{if}
			0 (S.L.bagaznik6_speed) (S.L.bagaznik6_pos)
		{endif}
	
		(L.L.bagaznik6_speed) 0 = !
		{if}
			(L.L.bagaznik6_pos) 0.005 < (L.L.bagaznik6_pos) 0.995 > ||
			{if}

		(L.L.empty_01) 1 <
				{if}
					(L.L.empty_01) (L.S.Timegap) + (S.L.empty_01)
				{else}
					0 (S.L.bagaznik6_speed)
				{endif}
			{else}
				0 (S.L.empty_01)
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik6_pos) 0 > (L.L.bagaznik6_open) ! &&
	{if}
		1 (S.L.bagaznik6_open)
	{endif}

	(L.L.bagaznik6_pos) 0 = (L.L.bagaznik6_open) &&
	{if}
		(T.L.ev_bagaznik6_cls)
		0 (S.L.bagaznik6_open)
	{endif}

	(L.L.bagaznik7_pos) 0.1 >
	{if}
	(L.L.bagaznik7_speed) abs (S.L.bagaznik7_volcurve)
'		(L.L.bagaznik7_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik7_volcurve)
'		{else}
'			l0 (S.L.bagaznik7_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik7_dragged) !
	{if}
		(L.L.bagaznik7_pos) (L.S.Timegap) (L.L.bagaznik7_speed) * + (S.L.bagaznik7_pos)
		
		(L.L.bagaznik7_pos) 0.35 >
		{if}
			(L.L.bagaznik7_speed) (L.S.Timegap) + (S.L.bagaznik7_speed)
		{endif}
		
		(L.L.bagaznik7_pos) 0.35 <
		{if}
			(L.L.bagaznik7_speed) (L.S.Timegap) -1 * + (S.L.bagaznik7_speed)
		{endif}

		(L.L.bagaznik7_pos) 1 >
		{if}
			1 (S.L.bagaznik7_pos)
			(L.L.bagaznik7_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik7_speed)
		{endif}
		(L.L.bagaznik7_pos) 0 <
		{if}
			0 (S.L.bagaznik7_speed) (S.L.bagaznik7_pos)
		{endif}
	
		(L.L.bagaznik7_speed) 0 = !
		{if}
			(L.L.bagaznik7_pos) 0.005 < (L.L.bagaznik7_pos) 0.995 > ||
			{if}

		(L.L.empty_03) 1 <
				{if}
					(L.L.empty_03) (L.S.Timegap) + (S.L.empty_03)
				{else}
					0 (S.L.bagaznik7_speed)
				{endif}
			{else}
				0 (S.L.empty_03)
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik7_pos) 0 > (L.L.bagaznik7_open) ! &&
	{if}
		1 (S.L.bagaznik7_open)
	{endif}

	(L.L.bagaznik7_pos) 0 = (L.L.bagaznik7_open) &&
	{if}
		(T.L.ev_bagaznik7_cls)
		0 (S.L.bagaznik7_open)
	{endif}
{end}

{macro:ampermetr_frame}
	(L.L.elec_busbar_main) 0 =
	{if}
		(L.L.elec_V_battery) 0.8 <
		{if}
			1 (S.L.light_battery)
		{else}
			0 (S.L.light_battery)
		{endif}
		(L.L.elec_V_battery)  s0
	{else}
		0 s0
		0 (S.L.light_battery)
	{endif}	

	(L.L.cockpit_ampermetr) s1
	5 s2
	5 s3
	l1 (S.L.cockpit_ampermetr)
{end}	

{macro:engine_shkiv_frame}
         (L.L.engine_n) 0 >
	   {if}
		(L.L.cp_engine_shkiv) (L.L.engine_n) (L.S.Timegap) * + (S.L.cp_engine_shkiv)
		360 >
		{if}
			(L.L.cp_engine_shkiv) 360 + (S.L.cp_engine_shkiv)		
		{endif}
	{endif}
	(L.L.cp_engine_shkiv) trunc (S.L.cp_engine_shkiv)

{end}

{macro:luki_frame}
	(L.L.cp_luk_1) (L.L.cp_luk_1_full) ||
	(S.L.cp_luk_1_meh)

	(L.L.cp_luk_2) (L.L.cp_luk_2_full) ||
	(S.L.cp_luk_2_meh)
{end}

{macro:extra_frame}
	(L.L.Velocity) 0.01 >
	{if}
	0 (S.L.cp_zapaska) (S.L.cp_zapaska)
{endif}
	(L.L.cp_extra17) 0.1 >
	{if}
	0 (S.L.cp_extra15) (S.L.cp_extra15)
{endif}
(L.L.cp_fan) 1 =
		{if}
			(L.L.speed) 5 <
			{if}
				(L.L.speed) (L.S.Timegap) + (S.L.speed)
			{endif}
			(L.L.speed) (F.L.speed) (S.L.spd)
		{endif}
	(L.L.cp_fan) 0 =
		{if}
			(L.L.speed) 0 >
			{if}
				(L.L.speed) (L.S.Timegap) - (S.L.speed)
			{endif}
			(L.L.speed) (F.L.speed_off) (S.L.spd)
		{endif}
	(L.L.cp_fan_spd) 1 =
			{if}
				(L.L.spd) 2 * (S.L.spd)
			{endif}
	(M.L.cp_rotor)
{endif}
{end}

{macro:cp_rotor}
	(L.L.Rotor) (L.S.Timegap) (L.L.spd) * + (S.L.Rotor)
{end}

{macro:windows_frame}

'---------------------------------------------------- Ēąļīņåāąķčå ėåāīé ļīėīāčķźč

	(L.S.Weather_Temperature) 10 <
	(L.L.Rain_Window_Norm_Wetness) ||
	{if}
		(L.S.Weather_Temperature) 0 >
		{if}
			(L.L.Glass_pot) (L.S.Timegap) 0.05 * + 0.8 min (S.L.Glass_pot)
			(L.L.cp_kn_obduv_lob_L) (L.L.elec_busbar_main) &&
			{if}
				(L.L.Glass_pot_front) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front)
				(L.L.Glass_pot_front_noObduv) (L.S.Timegap) 0.001 * - 0 max (S.L.Glass_pot_front_noObduv)
			{else}
				(L.L.Glass_pot_front) (L.S.Timegap) 0.05 * + 1 min (S.L.Glass_pot_front)
				(L.L.Glass_pot_front_noObduv) (L.S.Timegap) 0.05 * + 1 min (S.L.Glass_pot_front_noObduv)
			{endif}
		{endif}
	{else}
		(L.L.cp_kn_obduv_lob_L) (L.L.elec_busbar_main) &&
		{if}
			(L.L.Glass_pot_front) (L.S.Timegap) 0.05 * - 0 max (S.L.Glass_pot_front)
		{else}
			(L.L.Glass_pot_front) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front)
		{endif}
		(L.L.Glass_pot) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot)
		(L.L.Glass_pot_front_noObduv) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front_noObduv)
	{endif}

'---------------------------------------------------- Ēąļīņåāąķčå ļšąāīé ļīėīāčķźč

	(L.S.Weather_Temperature) 10 <
	(L.L.Rain_Window_Norm_Wetness) ||
	{if}
		(L.S.Weather_Temperature) 0 >
		{if}
			(L.L.Glass_pot) (L.S.Timegap) 0.05 * + 0.8 min (S.L.Glass_pot)
			(L.L.cp_kn_obduv_lob_P) (L.L.elec_busbar_main) &&
			{if}
				(L.L.Glass_pot_front_1) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front_1)
				(L.L.Glass_pot_front_noObduv_1) (L.S.Timegap) 0.001 * - 0 max (S.L.Glass_pot_front_noObduv_1)
			{else}
				(L.L.Glass_pot_front_1) (L.S.Timegap) 0.05 * + 1 min (S.L.Glass_pot_front_1)
				(L.L.Glass_pot_front_noObduv_1) (L.S.Timegap) 0.05 * + 1 min (S.L.Glass_pot_front_noObduv_1)
			{endif}
		{endif}
	{else}
		(L.L.cp_kn_obduv_lob_P) (L.L.elec_busbar_main) &&
		{if}
			(L.L.Glass_pot_front_1) (L.S.Timegap) 0.05 * - 0 max (S.L.Glass_pot_front_1)
		{else}
			(L.L.Glass_pot_front_1) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front_1)
		{endif}
		(L.L.Glass_pot) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot)
		(L.L.Glass_pot_front_noObduv_1) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front_noObduv_1)
	{endif}

'---------------------------------------------------- Ēąģåšēąķčå ėåāīé ļīėīāčķźč
	
	(L.S.Weather_Temperature) 0 <
	{if}
		(L.L.Glass_ice) (L.S.Timegap) 0.01 * + 1 min (S.L.Glass_ice)
		(L.L.Glass_pot) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot)
		(L.L.Glass_pot_front) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front)
		(L.L.Glass_pot_front_noObduv) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front_noObduv)
		
		(L.L.cp_kn_obduv_lob_L) (L.L.elec_busbar_main) &&
		{if}
			(L.L.Glass_ice_front) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice_front)
			(L.L.Glass_ice_front_noObduv) (L.S.Timegap) 0.005 * - 0 max (S.L.Glass_ice_front_noObduv)
		{else}
			(L.L.Glass_ice_front) (L.S.Timegap) 0.01 * + 1 min (S.L.Glass_ice_front)
			(L.L.Glass_ice_front_noObduv) (L.S.Timegap) 0.01 * + 1 min (S.L.Glass_ice_front_noObduv)
		{endif}
	{else}
		(L.L.Glass_ice) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice)
		(L.L.cp_kn_obduv_lob_L) (L.L.elec_busbar_main) &&
		{if}
			(L.L.Glass_ice_front) (L.S.Timegap) 0.05 * - 0 max (S.L.Glass_ice_front)
			(L.L.Glass_ice_front_noObduv) (L.S.Timegap) 0.02 * - 0 max (S.L.Glass_ice_front_noObduv)
		{else}
			(L.L.Glass_ice_front) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice_front)
			(L.L.Glass_ice_front_noObduv) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice_front_noObduv)
		{endif}
	{endif}

'---------------------------------------------------- Ēąģåšēąķčå ļšąāīé ļīėīāčķźč

	(L.S.Weather_Temperature) 0 <
	{if}
		(L.L.Glass_ice) (L.S.Timegap) 0.01 * + 1 min (S.L.Glass_ice)
		(L.L.Glass_pot) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot)
		(L.L.Glass_pot_front_1) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front_1)
		(L.L.Glass_pot_front_noObduv_1) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front_noObduv_1)
		
		(L.L.cp_kn_obduv_lob_P) (L.L.elec_busbar_main) &&
		{if}
			(L.L.Glass_ice_front_1) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice_front_1)
			(L.L.Glass_ice_front_noObduv_1) (L.S.Timegap) 0.005 * - 0 max (S.L.Glass_ice_front_noObduv_1)
		{else}
			(L.L.Glass_ice_front_1) (L.S.Timegap) 0.01 * + 1 min (S.L.Glass_ice_front_1)
			(L.L.Glass_ice_front_noObduv_1) (L.S.Timegap) 0.01 * + 1 min (S.L.Glass_ice_front_noObduv_1)
		{endif}
	{else}
		(L.L.Glass_ice) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice)
		(L.L.cp_kn_obduv_lob_P) (L.L.elec_busbar_main) &&
		{if}
			(L.L.Glass_ice_front_1) (L.S.Timegap) 0.05 * - 0 max (S.L.Glass_ice_front_1)
			(L.L.Glass_ice_front_noObduv_1) (L.S.Timegap) 0.02 * - 0 max (S.L.Glass_ice_front_noObduv_1)
		{else}
			(L.L.Glass_ice_front_1) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice_front_1)
			(L.L.Glass_ice_front_noObduv_1) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice_front_noObduv_1)
		{endif}
	{endif}
'----------------------------------------------------
{end}