Shooting version of PAC-2 Patriot missile.

This commit is contained in:
Nikolai V. Chr 2021-12-27 23:45:59 +01:00
parent 445ea2b554
commit 51cb1f23cf
30 changed files with 9932 additions and 83 deletions

View File

@ -2,48 +2,11 @@
<PropertyList>
<environment>
<in-to-wind type="bool">false</in-to-wind>
</environment>
<carrier>
<fdm>
<settings>
<!-- The maximum bank angle during full rudder deflection -->
<bank-limit type="double">15.0</bank-limit>
<!-- Frequency and overshoot of the oscillator used to
simulate heeling (roll).
-->
<heel-frequency type="double">0.5</heel-frequency>
<heel-overshoot type="double">4.0</heel-overshoot>
<!-- Frequency and overshoot of the oscillator used to
simulate trimming (pitch).
-->
<trim-frequency type="double">0.32</trim-frequency>
<trim-overshoot type="double">0.45</trim-overshoot>
<!-- The speed of the waves plus speed of the ship in knots
which generates the maximum overshoot of the trim
oscillation.
-->
<max-trim-oscillation-wave-kt type="double">30.0</max-trim-oscillation-wave-kt>
<!-- The speed of the waves in knots which generates the
maximum overshoot of the heel oscillation.
-->
<max-heel-oscillation-wave-kt type="double">20.0</max-heel-oscillation-wave-kt>
<movement type="bool">true</movement>
</settings>
</fdm>
</carrier>
<sim>
<author>pinto</author>
<author>pinto, Nikolai V. Chr., onox</author>
<description>MIM-104D</description>
<long-description>MIM-104D (PAC-3) is a US self-propelled surface to air missile system.</long-description>
<long-description>MIM-104D (PAC-2) is a US self-propelled surface to air missile system. Also known as Patroit Missile System.</long-description>
<status>alpha</status>
<aircraft-version>0.1</aircraft-version>
@ -107,7 +70,7 @@
</limits>
</config>
</view>
<view n="102">
<view n="200">
<name>Follow</name>
<type>lookat</type>
<internal>false</internal>
@ -151,24 +114,13 @@
<auto-position type="bool">true</auto-position>
</tower>
<systems>
<autopilot>
<path>Systems/fbw.xml</path>
</autopilot>
<autopilot>
<path>Systems/fdm.xml</path>
</autopilot>
<property-rule n="100">
<path>Systems/views.xml</path>
</property-rule>
</systems>
<multiplay>
<visibility-range-nm type="int">500</visibility-range-nm>
<generic>
<int n="0" type="int">0</int>
<int n="2" type="int">0</int>
<string n="6" type="string"></string><!-- string 6 used by radar lock RWR warning -->
<string n="7" type="string"></string><!-- datalink -->
</generic>
</multiplay>
@ -210,6 +162,10 @@
setprop("position/latitude-deg",getprop("sim/input/click/latitude-deg"));
setprop("position/longitude-deg",getprop("sim/input/click/longitude-deg"));
setprop("position/altitude-ft",getprop("sim/input/click/elevation-ft"));
var h = geo.elevation(getprop("sim/input/click/latitude-deg"),getprop("sim/input/click/longitude-deg"));
if (h!=nil)
setprop("position/altitude-ft",h*M2FT+0.010);
fire_control.start_time = systime();
</script>
</binding>
</item>
@ -218,7 +174,9 @@
<binding>
<command>nasal</command>
<script>
setprop("payload/armament/msg",0);
damage.printDamageLog();
setprop("payload/armament/msg",1);
</script>
</binding>
</item>
@ -256,33 +214,33 @@
<trigger type="bool">false</trigger>
<station n="1">
<offsets>
<x-m type="double"> 13</x-m>
<x-m type="double"> 12</x-m>
<y-m type="double"> 0</y-m>
<z-m type="double"> 2.5</z-m>
<z-m type="double"> 3</z-m>
</offsets>
<trigger type="bool">false</trigger>
</station>
<station n="2">
<offsets>
<x-m type="double"> 13</x-m>
<x-m type="double"> 12</x-m>
<y-m type="double"> 0</y-m>
<z-m type="double"> 2.5</z-m>
<z-m type="double"> 3</z-m>
</offsets>
<trigger type="bool">false</trigger>
</station>
<station n="3">
<offsets>
<x-m type="double"> 13</x-m>
<x-m type="double"> 12</x-m>
<y-m type="double"> 0</y-m>
<z-m type="double"> 2.5</z-m>
<z-m type="double"> 3</z-m>
</offsets>
<trigger type="bool">false</trigger>
</station>
<station n="4">
<offsets>
<x-m type="double"> 13</x-m>
<x-m type="double"> 12</x-m>
<y-m type="double"> 0</y-m>
<z-m type="double"> 2.5</z-m>
<z-m type="double"> 3</z-m>
</offsets>
<trigger type="bool">false</trigger>
</station>
@ -321,6 +279,57 @@
<MAW-bearing type="double">0</MAW-bearing>
<MAW-active type="bool">false</MAW-active>
<spike type="bool">false</spike>
<gem>
<type-id type="int">63</type-id>
<short-name type="string">GEM</short-name>
<long-name type="string">Guidance Enhanced Missile</long-name>
<max-fire-range-nm type="int">43</max-fire-range-nm>
<cross-section-sqft type="double">1.42</cross-section-sqft>
<weight-launch-lbs>1500</weight-launch-lbs><!-- PAC1, not sure about GEM -->
<vol-search type="double">0.00</vol-search>
<vol-track type="double">0.15</vol-track> <!-- -->
<vol-track-weak type="double">0.1</vol-track-weak> <!-- -->
<guidance type="string">radar</guidance>
<navigation type="string">APN3003</navigation> <!-- -->
<all-aspect type="bool">true</all-aspect>
<FCS-field-deg type="int">360</FCS-field-deg>
<seeker-field-deg type="int">400</seeker-field-deg><!-- since launched vertical, it cannot be too small -->
<max-g type="int">25</max-g>
<thrust-lbf-stage-1 type="double">15000</thrust-lbf-stage-1>
<thrust-lbf-stage-2 type="double">0</thrust-lbf-stage-2> <!-- max 2000 m/s speed, 93 NM range -->
<stage-1-duration-sec type="double">12</stage-1-duration-sec>
<stage-gap-duration-sec type="double">0</stage-gap-duration-sec>
<stage-2-duration-sec type="double">0</stage-2-duration-sec>
<weight-warhead-lbs>185</weight-warhead-lbs>
<weight-fuel-lbm>1000</weight-fuel-lbm> <!-- -->
<drag-coeff type="double">0.10</drag-coeff> <!-- max 2000 m/s speed, 93 NM range -->
<arming-time-sec type="double">2</arming-time-sec>
<min-speed-for-guiding-mach type="double">0.45</min-speed-for-guiding-mach>
<self-destruct-time-sec type="double">75</self-destruct-time-sec>
<self-destruct-at-lock-lost type="bool">true</self-destruct-at-lock-lost>
<seeker-angular-speed-dps type="double">3000</seeker-angular-speed-dps>
<loft-altitude type="int">0</loft-altitude>
<min-fire-range-nm type="double">0.40</min-fire-range-nm>
<max-report-distance type="double">200</max-report-distance> <!-- -->
<rail type="bool">true</rail>
<rail-length-m type="double">7.5</rail-length-m>
<rail-point-forward type="bool">false</rail-point-forward>
<rail-pitch-deg type="double">45</rail-pitch-deg>
<rail-heading-deg type="double">0</rail-heading-deg>
<chaff-resistance type="double">0.96</chaff-resistance>
<proportionality-constant type="double">3</proportionality-constant>
<class type="string">A</class>
<fire-msg>Bird away</fire-msg>
<telemetry type="bool">true</telemetry>
<FCS-at-origin type="bool">false</FCS-at-origin>
<FCS-x type="double">0</FCS-x>
<FCS-y type="double">0</FCS-y>
<FCS-z type="double">25</FCS-z>
</gem>
</armament>
</payload>

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -0,0 +1,176 @@
<PropertyList>
<particlesystem>
<name>explosion</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/explode-id-0</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>-180</theta-min-deg>
<theta-max-deg>180</theta-max-deg>
<phi-min-deg>-180</phi-min-deg>
<phi-max-deg>180</phi-max-deg>
<speed-mps>
<value>500</value>
<spread>80</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>30</value>
<spread>10</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 1.0 </value></red>
<green><value> 1.0 </value></green>
<blue><value> 0.4 </value></blue>
<alpha><value> 1 </value></alpha>
</color>
<size>
<value>2</value>
</size>
</start>
<end>
<color>
<red><value> 0.8 </value></red>
<green><value> 0.5 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.1 </value></alpha>
</color>
<size>
<value>55</value>
</size>
</end>
<life-sec>
<value>0.5</value>
</life-sec>
<mass-kg> 5 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
<particlesystem>
<name>explosion-smoke</name>
<texture>smoke.png</texture>
<emissive type="bool">false</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/explode-smoke-id-0</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>-180</theta-min-deg>
<theta-max-deg>180</theta-max-deg>
<phi-min-deg>-180</phi-min-deg>
<phi-max-deg>180</phi-max-deg>
<speed-mps>
<value>500</value>
<spread>60</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>50</value>
<spread>10</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 0.3 </value></red>
<green><value> 0.3 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 0.5 </value></alpha>
</color>
<size>
<value>10</value>
</size>
</start>
<end>
<color>
<red><value> 0.4 </value></red>
<green><value> 0.4 </value></green>
<blue><value> 0.4 </value></blue>
<alpha><value> 0.04 </value></alpha>
</color>
<size>
<value>60</value>
</size>
</end>
<life-sec>
<value>40</value>
</life-sec>
<mass-kg> 5 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
</PropertyList>

View File

@ -0,0 +1,176 @@
<PropertyList>
<particlesystem>
<name>explosion</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/explode-id-1</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>-180</theta-min-deg>
<theta-max-deg>180</theta-max-deg>
<phi-min-deg>-180</phi-min-deg>
<phi-max-deg>180</phi-max-deg>
<speed-mps>
<value>500</value>
<spread>80</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>30</value>
<spread>10</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 1.0 </value></red>
<green><value> 1.0 </value></green>
<blue><value> 0.4 </value></blue>
<alpha><value> 1 </value></alpha>
</color>
<size>
<value>2</value>
</size>
</start>
<end>
<color>
<red><value> 0.8 </value></red>
<green><value> 0.5 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.1 </value></alpha>
</color>
<size>
<value>55</value>
</size>
</end>
<life-sec>
<value>0.5</value>
</life-sec>
<mass-kg> 5 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
<particlesystem>
<name>explosion-smoke</name>
<texture>smoke.png</texture>
<emissive type="bool">false</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/explode-smoke-id-1</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>-180</theta-min-deg>
<theta-max-deg>180</theta-max-deg>
<phi-min-deg>-180</phi-min-deg>
<phi-max-deg>180</phi-max-deg>
<speed-mps>
<value>500</value>
<spread>60</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>50</value>
<spread>10</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 0.3 </value></red>
<green><value> 0.3 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 0.5 </value></alpha>
</color>
<size>
<value>10</value>
</size>
</start>
<end>
<color>
<red><value> 0.4 </value></red>
<green><value> 0.4 </value></green>
<blue><value> 0.4 </value></blue>
<alpha><value> 0.04 </value></alpha>
</color>
<size>
<value>60</value>
</size>
</end>
<life-sec>
<value>40</value>
</life-sec>
<mass-kg> 5 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
</PropertyList>

View File

@ -0,0 +1,176 @@
<PropertyList>
<particlesystem>
<name>explosion</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/explode-id-2</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>-180</theta-min-deg>
<theta-max-deg>180</theta-max-deg>
<phi-min-deg>-180</phi-min-deg>
<phi-max-deg>180</phi-max-deg>
<speed-mps>
<value>500</value>
<spread>80</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>30</value>
<spread>10</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 1.0 </value></red>
<green><value> 1.0 </value></green>
<blue><value> 0.4 </value></blue>
<alpha><value> 1 </value></alpha>
</color>
<size>
<value>2</value>
</size>
</start>
<end>
<color>
<red><value> 0.8 </value></red>
<green><value> 0.5 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.1 </value></alpha>
</color>
<size>
<value>55</value>
</size>
</end>
<life-sec>
<value>0.5</value>
</life-sec>
<mass-kg> 5 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
<particlesystem>
<name>explosion-smoke</name>
<texture>smoke.png</texture>
<emissive type="bool">false</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/explode-smoke-id-2</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>-180</theta-min-deg>
<theta-max-deg>180</theta-max-deg>
<phi-min-deg>-180</phi-min-deg>
<phi-max-deg>180</phi-max-deg>
<speed-mps>
<value>500</value>
<spread>60</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>50</value>
<spread>10</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 0.3 </value></red>
<green><value> 0.3 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 0.5 </value></alpha>
</color>
<size>
<value>10</value>
</size>
</start>
<end>
<color>
<red><value> 0.4 </value></red>
<green><value> 0.4 </value></green>
<blue><value> 0.4 </value></blue>
<alpha><value> 0.04 </value></alpha>
</color>
<size>
<value>60</value>
</size>
</end>
<life-sec>
<value>40</value>
</life-sec>
<mass-kg> 5 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
</PropertyList>

View File

@ -0,0 +1,176 @@
<PropertyList>
<particlesystem>
<name>explosion</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/explode-id-3</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>-180</theta-min-deg>
<theta-max-deg>180</theta-max-deg>
<phi-min-deg>-180</phi-min-deg>
<phi-max-deg>180</phi-max-deg>
<speed-mps>
<value>500</value>
<spread>80</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>30</value>
<spread>10</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 1.0 </value></red>
<green><value> 1.0 </value></green>
<blue><value> 0.4 </value></blue>
<alpha><value> 1 </value></alpha>
</color>
<size>
<value>2</value>
</size>
</start>
<end>
<color>
<red><value> 0.8 </value></red>
<green><value> 0.5 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.1 </value></alpha>
</color>
<size>
<value>55</value>
</size>
</end>
<life-sec>
<value>0.5</value>
</life-sec>
<mass-kg> 5 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
<particlesystem>
<name>explosion-smoke</name>
<texture>smoke.png</texture>
<emissive type="bool">false</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/explode-smoke-id-3</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>-180</theta-min-deg>
<theta-max-deg>180</theta-max-deg>
<phi-min-deg>-180</phi-min-deg>
<phi-max-deg>180</phi-max-deg>
<speed-mps>
<value>500</value>
<spread>60</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>50</value>
<spread>10</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 0.3 </value></red>
<green><value> 0.3 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 0.5 </value></alpha>
</color>
<size>
<value>10</value>
</size>
</start>
<end>
<color>
<red><value> 0.4 </value></red>
<green><value> 0.4 </value></green>
<blue><value> 0.4 </value></blue>
<alpha><value> 0.04 </value></alpha>
</color>
<size>
<value>60</value>
</size>
</end>
<life-sec>
<value>40</value>
</life-sec>
<mass-kg> 5 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
</PropertyList>

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<PropertyList>
<name>aim-120</name>
<path>9M317.ac</path>
<animation>
<type>select</type>
<object-name>missile1</object-name>
<condition>
<property>payload/armament/gem/flags/msl-id-0</property>
</condition>
</animation>
<model>
<path>Aircraft/MIM-104D/Models/Armament/Weapons/GEM/motor-smoke-0.xml</path>
<offsets>
<x-m>1.83937</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
</model>
<model>
<name>explosion</name>
<path>Aircraft/MIM-104D/Models/Armament/Weapons/GEM/explosion-0.xml</path>
<offsets>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
</model>
<animation>
<object-name>missile1</object-name>
<enable-hot type="bool">false</enable-hot>
</animation>
</PropertyList>

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<PropertyList>
<name>aim-120</name>
<path>9M317.ac</path>
<animation>
<type>select</type>
<object-name>missile1</object-name>
<condition>
<property>payload/armament/gem/flags/msl-id-1</property>
</condition>
</animation>
<model>
<path>Aircraft/MIM-104D/Models/Armament/Weapons/GEM/motor-smoke-1.xml</path>
<offsets>
<x-m>1.83937</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
</model>
<model>
<name>explosion</name>
<path>Aircraft/MIM-104D/Models/Armament/Weapons/GEM/explosion-1.xml</path>
<offsets>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
</model>
<animation>
<object-name>missile1</object-name>
<enable-hot type="bool">false</enable-hot>
</animation>
</PropertyList>

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<PropertyList>
<name>aim-120</name>
<path>9M317.ac</path>
<animation>
<type>select</type>
<object-name>missile1</object-name>
<condition>
<property>payload/armament/gem/flags/msl-id-2</property>
</condition>
</animation>
<model>
<path>Aircraft/MIM-104D/Models/Armament/Weapons/GEM/motor-smoke-2.xml</path>
<offsets>
<x-m>1.83937</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
</model>
<model>
<name>explosion</name>
<path>Aircraft/MIM-104D/Models/Armament/Weapons/GEM/explosion-2.xml</path>
<offsets>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
</model>
<animation>
<object-name>missile1</object-name>
<enable-hot type="bool">false</enable-hot>
</animation>
</PropertyList>

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<PropertyList>
<name>aim-120</name>
<path>9M317.ac</path>
<animation>
<type>select</type>
<object-name>missile1</object-name>
<condition>
<property>payload/armament/gem/flags/msl-id-3</property>
</condition>
</animation>
<model>
<path>Aircraft/MIM-104D/Models/Armament/Weapons/GEM/motor-smoke-3.xml</path>
<offsets>
<x-m>1.83937</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
</model>
<model>
<name>explosion</name>
<path>Aircraft/MIM-104D/Models/Armament/Weapons/GEM/explosion-3.xml</path>
<offsets>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
</model>
<animation>
<object-name>missile1</object-name>
<enable-hot type="bool">false</enable-hot>
</animation>
</PropertyList>

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<PropertyList>
<path>9M317.ac</path>
</PropertyList>

View File

@ -0,0 +1,187 @@
<PropertyList>
<particlesystem>
<name>smoke</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/smoke-id-0</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<offsets>
<x-m>7</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
<shooter>
<theta-min-deg>-1.5</theta-min-deg>
<theta-max-deg>1.5</theta-max-deg>
<phi-min-deg>-1.5</phi-min-deg>
<phi-max-deg>1.5</phi-max-deg>
<speed-mps>
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>50</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 0.25 </value></red>
<green><value> 0.25 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 1 </value></alpha>
</color>
<size>
<value>1.0</value>
</size>
</start>
<end>
<color>
<red><value> 0.25 </value></red>
<green><value> 0.25 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 0.5 </value></alpha>
</color>
<size>
<value>5</value>
</size>
</end>
<life-sec>
<value>60</value>
</life-sec>
<mass-kg> 0.001 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> false </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
<particlesystem>
<name>exhaust</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/smoke-id-0</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<offsets>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
<shooter>
<theta-min-deg>-1.5</theta-min-deg>
<theta-max-deg>1.5</theta-max-deg>
<phi-min-deg>-1.5</phi-min-deg>
<phi-max-deg>1.5</phi-max-deg>
<speed-mps>
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>100</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 1.0 </value></red>
<green><value> 0.7 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.7 </value></alpha>
</color>
<size>
<value>1.0</value>
</size>
</start>
<end>
<color>
<red><value> 0.9 </value></red>
<green><value> 0.6 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.1 </value></alpha>
</color>
<size>
<value>1.5</value>
</size>
</end>
<life-sec>
<value>0.15</value>
</life-sec>
<mass-kg> 0.001 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> false </gravity>
<wind typ="bool"> false </wind>
</program>
</particlesystem>
</PropertyList>

View File

@ -0,0 +1,187 @@
<PropertyList>
<particlesystem>
<name>smoke</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/smoke-id-1</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<offsets>
<x-m>7</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
<shooter>
<theta-min-deg>-1.5</theta-min-deg>
<theta-max-deg>1.5</theta-max-deg>
<phi-min-deg>-1.5</phi-min-deg>
<phi-max-deg>1.5</phi-max-deg>
<speed-mps>
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>50</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 0.25 </value></red>
<green><value> 0.25 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 1 </value></alpha>
</color>
<size>
<value>1.0</value>
</size>
</start>
<end>
<color>
<red><value> 0.25 </value></red>
<green><value> 0.25 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 0.5 </value></alpha>
</color>
<size>
<value>5</value>
</size>
</end>
<life-sec>
<value>60</value>
</life-sec>
<mass-kg> 0.001 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> false </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
<particlesystem>
<name>exhaust</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/smoke-id-1</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<offsets>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
<shooter>
<theta-min-deg>-1.5</theta-min-deg>
<theta-max-deg>1.5</theta-max-deg>
<phi-min-deg>-1.5</phi-min-deg>
<phi-max-deg>1.5</phi-max-deg>
<speed-mps>
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>100</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 1.0 </value></red>
<green><value> 0.7 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.7 </value></alpha>
</color>
<size>
<value>1.0</value>
</size>
</start>
<end>
<color>
<red><value> 0.9 </value></red>
<green><value> 0.6 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.1 </value></alpha>
</color>
<size>
<value>1.5</value>
</size>
</end>
<life-sec>
<value>0.15</value>
</life-sec>
<mass-kg> 0.001 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> false </gravity>
<wind typ="bool"> false </wind>
</program>
</particlesystem>
</PropertyList>

View File

@ -0,0 +1,187 @@
<PropertyList>
<particlesystem>
<name>smoke</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/smoke-id-2</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<offsets>
<x-m>7</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
<shooter>
<theta-min-deg>-1.5</theta-min-deg>
<theta-max-deg>1.5</theta-max-deg>
<phi-min-deg>-1.5</phi-min-deg>
<phi-max-deg>1.5</phi-max-deg>
<speed-mps>
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>50</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 0.25 </value></red>
<green><value> 0.25 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 1 </value></alpha>
</color>
<size>
<value>1.0</value>
</size>
</start>
<end>
<color>
<red><value> 0.25 </value></red>
<green><value> 0.25 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 0.5 </value></alpha>
</color>
<size>
<value>5</value>
</size>
</end>
<life-sec>
<value>60</value>
</life-sec>
<mass-kg> 0.001 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> false </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
<particlesystem>
<name>exhaust</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/smoke-id-2</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<offsets>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
<shooter>
<theta-min-deg>-1.5</theta-min-deg>
<theta-max-deg>1.5</theta-max-deg>
<phi-min-deg>-1.5</phi-min-deg>
<phi-max-deg>1.5</phi-max-deg>
<speed-mps>
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>100</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 1.0 </value></red>
<green><value> 0.7 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.7 </value></alpha>
</color>
<size>
<value>1.0</value>
</size>
</start>
<end>
<color>
<red><value> 0.9 </value></red>
<green><value> 0.6 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.1 </value></alpha>
</color>
<size>
<value>1.5</value>
</size>
</end>
<life-sec>
<value>0.15</value>
</life-sec>
<mass-kg> 0.001 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> false </gravity>
<wind typ="bool"> false </wind>
</program>
</particlesystem>
</PropertyList>

View File

@ -0,0 +1,187 @@
<PropertyList>
<particlesystem>
<name>smoke</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/smoke-id-3</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<offsets>
<x-m>7</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
<shooter>
<theta-min-deg>-1.5</theta-min-deg>
<theta-max-deg>1.5</theta-max-deg>
<phi-min-deg>-1.5</phi-min-deg>
<phi-max-deg>1.5</phi-max-deg>
<speed-mps>
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>50</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 0.25 </value></red>
<green><value> 0.25 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 1 </value></alpha>
</color>
<size>
<value>1.0</value>
</size>
</start>
<end>
<color>
<red><value> 0.25 </value></red>
<green><value> 0.25 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 0.5 </value></alpha>
</color>
<size>
<value>5</value>
</size>
</end>
<life-sec>
<value>60</value>
</life-sec>
<mass-kg> 0.001 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> false </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
<particlesystem>
<name>exhaust</name>
<texture>smoke.png</texture>
<emissive type="bool">true</emissive>
<lighting type="bool">false</lighting>
<condition>
<property>payload/armament/gem/flags/smoke-id-3</property>
</condition>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<offsets>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</offsets>
<shooter>
<theta-min-deg>-1.5</theta-min-deg>
<theta-max-deg>1.5</theta-max-deg>
<phi-min-deg>-1.5</phi-min-deg>
<phi-max-deg>1.5</phi-max-deg>
<speed-mps>
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>100</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 1.0 </value></red>
<green><value> 0.7 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.7 </value></alpha>
</color>
<size>
<value>1.0</value>
</size>
</start>
<end>
<color>
<red><value> 0.9 </value></red>
<green><value> 0.6 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.1 </value></alpha>
</color>
<size>
<value>1.5</value>
</size>
</end>
<life-sec>
<value>0.15</value>
</life-sec>
<mass-kg> 0.001 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> false </gravity>
<wind typ="bool"> false </wind>
</program>
</particlesystem>
</PropertyList>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -4,6 +4,26 @@
<path>MIM-104D.ac</path>
<!--animation>
<object-name>cockpit</object-name>
<object-name>Cylinder</object-name>
<object-name>Cylinder.001</object-name>
<object-name>Cylinder.004</object-name>
<object-name>Cylinder.005</object-name>
<object-name>Cylinder.006</object-name>
<object-name>Cylinder.007</object-name>
<object-name>Cylinder.008</object-name>
<object-name>Cylinder.009</object-name>
<object-name>CylinderA</object-name>
<object-name>CylinderB</object-name>
<object-name>Launcher</object-name>
<object-name>platform</object-name>
<object-name>platform_struct</object-name>
<object-name>stabilizers</object-name>
<object-name>Vehicle</object-name>
<enable-hot type="bool">false</enable-hot>
</animation-->
<animation>
<type>rotate</type>
<object-name>Launcher</object-name>

View File

@ -37,24 +37,30 @@ var shells = {
# 0.20 means a direct hit will disable 20% of the failure modes on average.
# or, 0.20 also means a direct hit can do 20 hitpoints damage.
#
"M70 rocket": [0,0.250], #135mm
"S-5 rocket": [1,0.200], # 55mm
"M55 shell": [2,0.100], # 30mm
"KCA shell": [3,0.100], # 30mm
"GSh-30": [4,0.100], # 30mm mig29/su27
"GAU-8/A": [5,0.100], # 30mm
"Mk3Z": [6,0.100], # 30mm Jaguar
"BK27": [7,0.070], # 27mm
"GSh-23": [8,0.065], # 23mm
"M61A1 shell": [9,0.050], # 20mm F14, F15, F16
"50 BMG": [10,0.015], # 12.7mm (non-explosive)
# Damage roughly proportional to projectile weight.
# If weight isn't listed here, it was estimated from dimensions (proportional to diameter^2 * length).
# Approximate formulae for cannons:
# damage ~ weight / 3.6 (in g)
# or damage ~ diameter^2 * length / 1.6e6 (in mm)
#
"M70 rocket": [0,0.500], # 135mm, ~5kg warhead
"S-5 rocket": [1,0.200], # 55mm, ~1-2kg warhead
"M55 shell": [2,0.060], # 30x113mm, 220g
"KCA shell": [3,0.100], # 30x173mm, 360g
"GSh-30": [4,0.095], # 30x165mm mig29/su27
"GAU-8/A": [5,0.100], # 30x173mm, 360g
"Mk3Z": [6,0.060], # 30x113mm Jaguar, 220g
"BK27": [7,0.070], # 27x145mm, 270g
"GSh-23": [8,0.040], # 23x115mm,
"M61A1 shell": [9,0.030], # 20x102mm F14, F15, F16, 100g
"50 BMG": [10,0.015], # 12.7mm (non-explosive)
"7.62": [11,0.005], # 7.62mm (non-explosive)
"Hydra-70": [12,0.250], # F-16/A-6 LAU-68 and LAU-61
"SNEB": [13,0.250], # Jaguar
"DEFA 554": [14,0.100], # 30mm Mirage
"20mm APDS": [15,0.050], # CIWS
"LAU-10": [16,0.225], # 127mm
};
"Hydra-70": [12,0.500], # 70mm, F-16/A-6 LAU-68 and LAU-61, ~4-6kg warhead
"SNEB": [13,0.500], # 68mm, Jaguar
"DEFA 554": [14,0.060], # 30x113mm Mirage, 220g
"20mm APDS": [15,0.030], # CIWS
"LAU-10": [16,0.500], # 127mm, ~4-7kg warhead
};
# lbs of warheads is explosive+fragmentation+fuse, so total warhead mass.
@ -82,7 +88,7 @@ var warheads = {
"GBU-24": [19, 945.00,1,0],
"GBU-31": [20, 945.00,1,0],
"GBU-54": [21, 190.00,1,0],
"GBU-10": [22, 2000.00,1,0],
"GBU-10": [22, 945.00,1,0],
"GBU-16": [23, 450.00,1,0],
"HVAR": [24, 7.50,1,0],#P51
"KAB-500": [25, 564.38,1,0],
@ -123,9 +129,9 @@ var warheads = {
"Apache AP": [60, 110.23,0,1],# Real mass of bomblet. (x 10). Anti runway.
"KN-06": [61, 315.00,0,0],
"9M317": [62, 145.00,0,0],
"GEM": [63, 185.00,0,0],#MIM-104D
"GEM": [63, 185.00,0,0],#MIM-104D
"R.550 Magic": [64, 26.45,0,0],# also called majic
"d-0": [65, 30.00,0,0],#deprecated
"5Ya23": [65, 414.00,0,0],#Volga-M
"R.550 Magic 2": [66, 27.00,0,0],
"R.530": [67, 55.00,0,0],
"MK-82AIR": [68, 192.00,1,0],
@ -1167,7 +1173,7 @@ var code_ct = func () {
if (getprop("payload/armament/msg")) {
setprop("sim/rendering/redout/enabled", TRUE);
#call(func{fgcommand('dialog-close', multiplayer.dialog.dialog.prop())},nil,var err= []);# props.Node.new({"dialog-name": "location-in-air"}));
call(func{multiplayer.dialog.del();},nil,var err= []);
#call(func{multiplayer.dialog.del();},nil,var err= []);
if (!getprop("gear/gear[0]/wow")) {
call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "WeightAndFuel"}))},nil,var err2 = []);
call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "system-failures"}))},nil,var err2 = []);

78
MIM-104D/Nasal/fdm.nas Normal file
View File

@ -0,0 +1,78 @@
# Copyright (C) 2015 onox
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#io.include("Aircraft/ExpansionPack/Nasal/init.nas");
#with("updateloop");
# Number of iterations per second
var frequency = 60.0;
# Change in heading per second at full rudder deflection
var heading_ps = 0.5;
time_last = 0;
sim_speed = 1;
setprop("/carrier/pitch-deg",0);
setprop("/carrier/pitch-offset",0);
setprop("/carrier/roll-deg",0);
setprop("/carrier/roll-offset",0);
setprop("/carrier/sunk",0);
var PositionUpdater = func () {
var position = geo.aircraft_position();
var time_now = getprop("/sim/time/elapsed-sec");
var dt = (time_now - time_last) * sim_speed;
if (dt == 0) {settimer( PositionUpdater, 1/frequency ); return;}
time_last = time_now;
var heading = getprop("/orientation/heading-deg");
var speed = getprop("/velocities/groundspeed-kt");
var rudder = getprop("/surface-positions/rudder-pos-norm");
var distance = speed * globals.KT2MPS * dt;
position.apply_course_distance(heading, distance);
# Set new position
setprop("/position/latitude-deg", position.lat());
setprop("/position/longitude-deg", position.lon());
setprop("/position/altitude-ft", getprop("/position/ground-elev-ft"));
if ( getprop("/carrier/sunk") == 0 ) {
# Update heading
var course = heading + rudder * heading_ps * dt;
setprop("/orientation/heading-deg", course);
} else {
return;
}
#set pitch
setprop("/orientation/pitch-deg",getprop("/carrier/pitch-deg") + getprop("/carrier/pitch-offset"));
#set roll
setprop("/orientation/roll-deg",getprop("/carrier/roll-deg") + getprop("/carrier/roll-offset"));
settimer( PositionUpdater, 1/frequency );
};
#PositionUpdater();

View File

@ -0,0 +1,625 @@
################### GLOBALS
var false = 0;
var true = 1;
var AIR = 0;
var MARINE = 1;
var SURFACE = 2;
var ORDNANCE = 3;
var radar_update_time = 2;
var launch_update_time = 0.3;
var reloading = 0;
var missile_delay_time = 0;#time when last track was initiated
var missile_release_time = 0;#time when last missile was fired
var ciws_delay_time = 0;#time when CIWS was last fired
var launch_in_progress = 0;# if a firing solution is currently being calculated
var reload_starting = 0;
var ACTIVE_MISSILE = 0;
var semi_active_track = nil;# with multiple missiles flying in semi-active-radar mode, this can change rather fast. Which means pilots wont get a steady tone, but disrupted tones. (tradeoff)
var mutexLock = thread.newlock();
################### SAM INFO
var setupTime = 300;#minimum 'launcher_tilt_time' secs no matter what, due to anim and stuff.
var reload_time = 900;
var launcher_final_tilt_deg = 45;
var launcher_start_tilt_deg = 0;
var launcher_tilt_time = 15;
var sam_align_to_target = 0;
var launcher_align_to_target = 1;
var align_speed_dps = 20;
var radar_elevation_above_terrain_m = 25;
var radar_lowest_pitch = -5;# 0.5 degs = roughly 925 feet at 20 nm, 25 feet at half a nm. # 0.35 = roughly 925 feet at 20 nm, 25 feet at half a nm.
#reaction tme for s-300p is 28 secs acording to http://www.astronautix.com/s/s-300p.html
# sounds a bit high for pmu, as its 4 secs for s-400
################### CIWS INFO
var ciws_installed = 0;
var ciws_domain_nm = 1.50; #range where it can kill
var ciws_chance = 0.20; #chance to get a kill at 0nm distance
var ciws_burst_rounds = 60;#how many rounds in a burst
var ciws_shell = 15;#from lookup table in damage.nas
var ROUNDS_init = 30;
var ROUNDS = ROUNDS_init;#CIWS bursts remaining
################### MISSILE INFO
var NUM_MISSILES = 3; # total carried minus 1
var missile_name = "GEM";
var missile_brevity = "GEM/T";
var missile_max_distance = 43; #max distance of target in nm when it will fire
var missile_min_distance = 0.5; #minimum distance in nm when it will fire
var lockon_time = 12; #time in seconds it takes to lock on and get a firing solution on a target
var fire_minimum_interval = 7;# time since last track was initiated till a new can be initiated
var same_target_max_missiles = 1;# max number of missiles in air against same target
var isInEngagementEnvelope = func (target_radial_airspeed, target_ground_distance, target_relative_altitude) {
return 1;
}
var midflight = nil;
##########################################################################
######################## Common SAM code ###########################
##########################################################################
################### VARIOUS
setprop("sim/multiplay/generic/float[5]", 0);# launcher vert rotation
setprop("sim/multiplay/generic/float[6]", 0);# launcher horiz rotation
var start_time = systime();
var opfor_switch = "enemies/opfor-switch";
setprop(opfor_switch,0);
var friend_switch = "enemies/friend-switch";
setprop(friend_switch,0);
################### IFF
var target = {
new: func (callsign) {
var m = { parents: [target] };
m.callsign = callsign;
m.in_air = 0;
m.tracking = 0;
m.missiles = [];
return m;
},
};
var base = props.globals.getNode("/");
base.getNode("instrumentation/transponder/id-code",1).setIntValue(-9999);
base.getNode("instrumentation/transponder/transmitted-id",1).setIntValue(-9999);# transponder off
###################################################################
var targetsV2 = nil;
var buildTargetList = func {
# rather crappy code, but is not ran so often, so dont really matter.
if (getprop(opfor_switch) == 0 and getprop(friend_switch) == 0) {
for(var i = 1; i<=12;i+=1) {
# add new callsign to list
var sign = getprop("enemies/e"~i);
var tgt = lookup(sign);
if (tgt == nil) {
targetsV2.append(target.new(sign));
print("added callsign: "~sign);
}
}
}
var removeList = [];
foreach(tgt ; targetsV2.vector) {
# schedule removed callsigns to be removed
if (getprop(opfor_switch) == 0 and getprop(friend_switch) == 0) {
if (tgt.callsign != getprop("enemies/e1") and tgt.callsign != getprop("enemies/e2") and tgt.callsign != getprop("enemies/e3") and tgt.callsign != getprop("enemies/e4") and tgt.callsign != getprop("enemies/e5") and tgt.callsign != getprop("enemies/e6") and tgt.callsign != getprop("enemies/e7") and tgt.callsign != getprop("enemies/e8") and tgt.callsign != getprop("enemies/e9") and tgt.callsign != getprop("enemies/e10") and tgt.callsign != getprop("enemies/e11") and tgt.callsign != getprop("enemies/e12")) {
append(removeList, tgt);
print("will remove callsign: "~tgt.callsign);
}
}
}
foreach(tgt ; removeList) {
# remove callsigns
call(func {targetsV2.remove(tgt);}, nil, var err = []);
}
};
var lookup = func (sign) {
foreach (tgt ; targetsV2.vector) {
if (tgt.callsign == sign) {
return tgt;
}
}
if ( getprop(opfor_switch) == 1 and (left(sign, 5) != "OPFOR" and left(sign,5) != "opfor")) {
print("creating new target in: " ~ sign);
tgt = target.new(sign);
targetsV2.append(tgt);
return tgt;
}
if ( getprop(friend_switch) == 1 and ( left(sign, 5) == "OPFOR" or left(sign,5) == "opfor" )) {
print("creating new target in: " ~ sign);
tgt = target.new(sign);
targetsV2.append(tgt);
return tgt;
}
return nil;
}
var PRIO_NORM = 0;
var PRIO_HIGH = 1;
var PRIO_LOW = 2;
var PRIO_FAST = 3;
var PRIO_SLOW = 4;
var PRIO_CLOSE = 5;
var PRIO_FAR = 6;
################### MAIN LOOP
var scan = func() {
setprop("sim/multiplay/visibility-range-nm", 250);
buildTargetList();
if ( getprop("/carrier/sunk") == 1 or getprop("/carrier/disabled") == 1) {
return;
}
if (systime() - start_time < setupTime ) {
printf("Seconds till activation: %.1f", setupTime - (systime() - start_time));
setprop("sam/timeleft", setupTime - (systime() - start_time));
setprop("sam/missiles",(NUM_MISSILES+1-ACTIVE_MISSILE));
setprop("sam/bursts", ROUNDS);
setprop("sam/info", "Preparing launch system");
settimer(scan,radar_update_time);
if (launcher_tilt_time > 0) {
setprop("sim/multiplay/generic/float[5]", launcher_final_tilt_deg*math.max(0,(systime() - start_time)-(setupTime-launcher_tilt_time))/launcher_tilt_time);#raise the tubes in last 15 secs of activation
} else {
setprop("sim/multiplay/generic/float[5]", launcher_final_tilt_deg);
}
setprop("sim/multiplay/generic/float[6]", 0);
setprop("sim/multiplay/generic/string[6]", "");
setprop("/sim/multiplay/generic/int[2]", 1);
return;
}
setprop("sim/multiplay/generic/float[5]", launcher_final_tilt_deg);
#### ITERATE THROUGH MP LIST ####
var radarOn = 0;
var my_pos = geo.aircraft_position();
var radarAlt = my_pos.alt()+radar_elevation_above_terrain_m;
my_pos.set_alt(radarAlt);
var mvec = props.globals.getNode("/ai/models").getChildren("multiplayer");
var tvec = props.globals.getNode("/ai/models").getChildren("tanker");
var avec = props.globals.getNode("/ai/models").getChildren("aircraft");
if (mvec!=nil and tvec != nil) {
mvec = mvec ~ tvec;
}
if (mvec!=nil and avec != nil) {
mvec = mvec ~ avec;
}
var prio_vector = [];#0:node,1:trigger,2:prio value
foreach(var mp; mvec){
if (mp.getNode("valid") == nil or mp.getNode("valid").getValue() != 1) continue;
var prio = fire_control(mp, my_pos);
append(prio_vector, prio);
if (prio[3] == 1) {
radarOn = 1;#this target is within envelope, we turn on radar.
}
}
prio_vector = sort(prio_vector, func (a,b) {if (a[2]>b[2]){return -1;} elsif (a[2]<b[2]) {return 1;} else {return 0;}});
foreach(var mp; prio_vector) {
#### DO WE HAVE FIRING SOLUTION... ####
# is plane in range, do we still have missiles, and is a missile already inbound, and has it been 4 seconds since the last missile launch?
var trigger = mp[1];
#print("dist to target = " ~ dist_to_target);
var lu = lookup(mp[0].getNode("callsign").getValue());
if ( launch_in_progress == 0 and trigger == true and lu != nil and lu.in_air < same_target_max_missiles and !lu.tracking and ACTIVE_MISSILE <= NUM_MISSILES and ( systime() - missile_delay_time > fire_minimum_interval ) ) { #
#### ... FOR THE MISSILE ####
#print("callsign " ~ cs ~ " found at " ~ dist_to_target);
missile_delay_time = systime();
mp[0].getNode("unique",1).setValue(rand());
armament.contact = radar_logic.Contact.new(mp[0], AIR);
launch_in_progress = 1;
missile_launch(mp[0], systime(), my_pos);
} elsif ( ciws_installed and trigger == -1 and ROUNDS > 0 and ( systime() - ciws_delay_time > 1.0 ) and lu != nil) {
#### ... FOR THE CIWS ####
var contact = radar_logic.Contact.new(mp[0], AIR);
var cord = contact.get_Coord();
var dist_nm = my_pos.direct_distance_to(cord)*M2NM;
var probabilityOfBurstKill = 0.50;
if (mp[0].getNode("velocities/true-airspeed-kt").getValue() > 50) {
probabilityOfBurstKill = extrapolate(dist_nm, 0, ciws_domain_nm, ciws_chance, 0);
}
var hits = math.max(0,int(extrapolate(rand(), 0, probabilityOfBurstKill, ciws_burst_rounds, 3)));#3 is a kill approx
var target_bearing = my_pos.course_to(cord);
setprop("sim/multiplay/generic/float[0]", -(target_bearing-getprop("orientation/heading-deg")));#CIWS horiz (inverted)
setprop("sim/multiplay/generic/float[1]", vector.Math.getPitch(my_pos, cord));#CIWS vert
setprop("sim/multiplay/generic/bool[0]",1);settimer(func {setprop("sim/multiplay/generic/bool[0]",0);}, 1);# for sound
if (hits > 0) {
var msg = notifications.ArmamentNotification.new("mhit", 4, -1*(ciws_shell+1));
msg.RelativeAltitude = 0;
msg.Bearing = 0;
msg.Distance = hits;
msg.RemoteCallsign = mp[0].getNode("callsign").getValue();
notifications.hitBridgedTransmitter.NotifyAll(msg);
damage.damageLog.push("CIWS fired | rounds remaining: " ~ ROUNDS ~ " | hit on: " ~ mp[0].getNode("callsign").getValue());
}
print("CIWS fired | bursts remaining: " ~ ROUNDS ~ " | "~hits~" hits on: " ~ mp[0].getNode("callsign").getValue() ~ " @ "~ sprintf("%.1f",dist_nm) ~" nm");
ciws_delay_time = systime();
ROUNDS = ROUNDS - 1;
setprop("sam/bursts", ROUNDS);
if (ROUNDS == 0) {
print("Launcher out of shell ammo.");
settimer(autoreload, reload_time);
reloading = 1;
reload_starting = systime();
}
}
if (lu != nil and lu.tracking) {
radarOn = 1;
}
}
setprop("/sim/multiplay/generic/int[2]",!radarOn);
if (launcher_align_to_target and ACTIVE_MISSILE > NUM_MISSILES and systime()-missile_release_time > 2) {
# rotate launcher back to forward:
var tgt_dir = 0;
var cur_dir = getprop("sim/multiplay/generic/float[6]");
var move_dir = geo.normdeg180(tgt_dir-cur_dir);
var max_dir = radar_update_time*align_speed_dps*0.25;
move_dir = math.clamp(move_dir, -max_dir, max_dir);
setprop("sim/multiplay/generic/float[6]", cur_dir+move_dir);
}
if (launch_in_progress == 0) {
if (reloading) {
setprop("sam/info", "Reloading");
setprop("sam/timeleft", reload_time - (systime() - reload_starting));
} else {
setprop("sam/info", "");
setprop("sam/timeleft", 0);
}
clearSingleLock();
thread.lock(mutexLock);
semi_active_track = nil;
thread.unlock(mutexLock);
} else {
setprop("sam/timeleft", 0);
}
if (getprop(getprop("payload/armament/MP-alt-ft")) == 0.0) {
# reset 'Follow view' to look at launcher
setprop(getprop("payload/armament/MP-lat"),getprop("position/latitude-deg"));
setprop(getprop("payload/armament/MP-lon"),getprop("position/longitude-deg"));
setprop(getprop("payload/armament/MP-alt-ft"),getprop("position/altitude-ft"));
}
setprop("sam/missiles",(NUM_MISSILES+1-ACTIVE_MISSILE));
settimer(scan,radar_update_time);
}
var clearSingleLock = func () {
thread.lock(mutexLock);
if (semi_active_track == nil) {
setprop("sim/multiplay/generic/string[6]", "");
} else {
setprop("sim/multiplay/generic/string[6]", left(md5(semi_active_track), 4));
}
thread.unlock(mutexLock);
}
################## FIRE CONTROL
################## ALL AI LOGIC RELATED TO FIGURING OUT IF A TARGET SHOULD BE SHOT AT SHOULD GO HERE.
var fire_control = func(mp, my_pos) {
# gather some data about the target
if ( mp.getNode("valid").getValue() == false ) { return [mp,false,0,0]; }
var ufo_pos = geo.Coord.new().set_latlon(mp.getNode("position/latitude-deg").getValue(),mp.getNode("position/longitude-deg").getValue(),(mp.getNode("position/altitude-ft").getValue() * FT2M));
var target_distance = my_pos.direct_distance_to(ufo_pos);
var target_altitude = mp.getNode("position/altitude-ft").getValue();
# is this plane a friend or foe?
var lu = lookup(mp.getNode("callsign").getValue());
if ( lu == nil ) { return [mp,false,0,0]; }
var target_airspeed = mp.getNode("velocities/true-airspeed-kt").getValue();
var target_ground_distance = my_pos.distance_to(ufo_pos);
var target_heading = mp.getNode("orientation/true-heading-deg").getValue();
var relative_bearing = math.abs(geo.normdeg180(ufo_pos.course_to(my_pos) - target_heading));
var target_relative_altitude = target_altitude - my_pos.alt()*M2FT;
var target_radial_airspeed = math.abs(math.abs(((relative_bearing / 90 ) - 1) * target_airspeed));#200kt against us = 200kt, 200kt at angle of us = 0kt, 200kt away from us = 200kt
var target_relative_pitch = vector.Math.getPitch(my_pos, ufo_pos);
# can the radar see it?
var data_link_match = false;
# foreach(var cx; gci.data_receive_callsigns) {
# if (cx[0] == callsign) {
# data_link_match = true;
# #print('tgt confirmed via datalink');
# }
# }
var visible = radar_logic.isNotBehindTerrain(mp);
if (ciws_installed and ROUNDS > 0 and target_distance*M2NM < ciws_domain_nm) {
#CIWS
var radarSeeTarget = 1;
if ( data_link_match == false ) {
if ( visible[0] == false ) {radarSeeTarget = 0 }
if ( target_relative_pitch < radar_lowest_pitch ) { radarSeeTarget = 0 } #
if ( target_distance*M2NM > 1.0 and visible[1] and math.abs(target_radial_airspeed) < 20 ) {radarSeeTarget = 0 } # i.e. notching with terrain behind
}
if (radarSeeTarget and rand() > target_distance*M2NM / ciws_domain_nm) {
var score = 0;
var priority = getprop("priority");
if (priority==PRIO_NORM) {
# nop
} elsif (priority==PRIO_HIGH) {
score = target_altitude;
} elsif (priority==PRIO_LOW) {
score = -target_altitude;
} elsif (priority==PRIO_FAST) {
score = target_radial_airspeed;
} elsif (priority==PRIO_SLOW) {
score = -target_radial_airspeed;
} elsif (priority==PRIO_CLOSE) {
score = -target_distance;
} elsif (priority==PRIO_FAR) {
score = target_distance;
}
return [mp,-1,score,1];
}
}
if ( data_link_match == false ) {
if (target_airspeed < 60) {return [mp,false,0,0];}
if ( visible[0] == false ) { return [mp,false,0,0]; }
if ( target_relative_pitch < radar_lowest_pitch ) { return [mp,false,0,0]; } #
if ( visible[1] and math.abs(target_radial_airspeed) < 20 ) { return [mp,false,0,0]; } # i.e. notching, landed aircraft
}
if ( target_distance * M2NM > missile_max_distance ) { return [mp,false,0,0]; }
# is the plane within the engagement envelope?
# the numbers after target_radial_airspeed are ( offset_of_engagement_envelope / speed_to_apply_that_offset )
# larger offset means it wont fire until the plane is closer.
# for visualization: https://www.desmos.com/calculator/gw570fa9km
if (!isInEngagementEnvelope(target_radial_airspeed, target_ground_distance, target_relative_altitude) ) { return [mp,false,0,0]; }
var the_dice = rand();
if ( the_dice > 0.20 ) {
var score = 0;
var priority = getprop("priority");
if (priority==PRIO_NORM) {
# nop
} elsif (priority==PRIO_HIGH) {
score = target_altitude;
} elsif (priority==PRIO_LOW) {
score = -target_altitude;
} elsif (priority==PRIO_FAST) {
score = target_radial_airspeed;
} elsif (priority==PRIO_SLOW) {
score = -target_radial_airspeed;
} elsif (priority==PRIO_CLOSE) {
score = -target_distance;
} elsif (priority==PRIO_FAR) {
score = target_distance;
}
return [mp,true,score,1];
} else {
return [mp,false,0,1];
}
}
################### MISSILE CONTROL
### missile reload
var reload = func(force = 1) {
#figure out how many to add
if (ACTIVE_MISSILE > NUM_MISSILES or force == 1) {
for ( var i = 0; i <= NUM_MISSILES; i = i + 1 ) {
if (armament.AIM.new(i,missile_name,missile_brevity, midflight) != -1) {
#if statement just in case reload was called before all missiles were fired. Cause avoid calling search() on same missile twice.
armament.AIM.active[i].start();
}
}
ACTIVE_MISSILE = 0;setprop("active", 0);
print("Launcher reloaded with "~(NUM_MISSILES+1)~" missiles.");
setprop("/sim/messages/copilot", "Launcher reloaded with "~(NUM_MISSILES+1)~" missiles.");
}
if (ROUNDS == 0 or force == 1) {
ROUNDS = ROUNDS_init;
print("Reloaded with "~(ROUNDS)~" bursts.");
}
setprop("sam/missiles",(NUM_MISSILES+1-ACTIVE_MISSILE));
setprop("sam/bursts", ROUNDS);
reloading = 0;
}
var autoreload = func() {
if (reloading) {
reloading = 0;
if (ACTIVE_MISSILE > NUM_MISSILES or ROUNDS == 0) {
reload(0);
print("Auto reloading completed.")
}
} else {
print("Auto reloading cancelled due to manual reload.")
}
}
### missile launch
var missile_launch = func(mp, launchtime, my_pos) {
if ( getprop("/carrier/sunk") == 1 or getprop("/carrier/disabled") == 1) {
var lu = lookup(mp.getNode("callsign").getValue());
if (lu != nil) {
lu.tracking = 0;
}
launch_in_progress = 0;
clearSingleLock();
return;
}
var ufo_pos = geo.Coord.new().set_latlon(mp.getNode("position/latitude-deg").getValue(),mp.getNode("position/longitude-deg").getValue(),(mp.getNode("position/altitude-ft").getValue() * 0.3048));
var target_bearing = my_pos.course_to(ufo_pos);
var info = mp.getNode("callsign").getValue();
var lu = lookup(mp.getNode("callsign").getValue());
if (getprop("sam/timeleft") != 0) {
launch_in_progress = 0;
if (lu != nil) {
lu.tracking = 0;
}
return;
} elsif ( armament.AIM.active[ACTIVE_MISSILE].status == 1 and systime() - launchtime > lockon_time and radar_logic.isNotBehindTerrain(mp)[0] == 1 ) {
var theMissile = armament.AIM.active[ACTIVE_MISSILE];
var brevity = theMissile.brevity;
#armament.defeatSpamFilter(brevity ~ " at: " ~ mp.getNode("callsign").getValue());
damage.damageLog.push(brevity ~ " at: " ~ mp.getNode("callsign").getValue());
if (launcher_align_to_target) {
setprop("sim/multiplay/generic/float[6]", target_bearing-getprop("orientation/heading-deg"));
theMissile.rail_head_deg = getprop("sim/multiplay/generic/float[6]");
}
if (sam_align_to_target) {
setprop("/orientation/heading-deg",target_bearing);
}
theMissile.release();
missile_release_time = systime();
ACTIVE_MISSILE = ACTIVE_MISSILE + 1;setprop("active", ACTIVE_MISSILE);
print("Fired "~missile_name~" #" ~ ACTIVE_MISSILE ~ " at: " ~ mp.getNode("callsign").getValue());
setprop("/sim/messages/copilot", "Launch at "~mp.getNode("callsign").getValue());
if (ACTIVE_MISSILE > NUM_MISSILES) {
setprop("/sim/messages/copilot", "Launcher out of ammo");
print("Launcher out of missile ammo.");
settimer(autoreload, reload_time);
reloading = 1;
reload_starting = systime();
}
if (lu != nil) {
append(lu.missiles, theMissile);
lu.in_air += 1;
lu.tracking = 0;
}
launch_in_progress = 0;
info = info~" (launched)";
setprop("sam/info", info);
setprop("sam/missiles",(NUM_MISSILES+1-ACTIVE_MISSILE));
clearSingleLock();
return;
} elsif ((systime() - launchtime) > (lockon_time*2) or radar_logic.isNotBehindTerrain(mp)[0] == 0) {
# launch cancelled so it dont forever goes in this loop and dont allow for other firings.
if (lu != nil) {
lu.tracking = 0;
}
setprop("/sim/messages/copilot", "SAM Canceled launch at "~mp.getNode("callsign").getValue());
launch_in_progress = 0;
info = info~" (cancelled)";
setprop("sam/info", info);
setprop("sam/missiles",(NUM_MISSILES+1-ACTIVE_MISSILE));
clearSingleLock();
return;
} else {
info = info~" (tracking)";
if (systime()-missile_release_time > 1.5) {
if (launcher_align_to_target) {
# now smoothly rotate launcher:
var tgt_dir = target_bearing-getprop("orientation/heading-deg");
var cur_dir = getprop("sim/multiplay/generic/float[6]");
var move_dir = geo.normdeg180(tgt_dir-cur_dir);
var max_dir = launch_update_time*align_speed_dps;
move_dir = math.clamp(move_dir, -max_dir, max_dir);
setprop("sim/multiplay/generic/float[6]", cur_dir+move_dir);
}
if (sam_align_to_target) {
var tgt_dir = target_bearing;
var cur_dir = getprop("orientation/heading-deg");
var move_dir = geo.normdeg180(tgt_dir-cur_dir);
var max_dir = launch_update_time*align_speed_dps;
move_dir = math.clamp(move_dir, -max_dir, max_dir);
setprop("orientation/heading-deg", cur_dir+move_dir);
}
}
setprop("sam/info", info);
if (mp.getNode("callsign") != nil and mp.getNode("callsign").getValue() != nil and mp.getNode("callsign").getValue() != "") {
setprop("sim/multiplay/generic/string[6]", left(md5(mp.getNode("callsign").getValue()), 4));
} else {
clearSingleLock();
}
if (lu != nil) {
lu.tracking = 1;
}
}
settimer( func { missile_launch(mp, launchtime, my_pos); },launch_update_time);
}
### missile set launched to false for target
var missile_listener = func {
foreach(var tgt ; targetsV2.vector) {
var missilesNew = [];
foreach(var missile ; tgt.missiles) {
if (missile != nil) {
if (missile.deleted) {
tgt.in_air -= 1;
} else {
append(missilesNew, missile);
}
}
}
tgt.missiles = missilesNew;
}
settimer(missile_listener, 2.5);
}
var extrapolate = func (x, x1, x2, y1, y2) {
return y1 + ((x - x1) / (x2 - x1)) * (y2 - y1);
}
################### MISC
var main_init_listener = setlistener("sim/signals/fdm-initialized", func {
print("fdm-initialized");
targetsV2 = std.Vector.new();# OO vector (to make removing item easier)
reload();
scan();
aircraft.data.save(0.5);# save the target list every 30 seconds
removelistener(main_init_listener);
setlistener(opfor_switch, func {
targetsV2 = std.Vector.new();# OO vector (to make removing item easier)
}, 0, 0);
setlistener(friend_switch, func {
targetsV2 = std.Vector.new();# OO vector (to make removing item easier)
}, 0, 0);
missile_listener();
setprop(getprop("payload/armament/MP-lat"),getprop("position/latitude-deg"));
setprop(getprop("payload/armament/MP-lon"),getprop("position/longitude-deg"));
setprop(getprop("payload/armament/MP-alt-ft"),getprop("position/altitude-ft"));
view.setViewByIndex(200);#follow view
}, 0, 0);
setlistener("sim/signals/reinit", func {
print("reinit");
start_time = systime();
});

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,423 @@
var clamp = func(v, min, max) { v < min ? min : v > max ? max : v }
var encode3bits = func(first, second, third) {
var integer = first;
integer = integer + 2 * second;
integer = integer + 4 * third;
return integer;
}
var versionString = getprop("sim/version/flightgear");
var version = split(".", versionString);
var major = num(version[0]);
var minor = num(version[1]);
var pica = num(version[2]);
var pickingMethod = 0;
if ((major == 2017 and minor == 2 and pica >= 1) or (major == 2017 and minor > 2) or major > 2017) {
pickingMethod = 1;
}
var FALSE = 0;
var TRUE = 1;
var AIR = 0;
var MARINE = 1;
var SURFACE = 2;
var ORDNANCE = 3;
var Contact = {
# For now only used in guided missiles, to make it compatible with Mirage 2000-5.
new: func(c, class) {
var obj = { parents : [Contact]};
#debug.benchmark("radar process1", func {
obj.rdrProp = c.getNode("radar");
obj.oriProp = c.getNode("orientation");
obj.velProp = c.getNode("velocities");
obj.posProp = c.getNode("position");
obj.heading = obj.oriProp.getNode("true-heading-deg");
#});
#debug.benchmark("radar process2", func {
obj.alt = obj.posProp.getNode("altitude-ft");
obj.lat = obj.posProp.getNode("latitude-deg");
obj.lon = obj.posProp.getNode("longitude-deg");
#});
#debug.benchmark("radar process3", func {
#As it is a geo.Coord object, we have to update lat/lon/alt ->and alt is in meters
obj.coord = geo.Coord.new();
obj.coord.set_latlon(obj.lat.getValue(), obj.lon.getValue(), obj.alt.getValue() * FT2M);
#});
#debug.benchmark("radar process4", func {
obj.pitch = obj.oriProp.getNode("pitch-deg");
obj.roll = obj.oriProp.getNode("roll-deg");
obj.speed = obj.velProp.getNode("true-airspeed-kt");
obj.vSpeed = obj.velProp.getNode("vertical-speed-fps");
obj.callsign = c.getNode("callsign", 1);
obj.shorter = c.getNode("model-shorter");
obj.orig_callsign = obj.callsign.getValue();
obj.name = c.getNode("name");
obj.sign = c.getNode("sign",1);
obj.valid = c.getNode("valid");
obj.painted = c.getNode("painted");
obj.unique = c.getNode("unique");
obj.validTree = 0;
#});
#debug.benchmark("radar process5", func {
#obj.transponderID = c.getNode("instrumentation/transponder/transmitted-id");
#});
#debug.benchmark("radar process6", func {
obj.acType = c.getNode("sim/model/ac-type");
obj.type = c.getName();
obj.index = c.getIndex();
obj.string = "ai/models/" ~ obj.type ~ "[" ~ obj.index ~ "]";
obj.shortString = obj.type ~ "[" ~ obj.index ~ "]";
#});
#debug.benchmark("radar process7", func {
obj.range = obj.rdrProp.getNode("range-nm");
obj.bearing = obj.rdrProp.getNode("bearing-deg");
obj.elevation = obj.rdrProp.getNode("elevation-deg");
obj.ubody = obj.rdrProp.getNode("velocities/uBody-fps");
obj.vbody = obj.rdrProp.getNode("velocities/vBody-fps");
obj.wbody = obj.rdrProp.getNode("velocities/wBody-fps");
#});
obj.deviation = nil;
obj.node = c;
obj.class = class;
obj.polar = [0,0];
obj.cartesian = [0,0];
return obj;
},
get_uBody: func {
var body = nil;
if (me.ubody != nil) {
body = me.ubody.getValue();
}
if(body == nil) {
body = me.get_Speed()*KT2FPS;
}
return body;
},
get_vBody: func {
var body = nil;
if (me.ubody != nil) {
body = me.vbody.getValue();
}
if(body == nil) {
body = 0;
}
return body;
},
get_wBody: func {
var body = nil;
if (me.ubody != nil) {
body = me.wbody.getValue();
}
if(body == nil) {
body = 0;
}
return body;
},
isValid: func () {
var valid = me.valid.getValue();
if (valid == nil) {
valid = FALSE;
}
if (me.callsign.getValue() != me.orig_callsign) {
valid = FALSE;
}
return valid;
},
isPainted: func () {
if (getprop("/carrier/sunk") == 1) {
return 0;
}
return isNotBehindTerrain(me.node)[0];
},
getUnique: func () {
if (me.unique == nil) {
me.unique = me.node.getNode("unique");
}
if (me.unique == nil) {
return nil;
}
var u = me.unique.getValue();
return u;
},
getElevation: func() {
var e = 0;
e = me.elevation.getValue();
if(e == nil or e == 0) {
# AI/MP has no radar properties
var self = geo.aircraft_position();
self.set_alt(self.alt()+fire_control.radar_elevation_above_terrain_m);
me.get_Coord();
var angleInv = clamp(self.distance_to(me.coord)/self.direct_distance_to(me.coord), -1, 1);
e = (self.alt()>me.coord.alt()?-1:1)*math.acos(angleInv)*R2D;
}
return e;
},
getNode: func () {
return me.node;
},
getFlareNode: func () {
return me.node.getNode("rotors/main/blade[3]/flap-deg");
},
getChaffNode: func () {
return me.node.getNode("rotors/main/blade[3]/position-deg");
},
setPolar: func(dist, angle) {
me.polar = [dist,angle];
},
setCartesian: func(x, y) {
me.cartesian = [x,y];
},
remove: func(){
if(me.validTree != 0){
me.validTree.setValue(0);
}
},
get_Coord: func(){
me.coord.set_latlon(me.lat.getValue(), me.lon.getValue(), me.alt.getValue() * FT2M);
var TgTCoord = geo.Coord.new(me.coord);
return TgTCoord;
},
get_Callsign: func(){
var n = me.callsign.getValue();
if(n != "" and n != nil) {
return n;
}
if (me.name == nil) {
me.name = me.getNode().getNode("name");
}
if (me.name == nil) {
n = "";
} else {
n = me.name.getValue();
}
if(n != "" and n != nil) {
return n;
}
n = me.sign.getValue();
if(n != "" and n != nil) {
return n;
}
return "UFO";
},
get_model: func(){
var n = "";
if (me.shorter == nil) {
me.shorter = me.node.getNode("model-shorter");
}
if (me.shorter != nil) {
n = me.shorter.getValue();
}
if(n != "" and n != nil) {
return n;
}
n = me.sign.getValue();
if(n != "" and n != nil) {
return n;
}
if (me.name == nil) {
me.name = me.getNode().getNode("name");
}
if (me.name == nil) {
n = "";
} else {
n = me.name.getValue();
}
if(n != "" and n != nil) {
return n;
}
return me.get_Callsign();
},
get_Speed: func(){
# return true airspeed
var n = me.speed.getValue();
return n;
},
get_Longitude: func(){
var n = me.lon.getValue();
return n;
},
get_Latitude: func(){
var n = me.lat.getValue();
return n;
},
get_Pitch: func(){
var n = me.pitch.getValue();
return n;
},
isVirtual: func(){
return 0;
},
get_Roll: func(){
var n = me.roll.getValue();
return n;
},
get_heading : func(){
var n = me.heading.getValue();
if(n == nil)
{
n = 0;
}
return n;
},
get_bearing: func(){
var n = 0;
n = me.bearing.getValue();
if(n == nil or n == 0) {
# AI/MP has no radar properties
n = me.get_bearing_from_Coord(geo.aircraft_position());
}
return n;
},
get_bearing_from_Coord: func(MyAircraftCoord){
me.get_Coord();
var myBearing = 0;
if(me.coord.is_defined()) {
myBearing = MyAircraftCoord.course_to(me.coord);
}
return myBearing;
},
get_reciprocal_bearing: func(){
return geo.normdeg(me.get_bearing() + 180);
},
get_deviation: func(true_heading_ref, coord){
me.deviation = - deviation_normdeg(true_heading_ref, me.get_bearing_from_Coord(coord));
return me.deviation;
},
get_altitude: func(){
#Return Alt in feet
return me.alt.getValue();
},
get_Elevation_from_Coord: func(MyAircraftCoord) {
me.get_Coord();
var value = (me.coord.alt() - MyAircraftCoord.alt()) / me.coord.direct_distance_to(MyAircraftCoord);
if (math.abs(value) > 1) {
# warning this else will fail if logged in as observer and see aircraft on other side of globe
return 0;
}
var myPitch = math.asin(value) * R2D;
return myPitch;
},
get_total_elevation_from_Coord: func(own_pitch, MyAircraftCoord){
var myTotalElevation = - deviation_normdeg(own_pitch, me.get_Elevation_from_Coord(MyAircraftCoord));
return myTotalElevation;
},
get_total_elevation: func(own_pitch) {
me.deviation = - deviation_normdeg(own_pitch, me.getElevation());
return me.deviation;
},
get_range: func() {
var r = 0;
if(me.range == nil or me.range.getValue() == nil or me.range.getValue() == 0) {
# AI/MP has no radar properties
me.get_Coord();
r = me.coord.direct_distance_to(geo.aircraft_position()) * M2NM;
} else {
r = me.range.getValue();
}
return r;
},
get_range_from_Coord: func(MyAircraftCoord) {
var myCoord = me.get_Coord();
var myDistance = 0;
if(myCoord.is_defined()) {
myDistance = MyAircraftCoord.direct_distance_to(myCoord) * M2NM;
}
return myDistance;
},
get_type: func () {
return me.class;
},
get_cartesian: func() {
return me.cartesian;
},
get_polar: func() {
return me.polar;
},
};
var isNotBehindTerrain = func( mp ) {
var pos = mp.getNode("position");
var alt = pos.getNode("altitude-ft").getValue();
var lat = pos.getNode("latitude-deg").getValue();
var lon = pos.getNode("longitude-deg").getValue();
if(alt == nil or lat == nil or lon == nil) {
return [0,0]; # invisible and not in front of terrain
}
var aircraftPos = geo.Coord.new().set_latlon(lat, lon, alt*FT2M);
var myPos = geo.aircraft_position();
myPos.set_alt(myPos.alt()+fire_control.radar_elevation_above_terrain_m);
var target_distance = myPos.direct_distance_to(aircraftPos);
call(func {
if (target_distance*0.001 > 3.57*(math.sqrt(myPos.alt())+math.sqrt(alt*FT2M))) {
# behind earth curvature
#print("behind earth curvature");
return [0,0]; # invisible and not in front of terrain
}
},nil,nil,var err =[]);
var xyz = {"x":myPos.x(), "y":myPos.y(), "z":myPos.z()};
var dir = {"x":aircraftPos.x()-myPos.x(), "y":aircraftPos.y()-myPos.y(), "z":aircraftPos.z()-myPos.z()};
# Check for terrain between own aircraft and other:
v = get_cart_ground_intersection(xyz, dir);
if (v == nil) {
return [1,0]; # visible and not in front of terrain
#printf("No terrain, planes has clear view of each other");
} else {
var terrain = geo.Coord.new();
terrain.set_latlon(v.lat, v.lon, v.elevation);
var maxDist = myPos.direct_distance_to(aircraftPos);
var terrainDist = myPos.direct_distance_to(terrain);
if (terrainDist < maxDist-1) {
#printf("terrain found between me and aircraft %.1f meter away.", terrainDist);
return [0,0]; # visible and not in front of terrain
} else {
#print("The planes has clear view of each other");
return [1,1]; # visible and in front of terrain
}
}
}

Binary file not shown.

Binary file not shown.

View File

@ -4,10 +4,10 @@
<fx>
<launch>
<name>missile</name>
<path>Aircraft/MIM-104D/Sounds/launch.wav</path>
<path>Aircraft/MIM-104D/Sounds/launch-gem.wav</path>
<mode>once</mode>
<condition>
<property>payload/armament/ged/sound-fire-on-off</property>
<property>payload/armament/gem/sound-fire-on-off</property>
</condition>
<reference-dist>50</reference-dist>
<max-dist>15000</max-dist>
@ -21,5 +21,73 @@
<max>1</max>
</volume>
</launch>
<missile-hit>
<!-- multiple of these so the sound can be played over each other -->
<name>missile-hit0</name>
<path>Aircraft/MIM-104D/Sounds/missile-explo.wav</path>
<mode>once</mode>
<type>avionics</type>
<condition>
<equals>
<property>payload/armament/flags/explode-sound-on-0</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>payload/armament/flags/explode-sound-vol-0</property>
<factor>1</factor>
</volume>
</missile-hit>
<missile-hit>
<!-- multiple of these so the sound can be played over each other -->
<name>missile-hit1</name>
<path>Aircraft/MIM-104D/Sounds/missile-explo.wav</path>
<mode>once</mode>
<type>avionics</type>
<condition>
<equals>
<property>payload/armament/flags/explode-sound-on-1</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>payload/armament/flags/explode-sound-vol-1</property>
<factor>1</factor>
</volume>
</missile-hit>
<missile-hit>
<!-- multiple of these so the sound can be played over each other -->
<name>missile-hit2</name>
<path>Aircraft/MIM-104D/Sounds/missile-explo.wav</path>
<mode>once</mode>
<type>avionics</type>
<condition>
<equals>
<property>payload/armament/flags/explode-sound-on-2</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>payload/armament/flags/explode-sound-vol-2</property>
<factor>1</factor>
</volume>
</missile-hit>
<missile-hit>
<!-- multiple of these so the sound can be played over each other -->
<name>missile-hit3</name>
<path>Aircraft/MIM-104D/Sounds/missile-explo.wav</path>
<mode>once</mode>
<type>avionics</type>
<condition>
<equals>
<property>payload/armament/flags/explode-sound-on-3</property>
<value>1</value>
</equals>
</condition>
<volume>
<property>payload/armament/flags/explode-sound-vol-3</property>
<factor>1</factor>
</volume>
</missile-hit>
</fx>
</PropertyList>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

BIN
MIM-104D/thumbnail.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
MIM-104D/thumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB