<?xml version="1.0"?>

<PropertyList>

	<path>CG57.ac</path>

	<!-- *** Effects *** -->

	<nasal>
		<load>
			print("LOAD CG-57", cmdarg().getPath());

			var fg_root = getprop("/sim/fg-root");
			var self = cmdarg();


			########
			# properties used to calculate rel wind for the bow-wave shader

			var speed_Node = self.getNode("velocities/speed-kts", 1);
			var hdg_Node = self.getNode("orientation/true-heading-deg", 1);
			var wind_speed_Node = self.getNode("environment/rel-wind-speed-kts", 1);
			wind_speed_Node.setDoubleValue(0);


			########
			# the main loop

			var update = func {
			var value = wind_speed_Node.getValue();
			setprop("/environment/CG-57/rel-wind-speed-kts", value);
			value = speed_Node.getValue();
			setprop("/environment/CG-57/spd-kt", value);
			value = hdg_Node.getValue();
			setprop("/environment/CG-57/hdg-deg", value);

			settimer(update,0);
			}


			########
			#start the main loop
			update();

		</load>
	</nasal>

	<unload>
		#print("UNLOAD CG-57 ", cmdarg().getPath());
	</unload>

	<model>
		<name>Ensign</name>
		<path>Models/Maritime/Military/CG-57/ensign.xml</path>
		<offsets>
<!--32.7427	26.6797	0.0628354-->
			<x-m>32.7427</x-m>
			<y-m>0.0</y-m>
			<z-m>26.6797</z-m>
		</offsets>
	</model>

	<model>
		<name>Bow-Wave</name>
		<!--<path>/Models/Effects/Wakes/bow_wave.xml</path>-->
		<path>Models/Maritime/Military/CG-57/bow_wave.xml</path>
		<!--<path>Models/Geometry/Nimitz/bow_wave.xml</path>-->
		<offsets>
			<x-m>25</x-m>
			<z-m>-0.001</z-m>
		</offsets>
	</model>

	<model>
		<name>bowwake-stbd</name>
		<path>/Models/Effects/Wakes/wake.xml</path>
		<offsets>
			<x-m>-45.0</x-m>
			<y-m>0</y-m>
			<z-m>1.0</z-m>
			<heading-deg>0</heading-deg>
		</offsets>
		<overlay>
			<particlesystem>
				<placer>
					<type>segments</type>
					<vertex>
						<x-m>0</x-m>
						<y-m>0</y-m>
						<z-m>0</z-m>
					</vertex>
					<vertex>
						<x-m>0</x-m>
						<y-m>0.5</y-m>
						<z-m>0</z-m>
					</vertex>
					<vertex>
						<x-m>-10.0</x-m>
						<y-m>1.65</y-m>
						<z-m>0</z-m>
					</vertex>
					<vertex>
						<x-m>-20.0</x-m>
						<y-m>3.9</y-m>
						<z-m>0</z-m>
					</vertex>
				</placer>
				<shooter>
					<speed-mps>
						<property>/environment/CG-57/spd-kt</property>
						<factor>0.5144</factor>
						<spread>2</spread>
					</speed-mps>
				</shooter>
				<counter>
					<particles-per-sec>
						<property>/environment/CG-57/spd-kt</property>
					</particles-per-sec>
				</counter>
				<particle>
					<life-sec>
						<value>90</value>
					</life-sec>
				</particle>
			</particlesystem>
		</overlay>
	</model>

	<model>
		<name>bowwake-port</name>
		<path>Models/Effects/Wakes/wake.xml</path>
		<offsets>
			<x-m>-45.0</x-m>
			<y-m>0</y-m>
			<z-m>1.0</z-m>
			<heading-deg>0</heading-deg>
		</offsets>
		<overlay>
			<particlesystem>
				<placer>
					<type>segments</type>
					<vertex>
						<x-m>0</x-m>
						<y-m>0</y-m>
						<z-m>0</z-m>
					</vertex>
					<vertex>
						<x-m>0</x-m>
						<y-m>-0.5</y-m>
						<z-m>0</z-m>
					</vertex>
					<vertex>
						<x-m>-10.0</x-m>
						<y-m>-1.65</y-m>
						<z-m>0</z-m>
					</vertex>
					<vertex>
						<x-m>-20.0</x-m>
						<y-m>-3.9</y-m>
						<z-m>0</z-m>
					</vertex>
				</placer>
				<shooter>
					<theta-min-deg>-80</theta-min-deg>
					<theta-max-deg>-100</theta-max-deg>
					<phi-min-deg>88</phi-min-deg>
					<phi-max-deg>90</phi-max-deg>
					<speed-mps>
						<property>/environment/CG-57/spd-kt</property>
						<factor>0.5144</factor>
						<spread>2</spread>
					</speed-mps>
				</shooter>
				<counter>
					<particles-per-sec>
						<property>/environment/CG-57/spd-kt</property>
					</particles-per-sec>
				</counter>
				<particle>
					<life-sec>
						<value>90</value>
					</life-sec>
				</particle>
			</particlesystem>
		</overlay>
	</model>

	<model>
		<name>Stern-Wake</name>
		<path>Models/Effects/Wakes/wake2.xml</path>
		<offsets>
			<x-m>105</x-m>
			<y-m>0</y-m>
			<z-m>2.0</z-m>
			<heading-deg>0</heading-deg>
		</offsets>
		<overlay>
			<particlesystem>
				<placer>
					<type>segments</type>
					<vertex>
						<x-m>0</x-m>
						<y-m>-4</y-m>
						<z-m>-2</z-m>
					</vertex>
					<vertex>
						<x-m>0</x-m>
						<y-m>-3.5</y-m>
						<z-m>-1</z-m>
					</vertex>
					<vertex>
						<x-m>0</x-m>
						<y-m>0</y-m>
						<z-m>0</z-m>
					</vertex>
					<vertex>
						<x-m>0</x-m>
						<y-m>3.5</y-m>
						<z-m>-1</z-m>
					</vertex>
					<vertex>
						<x-m>0</x-m>
						<y-m>4</y-m>
						<z-m>-2</z-m>
					</vertex>
				</placer>
				<shooter>
					<theta-min-deg>-80</theta-min-deg>
					<theta-max-deg>-100</theta-max-deg>
					<phi-min-deg>88</phi-min-deg>
					<phi-max-deg>90</phi-max-deg>
					<speed-mps>
						<property>/environment/CG-57/spd-kt</property>
						<factor>1.0</factor>
						<spread>5</spread>
					</speed-mps>
				</shooter>
				<particle>
					<life-sec>
						<value>90</value>
					</life-sec>
				</particle>
			</particlesystem>
		</overlay>
	</model>


	<animation>
		<type>rotate</type>
		<object-name>Wake</object-name>
		<object-name>Bow-Wave</object-name>
		<object-name>Stern-Wake</object-name>
		<property>orientation/roll-deg</property>
		<factor>1</factor>
		<center>
			<x-m>105.814</x-m>
			<y-m>0.00</y-m>
			<z-m>1.5</z-m>
		</center>
		<axis>
			<x>1</x>
			<y>0</y>
			<z>0</z>
		</axis>
		<!--    <axis>
			<x1-m>218.97</x1-m>
			<y1-m>0.00</y1-m>
			<z1-m>0.093</z1-m>
			<x2-m>495.80</x2-m>
			<y2-m>0.00</y2-m>
			<z2-m>0.093</z2-m>
		</axis>-->
	</animation>

	<animation>
		<object-name>Bow-Wave</object-name>
		<type>scale</type>
		<property>/environment/CG-57/spd-kt</property>
		<x-factor>0.04</x-factor>
		<y-factor>0.0</y-factor>
		<z-factor>0.0</z-factor>
		<x-offset>0.2</x-offset>
		<y-offset>0.6</y-offset>
		<z-offset>1.0</z-offset>
		<x-min>0.4</x-min>
		<x-max>1.2</x-max>
		<center>
			<x-m>-55.0</x-m>
			<y-m>0.0</y-m>
			<z-m>0.0</z-m>
		</center>
	</animation>

	<animation>
		<type>select</type>
		<object-name>Wake</object-name>
		<condition>
			<not>
				<property>/sim/rendering/particles</property>
			</not>
		</condition>
	</animation>
	
	<animation>
		<type>rotate</type>
		<object-name>radar-1b</object-name>
		<property>/sim/time/elapsed-sec</property>
		<factor>65</factor>
		<center>
			<x-m>-11.7369</x-m>
			<y-m>0.0</y-m>
			<z-m>20.53</z-m>
		</center>
		<axis>
			<x>0</x>
			<y>0</y>
			<z>1</z>
		</axis>
	</animation>

	<animation>
		<type>rotate</type>
		<object-name>SPS-49-Antenna</object-name>
		<property>/sim/time/elapsed-sec</property>
		<factor>50</factor>
		<center>
			<x-m>29.6884</x-m>
			<y-m>0</y-m>
			<z-m>27.6858</z-m>
		</center>
		<axis>
			<x>0</x>
			<y>0</y>
			<z>1</z>
		</axis>
	</animation>


	<!--******************* LOD *****************-->

	<animation>
		<type>range</type>
		<min-m>0</min-m>
		<max-m>15000</max-m>
	</animation>

	<animation>
		<type>range</type>
		<object-name>railing</object-name>
		<!--<object-name>Net</object-name>
		<object-name>400ft</object-name>-->
		<max-m>1000</max-m>
	</animation>

	<animation>
		<type>range</type>
		<object-name>1000m</object-name>
		<min-m>0</min-m>
		<max-m>1000</max-m>
	</animation>

</PropertyList>