<?xml version="1.0" encoding="UTF-8"?>

<!--
	Main instrument model layer structure, from front to back:
	- dg.glass
	- dg.bug.hdg
	- dg.compass
	- dg.case

	There are also dg.knob.hdg and dg.knob.offset knobs to the sides.
-->

<PropertyList>

	<path>dg.ac</path>

	<effect>
		<inherits-from>../../Effects/interior/instrument-glass</inherits-from>
		<object-name>dg.glass</object-name>
	</effect>

	<animation>
		<type>material</type>
		<object-name>dg.compass</object-name>
		<object-name>dg.bug.hdg</object-name>
		<emission>
			<factor-prop>systems/electrical/outputs/instrument-lights</factor-prop>
			<red>   0.07 </red>
			<green> 0.04 </green>
			<blue>  0.04 </blue>
		</emission>
	</animation>

	<animation>
		<type>rotate</type>
		<object-name>dg.compass</object-name>
		<property>instrumentation/heading-indicator/indicated-heading-deg</property>
		<factor>-1</factor>
		<axis>
			<x> -1 </x>
			<y>  0 </y>
			<z>  0 </z>
		</axis>
	</animation>

	<animation>
		<type>rotate</type>
		<object-name>dg.bug.hdg</object-name>
		<property>instrumentation/heading-indicator/indicated-heading-deg</property>
		<factor>-1</factor>
		<axis>
			<x> -1 </x>
			<y>  0 </y>
			<z>  0 </z>
		</axis>
	</animation>

	<animation>
		<type>rotate</type>
		<object-name>dg.bug.hdg</object-name>
		<property>autopilot/settings/heading-bug-deg</property>
		<axis>
			<x> -1 </x>
			<y>  0 </y>
			<z>  0 </z>
		</axis>
	</animation>

	<!-- Heading Bug control -->
	<animation>
		<type>knob</type>
		<object-name>dg.knob.hdg</object-name>
		<property>autopilot/settings/heading-bug-deg</property>
		<factor>6</factor>
		<axis>
			<x> -1 </x>
			<y>  0 </y>
			<z>  0 </z>
		</axis>
		<center>
			<x-m>  0        </x-m>
			<y-m>  0.031892 </y-m>
			<z-m> -0.032252 </z-m>
		</center>
		<action>
			<binding>
				<command>property-adjust</command>
				<property>autopilot/settings/heading-bug-deg</property>
				<factor>1</factor>
				<min>    0 </min>
				<max>  360 </max> <!-- TODO: check these values!! (0..359?) -->
				<!-- min>    1 </min>
				<max>  361 </max --> <!-- TODO: check these values!! (0..359?) -->
				<wrap>true</wrap>
			</binding>
		</action>
		<hovered>
			<binding>
				<command>set-tooltip</command>
				<tooltip-id>dg-bug</tooltip-id>
				<mapping>heading</mapping>
				<label>Heading Bug: %3d</label>
				<property>autopilot/settings/heading-bug-deg</property>
			</binding>
		</hovered>
	</animation>

	<!-- Heading Offset -->
	<animation>
		<type>knob</type>
		<object-name>dg.knob.offset</object-name>
		<property>instrumentation/heading-indicator/offset-deg</property>
		<factor>6</factor>
		<axis>
			<x> -1 </x>
			<y>  0 </y>
			<z>  0 </z>
		</axis>
		<center>
			<x-m>  0        </x-m>
			<y-m> -0.031892 </y-m>
			<z-m> -0.032252 </z-m>
		</center>
		<action>
			<binding>
				<command>property-adjust</command>
				<property>instrumentation/heading-indicator/offset-deg</property>
				<factor>1</factor>
				<min>    0 </min>
				<max>  360 </max> <!-- TODO: check these values!! (0..359?) -->
				<!-- min>    1 </min>
				<max>  361 </max --> <!-- TODO: check these values!! (0..359?) -->
				<wrap>true </wrap>
			</binding>
		</action>
		<hovered>
			<binding>
				<command>set-tooltip</command>
				<tooltip-id>dg-offset</tooltip-id>
				<mapping>heading</mapping>
				<label>Indicated heading: %3d</label>
				<property>instrumentation/heading-indicator/indicated-heading-deg</property>
			</binding>
		</hovered>
	</animation>

</PropertyList>
