<?xml version="1.0"?>
<!--
************************************************************************
Yasim Schulgleiter SG38
2016 D-ECHO
Yasim Schhleicher ASK 13 Glider
copyright 2010 Patrice Poly
************************************************************************
-->
<PropertyList>
	<sim>
		<description>Schulgleiter SG38</description>
		<author>D-ECHO based on ASK13 by Patrice Poly</author>
		<status>early production</status>
		<rating>
			<FDM type="int">3</FDM>
			<systems type="int">5</systems>
			<!--no systems (electrical/hydraulic etc) present in the real aircraft-->
			<cockpit type="int">3</cockpit>
			<model type="int">3</model>
		</rating>
		<status>early-production</status>
		<aircraft-version>201611</aircraft-version>
		<long-description>
			The "Schulgleiter SG38" is a minimalistic pilot training aircraft first built in the 1930's by Schneider and Hoffmann from the aviation company Schneider in Grunau. It has a glide number of 8. Today there are only a few ones left.
		</long-description>
		<de>
			<long-description>
				Der "Schulgleiter SG38" ist ein minimalistisches Schulungsflugzeug, das erstmals in den 1930ern von den Konstrukteuren Schneider und Hoffmann der Firma Schneider in Grunau gebaut wurde. Mit einer Gleitzahl von 8 liegt weit unter heutigen Segelflugzeugstandarten. Es sind heutzutage nur noch wenige Exemplare &#xFC;brig.
			</long-description>
		</de>
		<tags>
			<tag>glider</tag>
			<tag>1930s</tag>
			<tag>1940s</tag>
			<tag>1950s</tag>
			<tag>fixed-gear</tag>
			<tag>unpowered</tag>
			<tag>trainer</tag>
		</tags>
		<flight-model archive="y">yasim</flight-model>
		<aero archive="y">sg38</aero>
		<startup>
			<splash-texture>Aircraft/SG38/splash.png</splash-texture>
		</startup>
		<model>
			<path archive="y">Aircraft/SG38/Models/sg38.xml</path>
		</model>
		<sound>
			<path>Aircraft/SG38/Sounds/sound.xml</path>
		</sound>
		<weight n="0">
			<name type="string">Pilot</name>
			<weight-lb type="double">170</weight-lb>
			<max-lb type="int">200</max-lb>
			<min-lb type="int">0</min-lb>
		</weight>
		<help>
			<title>Schneider-Grunau SG38 Schulgleiter </title>
			<key>
				<name>Ctrl-w</name>
				<desc>Place winch 1000m in front of aircraft</desc>
			</key>
			<key>
				<name>W</name>
				<desc>Toggle winch hook</desc>
			</key>
			<key>
				<name>w</name>
				<desc>Increase winch speed</desc>
			</key>
			<key>
				<name>Ctrl-o</name>
				<desc>Find aircraft for aerotow</desc>
			</key>
			<key>
				<name>o</name>
				<desc>Lock aerotow hook</desc>
			</key>
			<key>
				<name>O</name>
				<desc>Open aerotow hook</desc>
			</key>
			<text>
                    === General Help ===
                    - "Throttle" axis (or throttle keys) are connected to the glider's airbrake.
                    - You can take off using a winch or use another aircraft as an aerotow.
                    - The Walker uses e (E) and d(D) for walking instead of w and s!!!!

                    === Winch Takeoff Procedure ===
                    1. Retract speed brake (full "throttle")
                    2. Press Ctrl-w to place winch.
                    3. Press Shift-w to start winching.
                    4. Control the winch speed throughout the entire launch. Shift-w makes the winch run faster, w makes it run slower.
                    5. Keep wings level and gently lift the nose to take off once above the stall speed.
                    6. When at appropriate alitude, press 'o' to release the cable.
                    7. Fly!

                    === Aerotow Takeoff Procedure ===
                    1. Retract speed brake (full "throttle")
                    2. Place another aerotow aircraft in front of your glider (multi-player).
                    3. Press 'o' to hook to the aerotow.
                    4. Ask the other aircraft to take off :).
                    5. Keep wings level and follow the aircraft until after takeoff..
                    6. When at appropriate alitude, press 'o' to release the cable.
                    7. Fly!

                    === Ground handling ===
                    This aircraft has some features to help with ground handling:

                    - When pressing "Toggle assiting gears" the aircraft gets levelled around the x-axes as if someone was holding your wing.
                    - When pressing "Toggle ground handling", two features are enanled to pull the aircraft around on the ground:
                    1. All rudder inputs are copied to a thruster, as if someone was pulling your wing so the aircraft turns.
                    2. All throttle inputs cause your aircraft to taxi, as if someone (or a car) was pulling/pushing it.
                    When there is somebody with a follow-me around, you can connect to it by pressing Ctrl+o (release: Ctrl+shift+o) so he can carry you around the airport
                    or even tow you into the air! (also check the Aerotow Settings therefore).
            </text>
		</help>
		<menubar>
			<default>
				<menu n="10">
					<label>SG38</label>
					<enabled type="bool">true</enabled>
					<item>
						<label>Aerotow Settings</label>
						<binding>
							<command>nasal</command>
							<script>sg38.aerotow_dialog.open()</script>
						</binding>
					</item>
					<item>
						<label>Winch Settings</label>
						<binding>
							<command>nasal</command>
							<script>sg38.winch_dialog.open()</script>
						</binding>
					</item>
					<item>
						<label>Ground services</label>
						<binding>
							<command>nasal</command>
							<script>sg38.groundservice_dialog.open()</script>
						</binding>
					</item>
					<item>
						<label>Options</label>
						<binding>
							<command>nasal</command>
							<script>sg38.options_dialog.open()</script>
						</binding>
					</item>
				</menu>
			</default>
		</menubar>
		<!-- hide the 2D panel -->
		<panel>
			<visibility archive="y">false</visibility>
		</panel>
		<!-- position the pilot viewpoint and angle -->
		<view n="0">
			<name>Default</name>
			<type>lookfrom</type>
			<internal type="bool">true</internal>
			<config>
				<from-model type="bool">true</from-model>
				<from-model-idx type="int">0</from-model-idx>
				<x-offset-m archive="y">0</x-offset-m>
				<y-offset-m archive="y">0</y-offset-m>
				<z-offset-m archive="y">-2</z-offset-m>
				<pitch-offset-deg>-10</pitch-offset-deg>
				<default-field-of-view-deg>60.0</default-field-of-view-deg>
				<limits>
					<enabled type="bool">true</enabled>
					<left>
						<heading-max-deg type="double">160</heading-max-deg>
						<x-offset-max-m type="double">0.15</x-offset-max-m>
						<x-offset-threshold-deg type="double">65</x-offset-threshold-deg>
					</left>
					<right>
						<heading-max-deg type="double">160</heading-max-deg>
						<x-offset-max-m type="double">0.15</x-offset-max-m>
						<x-offset-threshold-deg type="double">65</x-offset-threshold-deg>
					</right>
				</limits>
			</config>
		</view>
		<view n="101">
			<name>Tail Camera</name>
			<type>lookfrom</type>
			<internal type="bool">true</internal>
			<config>
				<from-model type="bool">true</from-model>
				<from-model-idx type="int">0</from-model-idx>
				<x-offset-m archive="y">0</x-offset-m>
				<y-offset-m archive="y">1</y-offset-m>
				<z-offset-m archive="y">2.42</z-offset-m>
				<pitch-offset-deg>-10</pitch-offset-deg>
				<default-field-of-view-deg>120</default-field-of-view-deg>
				<limits>
					<enabled type="bool">true</enabled>
					<left>
						<heading-max-deg type="double">95</heading-max-deg>
						<x-offset-max-m type="double">0.10</x-offset-max-m>
						<x-offset-threshold-deg type="double">65</x-offset-threshold-deg>
					</left>
					<right>
						<heading-max-deg type="double">95</heading-max-deg>
						<x-offset-max-m type="double">0.10</x-offset-max-m>
						<x-offset-threshold-deg type="double">65</x-offset-threshold-deg>
					</right>
				</limits>
			</config>
		</view>
		<view n="102">
			<name>Left Wing Camera</name>
			<type>lookfrom</type>
			<internal type="bool">true</internal>
			<config>
				<from-model type="bool">true</from-model>
				<from-model-idx type="int">0</from-model-idx>
				<x-offset-m archive="y">-3.8</x-offset-m>
				<y-offset-m archive="y">0.35</y-offset-m>
				<z-offset-m archive="y">-2.15</z-offset-m>
				<default-field-of-view-deg>120</default-field-of-view-deg>
				<heading-offset-deg>-50</heading-offset-deg>
				<limits>
					<enabled type="bool">true</enabled>
					<left>
						<heading-max-deg type="double">95</heading-max-deg>
						<x-offset-max-m type="double">0.10</x-offset-max-m>
						<x-offset-threshold-deg type="double">65</x-offset-threshold-deg>
					</left>
					<right>
						<heading-max-deg type="double">95</heading-max-deg>
						<x-offset-max-m type="double">0.10</x-offset-max-m>
						<x-offset-threshold-deg type="double">65</x-offset-threshold-deg>
					</right>
				</limits>
			</config>
		</view>
		<view n="1">
			<config>
				<target-y-offset-m archive="y" type="double">0.36404</target-y-offset-m>
				<target-z-offset-m archive="y" type="double">-1.26444</target-z-offset-m>
			</config>
		</view>
		<view n="2">
			<config>
				<target-y-offset-m archive="y" type="double">0.36404</target-y-offset-m>
				<target-z-offset-m archive="y" type="double">-1.26444</target-z-offset-m>
			</config>
		</view>
		<view n="3">
			<config>
				<target-y-offset-m archive="y" type="double">0.36404</target-y-offset-m>
				<target-z-offset-m archive="y" type="double">-1.26444</target-z-offset-m>
			</config>
		</view>
		<view n="4">
			<config>
				<target-y-offset-m archive="y" type="double">0.36404</target-y-offset-m>
				<target-z-offset-m archive="y" type="double">-1.26444</target-z-offset-m>
			</config>
		</view>
		<view n="5">
			<config>
				<target-y-offset-m archive="y" type="double">0.36404</target-y-offset-m>
				<target-z-offset-m archive="y" type="double">-1.26444</target-z-offset-m>
			</config>
		</view>
		<view n="6">
			<config>
				<target-y-offset-m archive="y" type="double">0.36404</target-y-offset-m>
				<target-z-offset-m archive="y" type="double">-1.26444</target-z-offset-m>
			</config>
		</view>
		<hitches>
			<!-- make sure some properties do exist, when the list for multiplayer transfere is defined-->
			<!-- they need to be in the same value, as they are initilized in the FDM, to get the same values after reset
				    should fix this somehow-->
			<aerotow>
				<tow>
					<length type="float">60</length>
					<elastic-constant type="float">10000</elastic-constant>
					<weight-per-m-kg-m type="float">1</weight-per-m-kg-m>
					<dist type="float">1</dist>
					<connected-to-property-node type="bool"/>
					<brake-force type="float">100000</brake-force>
					<connected-to-ai-or-mp-callsign type="string">*</connected-to-ai-or-mp-callsign>
					<end-force-x type="float">0</end-force-x>
					<end-force-y type="float">0</end-force-y>
					<end-force-z type="float">0</end-force-z>
				</tow>
				<speed-in-tow-direction type="float">0</speed-in-tow-direction>
				<open type="bool">true</open>
				<local-pos-x type="float">0</local-pos-x>
				<local-pos-y type="float">0</local-pos-y>
				<local-pos-z type="float">0</local-pos-z>
				<is-slave type="bool">false</is-slave>
			</aerotow>
		</hitches>
		<flight-recorder>
			<replay-config type="int">0</replay-config>
			<config n="0" include="/Aircraft/Generic/flightrecorder/generic-glider.xml">
				<!-- Add some custom properties -->
				<signal>
					<type>float</type>
					<property type="string">/velocities/groundspeed-kt</property>
				</signal>
				<signal>
					<type>float</type>
					<property type="string">/fdm/jsbsim/aero/alpha-rad[0]</property>
				</signal>
				<signal>
					<type>float</type>
					<property type="string">/accelerations/pilot-g</property>
				</signal>
				<!-- The ASK13 uses some "virtual" gear (contact points).
				     Their "wow" properties need to be recorded. -->
				<signal>
					<type>bool</type>
					<property type="string">/gear/gear[1]/wow</property>
				</signal>
				<signal>
					<type>bool</type>
					<property type="string">/gear/gear[2]/wow</property>
				</signal>
				<signal>
					<type>bool</type>
					<property type="string">/gear/gear[3]/wow</property>
				</signal>
				<signal>
					<type>bool</type>
					<property type="string">/gear/gear[4]/wow</property>
				</signal>
				<signal>
					<type>bool</type>
					<property type="string">/sim/hitches/winch/open</property>
				</signal>
			</config>
		</flight-recorder>
	</sim>
	<controls>
		<cabin>
			<panel type="bool">true</panel>
		</cabin>
		<flight>
			<rear-fairing type="bool">true</rear-fairing>
			<elevator-trim>0.0</elevator-trim>
			<!-- controllable -->
			<spoilers alias="/controls/flight/elevator-trim"/>
			<!-- spoilers is transmitted via mp (elevator-trim is NOT) -->
			<rudder2 type="double">0</rudder2>
		</flight>
		<ground-handling type="bool">false</ground-handling>
		<engines>
			<engine>
				<throttle>1.0</throttle>
			</engine>
		</engines>
		<winch>
			<place type="bool">false</place>
		</winch>
		<aerotow>
			<find-aircraft type="bool">false</find-aircraft>
		</aerotow>
	</controls>
	<input>
		<keyboard>
			<key n="127">
				<name>Delete</name>
				<desc>Toggle Reversers</desc>
				<binding>
					<condition>
						<less-than>
							<property>controls/engines/engine[0]/throttle</property>
							<value>0.1</value>
						</less-than>
					</condition>
					<command>property-toggle</command>
					<property>controls/engines/engine[0]/reverser</property>
				</binding>
			</key>
			<key n="23">
				<name>Ctrl-w</name>
				<desc>Place winch in front of aircraft</desc>
				<binding>
					<command>nasal</command>
					<script>towing.setWinchPositionAuto()</script>
				</binding>
			</key>
			<key n="87">
				<name>W</name>
				<desc>Increase winch speed</desc>
				<binding>
					<command>nasal</command>
					<script>
                                throttle = getprop("/sim/hitches/winch/winch/rel-speed") + 0.05;
                                if (throttle &gt; 1) throttle = 1;
                                setprop("/sim/hitches/winch/winch/rel-speed", throttle);
                                speed = throttle * getprop("/sim/hitches/winch/winch/max-speed-m-s");
                                force = getprop("/sim/hitches/winch/force");
                                gui.popupTip(sprintf("Winch throttle %d%%, speed %0.2f m/s, force %0.2f", throttle * 100, speed, force));
                            </script>
				</binding>
			</key>
			<key n="119">
				<name>w</name>
				<desc>Decrease winch speed</desc>
				<binding>
					<command>nasal</command>
					<script>
                                throttle = getprop("/sim/hitches/winch/winch/rel-speed") - 0.05;
                                if (0 &gt; throttle) throttle = 0;
                                setprop("/sim/hitches/winch/winch/rel-speed", throttle);
                                speed = throttle * getprop("/sim/hitches/winch/winch/max-speed-m-s");
                                force = getprop("/sim/hitches/winch/force");
                                gui.popupTip(sprintf("Winch throttle %d%%, speed %0.2f m/s, force %0.2f", throttle * 100, speed, force));
                            </script>
				</binding>
			</key>
			<key n="15">
				<name>Ctrl-o</name>
				<desc>Find aircraft for aerotow</desc>
				<binding>
					<command>property-assign</command>
					<property>/controls/aerotow/find-aircraft</property>
					<value type="bool">true</value>
				</binding>
				<mod-up>
					<binding>
						<command>property-assign</command>
						<property>/controls/aerotow/find-aircraft</property>
						<value type="bool">false</value>
					</binding>
				</mod-up>
			</key>
			<key n="111">
				<name>o</name>
				<desc>Open hook</desc>
				<binding>
					<command>property-assign</command>
					<property>/sim/hitches/hook-open</property>
					<value type="bool">true</value>
				</binding>
				<binding>
					<command>property-assign</command>
					<property>/sim/hitches/aerotow/open</property>
					<value type="bool">true</value>
				</binding>
				<binding>
					<command>property-assign</command>
					<property>/sim/hitches/winch/open</property>
					<value type="bool">true</value>
				</binding>
				<mod-up>
					<binding>
						<command>property-assign</command>
						<property>/sim/hitches/hook-open</property>
						<value type="bool">false</value>
					</binding>
				</mod-up>
			</key>
		</keyboard>
	</input>
	<nasal>
		<sg38>
			<!--
			<file>Nasal/immat.nas</file>-->
			<file>Nasal/dialogs.nas</file>
			<file>Nasal/groundhandling.nas</file>
			<file>Nasal/jsoverride.nas</file>
		</sg38>
	</nasal>
</PropertyList>
