<?xml version="1.0"?>
<!--
************************************************************************
	Schulgleiter SG38 by Benedikt Wolf (D-ECHO) 2016-2023
	based on Yasim Schleicher ASK 13 Glider, copyright 2010 Patrice Poly
************************************************************************
-->
<PropertyList>
	<sim>
		<description>Schulgleiter SG38</description>
		<author>Benedikt Wolf (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>01/2023</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. Its simple design leads to a glide ratio of only 1:8. It carries a dark history, being designed by Nazi Germany for initial flight training, thus contributing to their horrific crimes, which is also the reason that no original liveries will be modelled in order not to embrace this regime.
		</long-description>
		<localized>
			<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 es weit unter der moderner Segelflugzeuge. Es sind heutzutage nur noch wenige Exemplare &#xFC;brig. Die dunkle Seite dieses Flugzeuges ist die Entwicklung während der Zeit des Nationalsozialismus in Deutschland zur Nutzung in der Flugausbildung, womit es einen Teil zu dessen f&#xFC;rchterlichen Verbrechen beigetragen hat. Dies ist auch der Grund dafür, dass keine originalen Lackierungen modelliert werden, um dieses Regime nicht zu verherrlichen.
				</long-description>
			</de>
		</localized>
		<flight-model archive="y">jsb</flight-model>
		<aero archive="y">sg38</aero>
		<model>
			<path archive="y">Aircraft/SG38/Models/sg38.xml</path>
			<pilots-enabled type="bool">1</pilots-enabled>
			<pilots-view-enabled type="bool">0</pilots-view-enabled>
		</model>
		<multiplay>
			<generic>
				<int n="0" alias="/controls/cabin/panel" />
				<int n="1" alias="/controls/flight/rear-fairing" />
			</generic>
		</multiplay>
		<sound>
			<path>Aircraft/SG38/Sounds/sound.xml</path>
		</sound>
		<instrumentation>
			<path>Systems/sg38-instrumentation.xml</path>
		</instrumentation>
		<systems>
			<path>Systems/sg38-systems.xml</path>
			<property-rule n="100">
				<name>Instruments</name>
				<path>Systems/instruments.xml</path>
			</property-rule>
		</systems>
		<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 in front of aircraft and start winch system.</desc>
			</key>
			<key>
				<name>u</name>
				<desc>Stop winch launch. (only possible before "ready" command)</desc>
			</key>
			<key>
				<name>W</name>
				<desc>Increase winch speed</desc>
			</key>
			<key>
				<name>w</name>
				<desc>Decrease 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>
			<key>
				<name>q</name>
				<desc>Show QNH at current pressure</desc>
			</key>
			<key>
				<name>Q</name>
				<desc>Show current wind data</desc>
			</key>
			<text>
				=== General Help ===
				- 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. Press Ctrl-w to place winch and start the launch.
				2. Press Shift-w to start winching.
				3. The speed manages its speed on its own. Should you want to change it, Shift-w makes the winch run faster, w makes it run slower.
				4. Keep wings level and gently lift the nose to take off once above the stall speed.
				5. When at appropriate alitude, the cable will automatically release. If it doesn't, press 'O' to release the cable.
				6. Once you hear the cable releasing, open the hook three times (press 'O') to ensure the cable is out.
				7. Fly!

				=== Aerotow Takeoff Procedure ===
				1. Place another aerotow aircraft in front of your glider (multi-player).
				2. Press 'Ctrl-o' to hook to the aerotow.
				3. Ask the other aircraft to take off :).
				4. Keep wings level and follow the aircraft until after takeoff..
				5. Follow the aircraft in air, trying to keep behind it and slightly above it.
				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>
		<!-- ref. https://www.bwlv.de/jugend/schulgleiter-38-sg38/technisches.html -->
		<hitches>
			<aerotow>
				<force_name_jsbsim type="string">hitch</force_name_jsbsim>
				<force-is-calculated-by-other type="bool">false</force-is-calculated-by-other>
				<mp-auto-connect-period type="float">0.0</mp-auto-connect-period>
				<tow>
					<break-force type="float">5000</break-force>
				</tow>
			</aerotow>
			<winch>
				<force_name_jsbsim type="string">hitch</force_name_jsbsim>
				<automatic-release-angle-deg type="float">70.</automatic-release-angle-deg>
				<typical-tow-speed-kph type="float">55</typical-tow-speed-kph>
				<typical-tow-force-N type="float">1500</typical-tow-force-N>
				<tow>
					<break-force type="float">5000</break-force>
				</tow>
			</winch>
			<hook-open type="bool">false</hook-open>
		</hitches>
		<aircraft-data>
			<path>/sim/model/pilots-enabled</path>
			<path>/sim/model/pilots-view-enabled</path>
			<path>/sim/weight[0]/weight-lb</path>
		</aircraft-data>
		<menubar>
			<default>
				<menu n="10">
					<label>SG38</label>
					<enabled type="bool">true</enabled>
					<item>
						<label>Hitch Settings</label>
						<binding>
							<command>dialog-show</command>
							<dialog-name>hitch_dialog</dialog-name>
						</binding>
					</item>
					<item>
						<label>Winch Failures</label>
						<binding>
							<command>dialog-show</command>
							<dialog-name>winch_failure_dialog</dialog-name>
						</binding>
					</item>
					<item>
						<label>Ground services</label>
						<binding>
							<command>dialog-show</command>
							<dialog-name>groundservice_dialog</dialog-name>
						</binding>
					</item>
					<item>
						<label>Options</label>
						<binding>
							<command>dialog-show</command>
							<dialog-name>options_dialog</dialog-name>
						</binding>
					</item>
				</menu>
			</default>
		</menubar>
		<previews>
			<preview>
				<type>exterior</type>
				<path>Previews/exterior1.jpg</path>
				<splash type="bool">true</splash>
			</preview>
			<preview>
				<type>exterior</type>
				<path>Previews/exterior2.jpg</path>
				<splash type="bool">true</splash>
			</preview>
			<preview>
				<type>exterior</type>
				<path>Previews/exterior3.jpg</path>
				<splash type="bool">true</splash>
			</preview>
		</previews>
		<!-- 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>
		<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">/accelerations/pilot-g</property>
				</signal>
				<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>
	<payload>
		<weight n="0">
			<name>Pilot</name>
			<weight-lb alias="/fdm/jsbsim/inertia/pointmass-weight-lbs[0]"/>
			<min-lb type="double">0</min-lb>
			<max-lb type="double">243</max-lb>
		</weight>
	</payload>
	<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) -->
		</flight>
		<groundhandling>
			<wingholder type="bool">false</wingholder>
			<groundhandling type="bool">false</groundhandling>
		</groundhandling>
	</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();
						settimer(towing.runWinch, 1);
					</script>
				</binding>
				<binding>
					<command>property-assign</command>
					<property>/controls/groundhandling/wingholder</property>
					<value type="bool">true</value>
				</binding>
			</key>
			<key n="87">
				<name>W</name>
				<desc>Increase winch speed</desc>
				<binding>
					<command>nasal</command>
					<script>
						towing.winch_faster(0.1);
					</script>
				</binding>
			</key>
			<key n="119">
				<name>w</name>
				<desc>Decrease winch speed</desc>
				<binding>
					<command>nasal</command>
					<script>
						towing.winch_slower(0.1);
					</script>
				</binding>
			</key>
			<key n="15">
				<name>Ctrl-o</name>
				<desc>Find aircraft for aerotow</desc>
				<binding>
					<command>nasal</command>
					<script>towing.findBestAIObject()</script>
				</binding>
			</key>
			<key n="111">
				<name>o</name>
				<desc>Lock aerotow-hook</desc>
				<binding>
					<command>nasal</command>
					<script>towing.closeHitch()</script>
				</binding>
			</key>
			<key n="79">
				<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>/controls/groundhandling/wingholder</property>
					<value type="bool">false</value>
				</binding>
				<binding>
					<command>nasal</command>
					<script>towing.releaseHitch("winch")</script>
				</binding>
				<binding>
					<command>nasal</command>
					<script>towing.releaseHitch("aerotow")</script>
				</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/sg38.nas</file>
		</sg38>
	</nasal>
</PropertyList>
