<?xml version="1.0"?>

<!--
ADF based on ki227 by Torsten Dreyer
-->

<PropertyList>
	
	<!--	KI227/228, copied and adapted from the Cessna 172P for FlightGear	-->
	
	<path>ki227_228.ac</path>
	
	<params>
		<model>instrumentation/adf[0]/model</model>
		<rotation-deg>instrumentation/adf[0]/rotation-deg</rotation-deg>
		<adf-bearing-deg>instrumentation/adf[0]/indicated-bearing-deg</adf-bearing-deg>
		<vor-bearing-deg>instrumentation/nav[0]/radials/reciprocal-radial-deg</vor-bearing-deg>
		<indicated-heading>instrumentation/heading-indicator/indicated-heading-deg</indicated-heading>
	</params>
	
	<effect>
		<inherits-from>../../Effects/interior/instruments/lm-adf</inherits-from>
		<object-name>CompassRose</object-name>
		<object-name>KI227.ADFNeedle</object-name>
		<object-name>HDGSelector</object-name>
		<object-name>CompassRoseCenter</object-name>
		<object-name>Marker</object-name>
		<object-name>Case</object-name>
		<object-name>AircraftSymbol</object-name>
	</effect>
	
	<animation>
		<type>noshadow</type>
	</animation>
	
	<animation>
		<type>material</type>
		<object-name>CompassRose</object-name>
		<object-name>CompassRoseCenter</object-name>
		<object-name>KI227.ADFNeedle</object-name>
		<object-name>Marker</object-name>
		<object-name>Case</object-name>
		<object-name>AircraftSymbol</object-name>
		<condition>
			<or>
				<not>
					<property>/sim/rendering/shaders/skydome</property>
				</not>
				<equals>
					<property>/sim/rendering/shaders/model</property>
					<value>0</value>
				</equals>
			</or>
		</condition>
		<emission>
			<red-prop>/sim/model/material/instruments/default-red-combined-factor</red-prop>
			<green-prop>/sim/model/material/instruments/default-green-combined-factor</green-prop>
			<blue-prop>/sim/model/material/instruments/default-blue-combined-factor</blue-prop>
		</emission>
	</animation>
	
	
	<animation>
		<type>select</type>
		<object-name>KI227.ADFNeedle</object-name>
		<object-name>HDGSelector</object-name>
		<condition>
			<not>
				<equals>
					<property alias="../../../../../params/model"/>
					<value>ki228</value>
				</equals>
			</not>
		</condition>
	</animation>
	
	<animation>
		<type>rotate</type>
		<object-name>CompassRose</object-name>
		<property alias="../../params/rotation-deg"/>
		<condition>
			<not>
				<equals>
					<property alias="../../../../../params/model"/>
					<value>ki228</value>
				</equals>
			</not>
		</condition>
		<factor>-1</factor>
		<axis>
			<x>-1</x>
		</axis>
	</animation>
	
	<animation>
		<type>rotate</type>
		<object-name>CompassRose</object-name>
		<property alias="../../params/indicated-heading"/>
		<condition>
			<equals>
				<property alias="../../../../params/model"/>
				<value>ki228</value>
			</equals>
		</condition>
		<factor>-1</factor>
		<axis>
			<x>-1</x>
		</axis>
	</animation>
	
	<animation>
		<type>rotate</type>
		<object-name>KI227.ADFNeedle</object-name>
		<property alias="../../params/adf-bearing-deg"/>
		<axis>
			<x>-1</x>
		</axis>
	</animation>
	
	<animation>
		<type>knob</type>
		<object-name>HDGSelector</object-name>
		<property alias="../../params/rotation-deg"/>
		<factor>-8.0</factor>
		<axis>
			<x>1.0</x>
		</axis>
		<center>
			<y-m>-0.032231</y-m>
			<z-m>-0.033085</z-m>
		</center>
		<action>
			<binding>
				<command>property-adjust</command>
				<property alias="../../../../params/rotation-deg"/>
				<factor>1</factor>
				<min>0</min>
				<max>360</max>
				<wrap>1</wrap>
			</binding>
		</action>
		<hovered>
			<binding>
				<command>set-tooltip</command>
				<tooltip-id>adf-hdg</tooltip-id>
				<label>ADF Heading: %3d</label>
				<property alias="../../../../params/rotation-deg"/>
			</binding>
		</hovered>
	</animation>
	
	<!-- this needs to be after HDGSelector knob animation, see https://wiki.flightgear.org/Knob_and_Slider_Duplication -->
	<animation>
		<type>material</type>
		<object-name>HDGSelector</object-name>
		<condition>
			<or>
				<not>
					<property>/sim/rendering/shaders/skydome</property>
				</not>
				<equals>
					<property>/sim/rendering/shaders/model</property>
					<value>0</value>
				</equals>
			</or>
		</condition>
		<emission>
			<red-prop>/sim/model/c172p/lighting/rgb-ra-r-factor</red-prop>
			<green-prop>/sim/model/c172p/lighting/rgb-ra-g-factor</green-prop>
			<blue-prop>/sim/model/c172p/lighting/rgb-ra-b-factor</blue-prop>
		</emission>
	</animation>
	
</PropertyList>
