Made the repo more up-to-date.

This commit is contained in:
Nikolai V Chr 2019-04-14 08:57:01 +02:00
parent eb205cc8ff
commit d7aa0c93cc
21 changed files with 1476 additions and 560 deletions

View File

@ -60,6 +60,7 @@
<sim>
<author>pinto</author>
<description>BUK-M2</description>
<long-description>BUK-M2 is a modern Russian self-propelled surface to air missile system.</long-description>
<status>alpha</status>
<aircraft-version>0.1</aircraft-version>
@ -87,6 +88,19 @@
<splash-texture>Aircraft/BUK-M2/splash1.png</splash-texture>
</startup>
<previews>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>gui/1.png</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>gui/2.png</path>
</preview>
</previews>
<current-view>
<deck-park type="bool">true</deck-park>
@ -106,6 +120,10 @@
</font>
</hud>
<tower>
<auto-position type="bool">true</auto-position>
</tower>
<systems>
<autopilot>
<path>Systems/fbw.xml</path>
@ -119,8 +137,10 @@
</property-rule>
</systems>
<multiplay>
<visibility-range-nm type="int">250</visibility-range-nm>
<generic>
<int n="0" type="int">0</int>
<int n="2" type="int">0</int>
</generic>
</multiplay>
@ -138,9 +158,41 @@
</script>
</binding>
</item>
<item>
<label>Targets</label>
<name>enemies</name>
<binding>
<command>dialog-show</command>
<dialog-name>enemies</dialog-name>
</binding>
</item>
<item>
<label>Priority</label>
<name>enemies</name>
<binding>
<command>dialog-show</command>
<dialog-name>priority</dialog-name>
</binding>
</item>
</menu>
</default>
</menubar>
<aircraft-data>
<!-- Properties that get saved to persist locally between FG sessions -->
<path>enemies/e1</path>
<path>enemies/e2</path>
<path>enemies/e3</path>
<path>enemies/e4</path>
<path>enemies/e5</path>
<path>enemies/e6</path>
<path>enemies/e7</path>
<path>enemies/e8</path>
<path>enemies/e9</path>
<path>enemies/e10</path>
<path>enemies/e11</path>
<path>enemies/e12</path>
</aircraft-data>
</sim>
<controls>
@ -149,33 +201,33 @@
<trigger type="bool">false</trigger>
<station n="1">
<offsets>
<x-m type="double"> 4.15986</x-m>
<y-m type="double"> -2.70311</y-m>
<z-m type="double"> 3.67645</z-m>
<x-m type="double"> 2.00744</x-m>
<y-m type="double"> -1.27342</y-m>
<z-m type="double"> 4.26168</z-m>
</offsets>
<trigger type="bool">false</trigger>
</station>
<station n="2">
<offsets>
<x-m type="double"> -0.02697</x-m>
<y-m type="double"> -0.98148</y-m>
<z-m type="double"> 3.94307</z-m>
<x-m type="double"> 2.00744</x-m>
<y-m type="double"> -0.42511</y-m>
<z-m type="double"> 4.26168</z-m>
</offsets>
<trigger type="bool">false</trigger>
</station>
<station n="3">
<offsets>
<x-m type="double"> 4.15986</x-m>
<y-m type="double"> 2.70311</y-m>
<z-m type="double"> 3.67645</z-m>
<x-m type="double"> 2.00744</x-m>
<y-m type="double"> 0.42511</y-m>
<z-m type="double"> 4.26168</z-m>
</offsets>
<trigger type="bool">false</trigger>
</station>
<station n="4">
<offsets>
<x-m type="double"> -0.02697</x-m>
<y-m type="double"> 0.98148</y-m>
<z-m type="double"> 3.94307</z-m>
<x-m type="double"> 2.00744</x-m>
<y-m type="double"> 1.27342</y-m>
<z-m type="double"> 4.26168</z-m>
</offsets>
<trigger type="bool">false</trigger>
</station>
@ -195,44 +247,54 @@
<armament>
<models type="string">Aircraft/BUK-M2/Models/Armament/Weapons/</models>
<modelsUseCase type="bool">true</modelsUseCase>
<modelsUpperCase type="bool">true</modelsUpperCase>
<MP-lat type="string">rotors/main/blade[0]/flap-deg</MP-lat>
<MP-lon type="string">rotors/main/blade[1]/flap-deg</MP-lon>
<MP-alt type="string">rotors/main/blade[2]/flap-deg</MP-alt>
<hit-interpolation type="bool">true</hit-interpolation>
<pylon-offset type="int">1</pylon-offset>
<pylon-stations>controls/armament</pylon-stations>
<station-name type="string">station</station-name>
<msg type="bool">true</msg>
<damage type="bool">true</damage>
<!-- speed: M4 diameter: 0.4m lenght: 5.5-->
<!-- speed: Mach 4 length: 5.5m -->
<m317>
<sound-on-off type="bool">false</sound-on-off>
<sound-volume type="double">0.0</sound-volume>
<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">APN</navigation> <!-- new -->
<navigation type="string">APN0506</navigation> <!-- horizontal APN, vertical aim 5 degrees above for 6 seconds -->
<all-aspect type="bool">true</all-aspect>
<max-fire-range-nm type="int">31</max-fire-range-nm>
<max-fire-range-nm type="int">31</max-fire-range-nm> <!-- -->
<FCS-field-deg type="int">360</FCS-field-deg>
<seeker-field-deg type="int">360</seeker-field-deg>
<max-g type="int">24</max-g>
<thrust-lbf-stage-1 type="double">18000</thrust-lbf-stage-1> <!-- changed -->
<thrust-lbf-stage-2 type="double">6000</thrust-lbf-stage-2> <!-- changed -->
<stage-1-duration-sec type="double">8</stage-1-duration-sec> <!-- changed -->
<stage-2-duration-sec type="double">18</stage-2-duration-sec><!-- changed -->
<weight-launch-lbs>1576</weight-launch-lbs>
<weight-warhead-lbs>145</weight-warhead-lbs>
<weight-fuel-lbs>900</weight-fuel-lbs> <!-- new -->
<drag-coeff type="double">0.15</drag-coeff> <!-- changed -->
<drag-area type="double">1.312336</drag-area> <!-- changed -->
<seeker-field-deg type="int">170</seeker-field-deg>
<max-g type="int">24</max-g> <!-- wikipedia -->
<thrust-lbf-stage-1 type="double">16500</thrust-lbf-stage-1> <!-- changed -->
<thrust-lbf-stage-2 type="double">0</thrust-lbf-stage-2> <!-- authentic -->
<stage-1-duration-sec type="double">15</stage-1-duration-sec> <!-- http://www.whathappenedtoflightmh17.com/a-detailed-description-of-the-buk-sa-11-which-could-have-shot-down-mh17/#prettyPhoto -->
<stage-2-duration-sec type="double">0</stage-2-duration-sec><!-- -->
<weight-launch-lbs>1576</weight-launch-lbs> <!-- authentic -->
<weight-warhead-lbs>145</weight-warhead-lbs> <!-- authentic -->
<weight-fuel-lbm>900</weight-fuel-lbm> <!-- -->
<drag-coeff type="double">0.25</drag-coeff> <!-- -->
<cross-section-sqft type="double">1.312336</cross-section-sqft> <!-- authentic (0.4m diameter) -->
<arming-time-sec type="double">2</arming-time-sec>
<min-speed-for-guiding-mach type="double">0.35</min-speed-for-guiding-mach>
<self-destruct-time-sec type="double">120</self-destruct-time-sec>
<min-speed-for-guiding-mach type="double">0.5</min-speed-for-guiding-mach>
<self-destruct-time-sec type="double">60</self-destruct-time-sec>
<seeker-angular-speed-dps type="double">3000</seeker-angular-speed-dps>
<loft-altitude type="int">0</loft-altitude>
<min-fire-range-nm type="double">2.0</min-fire-range-nm>
<max-report-distance type="double">200</max-report-distance> <!-- new -->
<rail type="bool">true</rail> <!-- changed -->
<rail-length-m type="double">5.5</rail-length-m> <!-- changed -->
<min-fire-range-nm type="double">1.6</min-fire-range-nm> <!-- authentic -->
<max-report-distance type="double">200</max-report-distance> <!-- -->
<rail type="bool">true</rail> <!-- -->
<rail-length-m type="double">5.5</rail-length-m> <!-- authentic length-->
<rail-point-forward type="bool">false</rail-point-forward>
<rail-pitch-deg type="double">30</rail-pitch-deg> <!-- new -->
<rail-pitch-deg type="double">24</rail-pitch-deg> <!-- matching mount -->
<chaff-resistance type="double">0.95</chaff-resistance>
<proportionality-constant type="double">3</proportionality-constant>
<ready-time type="int">1</ready-time>
<class type="string">A</class>
<fire-msg>Bird away</fire-msg>
<telemetry type="bool">true</telemetry>
</m317>
</armament>
</payload>
@ -250,6 +312,38 @@
</blade>
</main>
</rotors>
<sam>
<impact0 type="double">-1</impact0>
<impact1 type="double">-1</impact1>
<impact2 type="double">-1</impact2>
<impact3 type="double">-1</impact3>
<hit0 type="double">-1</hit0>
<hit1 type="double">-1</hit1>
<hit2 type="double">-1</hit2>
<hit3 type="double">-1</hit3>
<missiles type="double">4</missiles>
<timeleft type="double">600</timeleft>
<damage type="double">100</damage>
</sam>
<enemies>
<e1 userarchive="y" type="string">Leto</e1>
<e2 userarchive="y" type="string">swamp</e2>
<e3 userarchive="y" type="string">pinto</e3>
<e4 userarchive="y" type="string">fb237</e4>
<e5 userarchive="y" type="string">Wilco-1</e5>
<e6 userarchive="y" type="string">Kokos</e6>
<e7 userarchive="y" type="string">J-Mav16</e7>
<e8 userarchive="y" type="string">S</e8>
<e9 userarchive="y" type="string">Raider1</e9>
<e10 userarchive="y" type="string">Slobb</e10>
<e11 userarchive="y" type="string">5H1N0B1</e11>
<e12 userarchive="y" type="string">SNOWY1</e12>
</enemies>
<priority type="int">0</priority>
<priority0 type="int">1</priority0>
<nasal>
<carrier>
@ -261,6 +355,9 @@
<radar_logic>
<file>Aircraft/BUK-M2/Nasal/radar-logic.nas</file>
</radar_logic>
<vector>
<file>Aircraft/BUK-M2/Nasal/vector.nas</file><!-- needed by the guided-missiles -->
</vector>
<armament>
<file>Aircraft/BUK-M2/Nasal/guided-missiles.nas</file>
</armament>

View File

@ -84,7 +84,7 @@
<enable-hat>false</enable-hat>
</ladder>
<label>
<!--<label>
<name>Wind Angle Runway</name>
<x>-300</x>
<y>190</y>
@ -98,7 +98,7 @@
<input>
<property>/orientation/relative-wind-deg</property>
</input>
</label>
</label>-->
<label>
<name>Height</name>
@ -264,7 +264,7 @@
</input>
</label>
<label>
<!--<label>
<name>Magnetic Heading</name>
<x>-300</x>
<y>-225</y>
@ -310,15 +310,15 @@
<input>
<property>/velocities/wind-speed-runway-kt</property>
</input>
</label>
</label>-->
<label>
<!--<label>
<name>Speed</name>
<x>100</x>
<y>-225</y>
<width>200</width>
<height>25</height>
<prefix> Speed: </prefix>
<prefix> My speed: </prefix>
<postfix> kts</postfix>
<halign>left</halign>
<format>%2.1f</format>
@ -326,9 +326,9 @@
<input>
<property>/velocities/groundspeed-kt</property>
</input>
</label>
</label>-->
<label>
<!--<label>
<name>Target Speed</name>
<x>100</x>
<y>-200</y>
@ -342,6 +342,214 @@
<input>
<property>/carrier/fbw/target/groundspeed-kt</property>
</input>
</label>-->
<label>
<name>Time to impact</name>
<x>150</x>
<y>50</y>
<width>200</width>
<height>25</height>
<prefix>1st Time to impact: </prefix>
<postfix> sec</postfix>
<halign>left</halign>
<format>%2.1f</format>
<box>true</box>
<input>
<property>sam/impact0</property>
</input>
</label>
<label>
<name>Time to impact</name>
<x>150</x>
<y>0</y>
<width>200</width>
<height>25</height>
<prefix>2nd Time to impact: </prefix>
<postfix> sec</postfix>
<halign>left</halign>
<format>%2.1f</format>
<box>true</box>
<input>
<property>sam/impact1</property>
</input>
</label>
<label>
<name>Time to impact</name>
<x>150</x>
<y>-50</y>
<width>200</width>
<height>25</height>
<prefix>3rd Time to impact: </prefix>
<postfix> sec</postfix>
<halign>left</halign>
<format>%2.1f</format>
<box>true</box>
<input>
<property>sam/impact2</property>
</input>
</label>
<label>
<name>Time to impact</name>
<x>150</x>
<y>-100</y>
<width>200</width>
<height>25</height>
<prefix>4th Time to impact: </prefix>
<postfix> sec</postfix>
<halign>left</halign>
<format>%2.1f</format>
<box>true</box>
<input>
<property>sam/impact3</property>
</input>
</label>
<label>
<name>Hit chance</name>
<x>150</x>
<y>25</y>
<width>200</width>
<height>25</height>
<prefix>1st Hit chance: </prefix>
<postfix> %%</postfix>
<halign>left</halign>
<format>%d</format>
<box>true</box>
<input>
<property>sam/hit0</property>
</input>
</label>
<label>
<name>Hit chance</name>
<x>150</x>
<y>-25</y>
<width>200</width>
<height>25</height>
<prefix>2nd Hit chance: </prefix>
<postfix> %%</postfix>
<halign>left</halign>
<format>%d</format>
<box>true</box>
<input>
<property>sam/hit1</property>
</input>
</label>
<label>
<name>Hit chance</name>
<x>150</x>
<y>-75</y>
<width>200</width>
<height>25</height>
<prefix>3rd Hit chance: </prefix>
<postfix> %%</postfix>
<halign>left</halign>
<format>%d</format>
<box>true</box>
<input>
<property>sam/hit2</property>
</input>
</label>
<label>
<name>Hit chance</name>
<x>150</x>
<y>-125</y>
<width>200</width>
<height>25</height>
<prefix>4th Hit chance: </prefix>
<postfix> %%</postfix>
<halign>left</halign>
<format>%d</format>
<box>true</box>
<input>
<property>sam/hit3</property>
</input>
</label>
<label>
<name>ETA</name>
<x>150</x>
<y>-175</y>
<width>200</width>
<height>25</height>
<prefix>Time before operational: </prefix>
<postfix> sec</postfix>
<halign>left</halign>
<format>%d</format>
<box>true</box>
<input>
<property>sam/timeleft</property>
</input>
</label>
<label>
<name>stores</name>
<x>-300</x>
<y>-175</y>
<width>125</width>
<height>25</height>
<prefix> Missiles ready: </prefix>
<postfix></postfix>
<halign>left</halign>
<format>%d</format>
<box>true</box>
<input>
<property>/sam/missiles</property>
</input>
</label>
<label>
<name>damage</name>
<x>-150</x>
<y>-175</y>
<width>125</width>
<height>25</height>
<prefix> Integrity: </prefix>
<postfix> %%</postfix>
<halign>left</halign>
<format>%3.1f</format>
<box>true</box>
<input>
<property>/sam/damage</property>
</input>
</label>
<label>
<name>Target info</name>
<x>-300</x>
<y>-225</y>
<width>375</width>
<height>25</height>
<prefix> Next target: </prefix>
<postfix></postfix>
<halign>left</halign>
<format>%s</format>
<box>true</box>
<input>
<property>/sam/info</property>
</input>
</label>
<label>
<name>tower</name>
<x>100</x>
<y>-225</y>
<width>200</width>
<height>25</height>
<prefix> Placement near: </prefix>
<postfix></postfix>
<halign>left</halign>
<format>%s</format>
<box>true</box>
<input>
<property>/sim/tower/airport-id</property>
</input>
</label>
</PropertyList>

View File

@ -4,6 +4,50 @@
<path>BUK-M2.ac</path>
<animation>
<type>select</type>
<object-name>missile1</object-name>
<condition>
<less-than>
<property>active</property>
<value>1</value>
</less-than>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>missile2</object-name>
<condition>
<less-than>
<property>active</property>
<value>2</value>
</less-than>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>missile3</object-name>
<condition>
<less-than>
<property>active</property>
<value>3</value>
</less-than>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>missile4</object-name>
<condition>
<less-than>
<property>active</property>
<value>4</value>
</less-than>
</condition>
</animation>
<model>
<path>Aircraft/BUK-M2/Models/smoke.xml</path>
<offsets>

View File

@ -28,10 +28,13 @@ var warhead_lbs = {
"AGM-84": 488.00,
"AGM-88": 146.00,
"AGM65": 200.00,
"AGM-154A": 493.00,
"AGM-158": 1000.00,
"ALARM": 450.00,
"AM39-Exocet": 364.00,
"AS-37-Martel": 330.00,
"AS30L": 529.00,
"CBU-87": 128.00,
"Exocet": 364.00,
"FAB-100": 92.59,
"FAB-250": 202.85,
@ -81,6 +84,7 @@ var incoming_listener = func {
var last_vector = split(":", last);
var author = last_vector[0];
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
if (size(last_vector) > 1 and author != callsign) {
# not myself
#print("not me");
@ -175,11 +179,11 @@ var incoming_listener = func {
return;
}
var prob = 1;
if (type == "M90" and distance < 300) {
var failed = fail_systems(warhead_lbs[type]/2);
return;
} elsif (distance < 150) {
var prob = 1;
if ( distance > 50 ) {
distance = distance - 50;
prob = 1 - (distance/100);
@ -197,6 +201,14 @@ var incoming_listener = func {
print("cannon");
if (size(last_vector) > 2 and last_vector[2] == " "~callsign) {
print("cannon hit us");
#"Leto: Gun Splash On : SA-11"
#"Leto: KCA cannon shell hit: SA-11: 4 hits:..."
if (size(last_vector) < 4) {
# msg is either missing number of hits, or has no trailing dots from spam filter.
print('"'~last~'" is not a legal hit message, tell the shooter to upgrade his OPRF plane :)');
return;
}
var last3 = split(" ", last_vector[3]);
#print("last3[2]: " ~ last3[2]);
#print("last3[1]: " ~ last3[1]);
@ -211,12 +223,12 @@ var incoming_listener = func {
var probability = cannon_types[last_vector[1]];
for (var i = 1; i <= hit_count; i = i + 1) {
var failed = fail_systems(probability);
damaged_sys = damaged_sys + failed;
# damaged_sys = damaged_sys + failed;
}
# that someone is me!
#print("hitting me");
printf("Took %.1f%% damage from cannon! %s systems was hit.", probability*hit_count*100, damaged_sys);
#printf("Took %.1f%% damage from cannon! %s systems was hit.", probability*hit_count*100, damaged_sys);
}
}
}
@ -234,10 +246,12 @@ var maxDamageDistFromWarhead = func (lbs) {
var fail_systems = func (damage) {
hp = hp - damage;
print("HP: " ~ hp ~ "/" ~ hp_max);
setprop("sam/damage", math.max(0,100*hp/hp_max));
if ( hp < 0 ) {
setprop("/carrier/sunk/",1);
setprop("/sim/multiplay/generic/int[2]",1);
setprop("/sim/multiplay/generic/int[0]",1);
setprop("/sim/messages/copilot", "SAM dead.");
}
};
@ -281,4 +295,4 @@ var logTime = func{
}
}
setlistener("/sim/multiplay/chat-history", incoming_listener, 0, 0);
setlistener("/sim/multiplay/chat-history", incoming_listener, 0, 0);

BIN
BUK-M2/gui/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
BUK-M2/gui/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

@ -28,10 +28,13 @@ var warhead_lbs = {
"AGM-84": 488.00,
"AGM-88": 146.00,
"AGM65": 200.00,
"AGM-154A": 493.00,
"AGM-158": 1000.00,
"ALARM": 450.00,
"AM39-Exocet": 364.00,
"AS-37-Martel": 330.00,
"AS30L": 529.00,
"CBU-87": 128.00,
"Exocet": 364.00,
"FAB-100": 92.59,
"FAB-250": 202.85,

View File

@ -1,51 +1,70 @@
var clamp = func(v, min, max) { v < min ? min : v > max ? max : v }
var TRUE = 1;
var FALSE = 0;
var hp = 10000;
var hp_max = hp;
#
# Install: Include this code into an aircraft to make it damagable. (remember to add it to the -set file)
#
# Author: Nikolai V. Chr. (with some improvement by Onox and Pinto)
#
#
var clamp = func(v, min, max) { v < min ? min : v > max ? max : v }
#
# Install: Include this code into an aircraft to make it damageable. (remember to add it to the -set file)
#
# Authors: Nikolai V. Chr. and Pinto (with improvement by Onox)
#
#
############################ Config ######################################################################################
var full_damage_dist_m =10;# Can vary from aircraft to aircraft depending on how many failure modes it has.
# Many modes (like Viggen) ought to have lower number like zero.
# Few modes (like F-14) ought to have larger number such as 3.
# For assets this should be average radius of the asset.
var use_hitpoints_instead_of_failure_modes_bool = 1;# mainly used by assets that don't have failure modes.
var hp_max = 1000;# given a direct hit, how much pounds of warhead is needed to kill. Only used if hitpoints is enabled.
var hitable_by_air_munitions = 0; # if anti-air can do damage
var hitable_by_cannon = 1; # if cannon can do damage
var hitable_by_ground_munitions = 1;# if anti-ground/marine can do damage
var is_fleet = 0; # Is really 7 ships, 3 of which has offensive missiles.
##########################################################################################################################
##
## TODO:
## Include mechanics for hitting fleet
## Move all to emesary
##
var TRUE = 1;
var FALSE = 0;
var hp = hp_max;
var cannon_types = {
" M70 rocket hit": 0.25, #135mm
" M55 cannon shell hit": 0.10, # 30mm
" KCA cannon shell hit": 0.10, # 30mm
" Gun Splash On ": 0.10, # 30mm
" M61A1 shell hit": 0.05, # 20mm
" GAU-8/A hit": 0.10, # 30mm
" BK27 cannon hit": 0.07, # 27mm
" GSh-30 hit": 0.10, # 30mm
" GSh-23 hit": 0.065,# 23mm
" 7.62 hit": 0.005,# 7.62mm
" 50 BMG hit": 0.015,# 12.7mm
" S-5 rocket hit": 0.20, #55mm
};
#
# 0.20 means a direct hit will disable 20% of the failure modes in average.
# 0.20 also means a direct hit will do 20 hitpoints damage.
#
" M70 rocket hit": 0.250, #135mm
" S-5 rocket hit": 0.200, # 55mm
" M55 cannon shell hit": 0.100, # 30mm
" KCA cannon shell hit": 0.100, # 30mm
" Gun Splash On ": 0.100, # 30mm
" GSh-30 hit": 0.100, # 30mm
" GAU-8/A hit": 0.100, # 30mm
" BK27 cannon hit": 0.070, # 27mm
" GSh-23 hit": 0.065, # 23mm
" M61A1 shell hit": 0.050, # 20mm
" 50 BMG hit": 0.015, # 12.7mm (non-explosive)
" 7.62 hit": 0.005, # 7.62mm (non-explosive)
};
# lbs of warheads is explosive+fragmentation+fuse, so total warhead mass.
var warhead_lbs = {
# Anti-ground/marine warheads (sorted alphabetically)
"AGM-65": 126.00,
"AGM-84": 488.00,
"AGM-88": 146.00,
"AGM65": 200.00,
"AGM-154A": 493.00,
"AGM-158": 1000.00,
"ALARM": 450.00,
"AM39-Exocet": 364.00,
"AS-37-Martel": 330.00,
"AS30L": 529.00,
"CBU-87": 3.00,# bomblet warhead.
"Exocet": 364.00,
"FAB-100": 92.59,
"FAB-250": 202.85,
@ -59,12 +78,10 @@ var warhead_lbs = {
"KAB-500": 564.38,
"Kh-25MP": 197.53,
"Kh-66": 244.71,
"KN-06": 315.00,
"LAU-68": 10.00,
"M317": 145.00,
"M71": 200.00,
"M71R": 200.00,
"M90": 500.00,
"M90": 3.00,# bomblet warhead.
"MK-82": 192.00,
"MK-83": 445.00,
"MK-84": 945.00,
@ -77,8 +94,7 @@ var warhead_lbs = {
"RN-18T": 1200.00, #fictional, thermobaeric replacement for the RN-28 nuclear bomb
"RS-2US": 28.66,
"S-21": 245.00,
"S-24": 271.00,
"S530D": 66.00,
"S-24": 271.00,
"SCALP": 992.00,
"Sea Eagle": 505.00,
"SeaEagle": 505.00,
@ -87,6 +103,82 @@ var warhead_lbs = {
"ZB-500": 473.99,
};
var warhead_air_lbs = {
# Anti-air warheads (sorted alphabetically)
"aim-120": 44.00,
"AIM-120": 44.00,
"AIM-54": 135.00,
"aim-7": 88.00,
"AIM-7": 88.00,
"aim-9": 20.80,
"AIM-9": 20.80,
"AIM120": 44.00,
"AIM132": 22.05,
"AIM9": 20.80,
"KN-06": 315.00,
"M317": 145.00,
"Magic-2": 27.00,
"Matra MICA": 30.00,
"Matra R550 Magic 2": 27.00,
"MATRA-R530": 55.00,
"MatraMica": 30.00,
"MatraMicaIR": 30.00,
"MatraR550Magic2": 27.00,
"Meteor": 55.00,
"MICA-EM": 30.00,
"MICA-IR": 30.00,
"R-13M": 16.31,
"R-27R1": 85.98,
"R-27T1": 85.98,
"R-3R": 16.31,
"R-3S": 16.31,
"R-55": 20.06,
"R-60": 6.60,
"R-60M": 7.70,
"R-73E": 16.31,
"R-77": 49.60,
"R74": 16.00,
"RB-05A": 353.00,
"RB-24": 20.80,
"RB-24J": 20.80,
"RB-71": 88.00,
"RB-74": 20.80,
"RB-99": 44.00,
"S530D": 66.00,
};
var cluster = {
# cluster munition list
"M90": nil,
"CBU-87": nil,
};
var fireMsgs = {
# F14
" FOX3 at": nil, # radar
" FOX2 at": nil, # heat
" FOX1 at": nil, # semi-radar
# Generic
" Fox 1 at": nil, # semi-radar
" Fox 2 at": nil, # heat
" Fox 3 at": nil, # radar
" Greyhound at": nil, # cruise missile
" Bombs away at": nil, # bombs
" Bruiser at": nil, # anti-ship
" Rifle at": nil, # TV guided
" Sniper at": nil, # anti-radiation
# SAM, fleet and missile frigate
" Bird away at": nil, # G/A
# F15
" aim7 at": nil,
" aim9 at": nil,
" aim120 at": nil,
};
var incoming_listener = func {
var history = getprop("/sim/multiplay/chat-history");
var hist_vector = split("\n", history);
@ -95,6 +187,7 @@ var incoming_listener = func {
var last_vector = split(":", last);
var author = last_vector[0];
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
if (size(last_vector) > 1 and author != callsign) {
# not myself
#print("not me");
@ -103,68 +196,10 @@ var incoming_listener = func {
# a m2000 is firing at us
m2000 = TRUE;
}
if (last_vector[1] == " FOX2 at" or last_vector[1] == " Fox 1 at" or last_vector[1] == " Fox 2 at" or last_vector[1] == " Fox 3 at"
or last_vector[1] == " Greyhound at" or last_vector[1] == " Bombs away at" or last_vector[1] == " Bruiser at" or last_vector[1] == " Rifle at" or last_vector[1] == " Bird away at"
or last_vector[1] == " aim7 at" or last_vector[1] == " aim9 at"
or last_vector[1] == " aim120 at"
or m2000 == TRUE) {
if (contains(fireMsgs, last_vector[1]) or m2000 == TRUE) {
# air2air being fired
if (size(last_vector) > 2 or m2000 == TRUE) {
#print("Missile launch detected at"~last_vector[2]~" from "~author);
if (m2000 == TRUE or last_vector[2] == " "~callsign) {
# its being fired at me
#print("Incoming!");
var enemy = getCallsign(author);
if (enemy != nil) {
#print("enemy identified");
var bearingNode = enemy.getNode("radar/bearing-deg");
if (bearingNode != nil) {
#print("bearing to enemy found");
var bearing = bearingNode.getValue();
var heading = getprop("orientation/heading-deg");
var clock = bearing - heading;
while(clock < 0) {
clock = clock + 360;
}
while(clock > 360) {
clock = clock - 360;
}
#print("incoming from "~clock);
if (clock >= 345 or clock < 15) {
playIncomingSound("12");
} elsif (clock >= 15 and clock < 45) {
playIncomingSound("1");
} elsif (clock >= 45 and clock < 75) {
playIncomingSound("2");
} elsif (clock >= 75 and clock < 105) {
playIncomingSound("3");
} elsif (clock >= 105 and clock < 135) {
playIncomingSound("4");
} elsif (clock >= 135 and clock < 165) {
playIncomingSound("5");
} elsif (clock >= 165 and clock < 195) {
playIncomingSound("6");
} elsif (clock >= 195 and clock < 225) {
playIncomingSound("7");
} elsif (clock >= 225 and clock < 255) {
playIncomingSound("8");
} elsif (clock >= 255 and clock < 285) {
playIncomingSound("9");
} elsif (clock >= 285 and clock < 315) {
playIncomingSound("10");
} elsif (clock >= 315 and clock < 345) {
playIncomingSound("11");
} else {
playIncomingSound("");
}
return;
}
}
}
}
} elsif (1==1) { # mirage: getprop("/controls/armament/mp-messaging")
# latest version of failure manager and taking damage enabled
#print("damage enabled");
warn(last_vector,m2000,callsign,author);
} elsif (getprop("payload/armament/msg")) {
var last1 = split(" ", last_vector[1]);
if(size(last1) > 2 and last1[size(last1)-1] == "exploded" ) {
#print("missile hitting someone");
@ -182,56 +217,113 @@ var incoming_listener = func {
if(distance != nil) {
var dist = distance;
#check distance w/ if statement here
if (contains(warhead_lbs, type)) {
#maxDist = maxDamageDistFromWarhead(warhead_lbs[type]);
if (contains(cluster, type)) {
# cluster munition
var lbs = warhead_lbs[type];
var maxDist = maxDamageDistFromWarhead(lbs);
var distance = math.max(0,rand()*2-full_damage_dist_m);#being 0 to 2 meters from a bomblet on average.
var diff = maxDist-distance;
diff = diff * diff;
var probability = diff / (maxDist*maxDist);
if (use_hitpoints_instead_of_failure_modes_bool) {
var hpDist = maxDamageDistFromWarhead(hp_max);
probability = (maxDist/hpDist)*probability;
}
var failed = fail_systems(probability, hp_max);
var percent = 100 * prob;
printf("Took %.1f%% damage from %s clusterbomb at %0.1f meters from bomblet. %s systems was hit", percent,type,distance,failed);
nearby_explosion();
return;
}
distance = math.max(distance-full_damage_dist_m, 0);
var maxDist = 0;# distance where the explosion dont hurt us anymore
var lbs = 0;
if (hitable_by_ground_munitions and contains(warhead_lbs, type)) {
lbs = warhead_lbs[type];
maxDist = maxDamageDistFromWarhead(lbs);#3*sqrt(lbs)
} elsif (hitable_by_air_munitions and contains(warhead_air_lbs, type)) {
lbs = warhead_air_lbs[type];
maxDist = maxDamageDistFromWarhead(lbs);
} else {
return;
}
if (type == "M90" and distance < 300) {
var failed = fail_systems(warhead_lbs[type]/2);
return;
} elsif (distance < 150) {
var prob = 1;
if ( distance > 50 ) {
distance = distance - 50;
prob = 1 - (distance/100);
}
}
var diff = maxDist-distance;
if (diff < 0) {
diff = 0;
}
diff = diff * diff;
var probability = diff / (maxDist*maxDist);
if (use_hitpoints_instead_of_failure_modes_bool) {
var hpDist = maxDamageDistFromWarhead(hp_max);
probability = (maxDist/hpDist)*probability;
}
var failed = fail_systems(warhead_lbs[type] * prob);
#ar percent = 100 * probability;
#printf("Took %.1f%% damage from %s missile at %0.1f meters. %s systems was hit", percent,type,dist,failed);
var failed = fail_systems(probability, hp_max);
var percent = 100 * probability;
printf("Took %.1f%% damage from %s missile at %0.1f meters. %s systems was hit", percent,type,dist,failed);
nearby_explosion();
####
# I don't remember all the considerations that went into our original warhead damage model.
# But looking at the formula it looks like they all do 100% damage at 0 meter hit,
# and warhead size is only used to determine the decrease of damage with distance increase.
# It sorta gets the job done though, so I am hesitant to advocate that warheads above a certain
# size should give 100% damage for some distance, and that warheads smaller than certain size should
# not give 100% damage even on direct hit.
# Anyway, for hitpoint based assets, this is now the case. Maybe we should consider to also do something
# similar for failure mode based aircraft. ~Nikolai
####
## example 1: ##
# 300 lbs warhead, 50 meters distance
# maxDist=52
# diff = 52-50 = 2
# diff^2 = 4
# prob = 4/2700 = 0.15%
## example 2: ##
# 300 lbs warhead, 25 meters distance
# maxDist=52
# diff = 52-25 = 27
# diff^2 = 729
# prob = 729/2700 = 27%
}
}
} elsif (cannon_types[last_vector[1]] != nil) {
# cannon hitting someone
print("cannon");
} elsif (hitable_by_cannon and cannon_types[last_vector[1]] != nil) {
if (size(last_vector) > 2 and last_vector[2] == " "~callsign) {
print("cannon hit us");
var last3 = split(" ", last_vector[3]);
#print("last3[2]: " ~ last3[2]);
#print("last3[1]: " ~ last3[1]);
if(size(last3) > 2) {
if ( last3[2] == "hits" ) {
var hit_count = num(last3[1]);
}
} else {
var hit_count = 4;
}
var damaged_sys = 0;
var probability = cannon_types[last_vector[1]];
for (var i = 1; i <= hit_count; i = i + 1) {
var failed = fail_systems(probability);
damaged_sys = damaged_sys + failed;
}
# that someone is me!
#print("hitting me");
if (size(last_vector) < 4) {
# msg is either missing number of hits, or has no trailing dots from spam filter.
print('"'~last~'" is not a legal hit message, tell the shooter to upgrade his OPRF plane :)');
return;
}
var last3 = split(" ", last_vector[3]);
if(size(last3) > 2 and size(last3[2]) > 2 and last3[2] == "hits" ) {
var probability = cannon_types[last_vector[1]];
var hit_count = num(last3[1]);
if (hit_count != nil) {
var damaged_sys = 0;
for (var i = 1; i <= hit_count; i = i + 1) {
var failed = fail_systems(probability);
damaged_sys = damaged_sys + failed;
}
printf("Took %.1f%% damage from cannon! %s systems was hit.", probability*hit_count*100, damaged_sys);
printf("Took %.1f%% x %2d damage from cannon! %s systems was hit.", probability*100, hit_count, damaged_sys);
nearby_explosion();
}
} else {
var probability = cannon_types[last_vector[1]];
#print("probability: " ~ probability);
var failed = fail_systems(probability * 3);# Old messages is assumed to be 3 hits
printf("Took %.1f%% x 3 damage from cannon! %s systems was hit.", probability*100, failed);
nearby_explosion();
}
}
}
}
@ -239,25 +331,133 @@ var incoming_listener = func {
}
}
var maxDamageDistFromWarhead = func (lbs) {
# very simple
var dist = 7*math.sqrt(lbs);
# Calc at what distance the warhead will do zero damage every time.
var dist = 3*math.sqrt(lbs);
return dist;
}
var fail_systems = func (damage) {
hp = hp - damage;
print("HP: " ~ hp ~ "/" ~ hp_max);
if ( hp < 0 ) {
setprop("/carrier/sunk/",1);
setprop("/sim/multiplay/generic/int[0]",1);
}
return 1;
var fail_systems = func (probability, factor = 100) {#this factor needs tuning after all asset hitpoints have been evaluated.
if (fleet) {
return fail_fleet_systems(probability, factor);
} elsif (use_hitpoints_instead_of_failure_modes_bool) {
hp -= factor * probability*(0.75+rand()*0.25);# from 75 to 100% damage
printf("HP: %d/%d", hp, hp_max);
setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD
if ( hp < 0 ) {
setprop("/carrier/sunk/",1);#we are dead
setprop("/sim/multiplay/generic/int[2]",1);#radar off
setprop("/sim/multiplay/generic/int[0]",1);#smoke on
setprop("/sim/messages/copilot", getprop("sim/multiplay/callsign")~" dead.");
}
return -1;
} else {
var failure_modes = FailureMgr._failmgr.failure_modes;
var mode_list = keys(failure_modes);
var failed = 0;
foreach(var failure_mode_id; mode_list) {
if (rand() < probability) {
FailureMgr.set_failure_level(failure_mode_id, 1);
failed += 1;
}
}
return failed;
}
};
hp_f = [hp_max,hp_max,hp_max,hp_max,hp_max,hp_max,hp_max];
var fail_fleet_systems = func (probability, factor) {
var no = 7;
while (no > 6 or hp_f[no] < 0) {
no = int(rand()*7);
if (hp_f[no] < 0) {
if (rand() > 0.9) {
armament.defeatSpamFilter("You shot one of our already sinking ships, you are just mean.");
hp_f[no] -= factor * probability*(0.75+rand()*0.25);# from 75 to 100% damage
print("HP["~no~"]: " ~ hp_f[no] ~ "/" ~ hp_max);
return;
}
}
}
hp_f[no] -= factor * probability*(0.75+rand()*0.25);# from 75 to 100% damage
printf("HP[%d]: %d/%d", no, hp_f[no], hp_max);
#setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD
if ( hp_f[no] < 0 ) {
setprop("/sim/multiplay/generic/bool["~(no+40)~"]",1);
armament.defeatSpamFilter("So you sank one of our ships, we will get you for that!");
if (!getprop("/carrier/disabled") and hp_f[0]<0 and hp_f[1]<0 and hp_f[2]<0) {
setprop("/carrier/disabled",1);
armament.defeatSpamFilter("Captain our offensive capability is crippled!");
}
if (hp_f[0]<0 and hp_f[1]<0 and hp_f[2]<0 and hp_f[3]<0 and hp_f[4]<0 and hp_f[5]<0 and hp_f[6]<0) {
setprop("/carrier/sunk",1);
setprop("/sim/multiplay/generic/int[2]",1);#radar off
setprop("/sim/messages/copilot", getprop("sim/multiplay/callsign")~" dead.");
armament.defeatSpamFilter("S.O.S. Heeelp");
} else {
armament.defeatSpamFilter("This is not over yet..");
}
}
return -1;
};
var warn = func (last_vector,m2000,callsign,author) {
if (size(last_vector) > 2 or m2000 == TRUE) {
#print("Missile launch detected at"~last_vector[2]~" from "~author);
if (m2000 == TRUE or last_vector[2] == " "~callsign) {
# its being fired at me
#print("Incoming!");
var enemy = getCallsign(author);
if (enemy != nil) {
#print("enemy identified");
var bearingNode = enemy.getNode("radar/bearing-deg");
if (bearingNode != nil) {
#print("bearing to enemy found");
var bearing = bearingNode.getValue();
var heading = getprop("orientation/heading-deg");
var clock = bearing - heading;
while(clock < 0) {
clock = clock + 360;
}
while(clock > 360) {
clock = clock - 360;
}
#print("incoming from "~clock);
if (clock >= 345 or clock < 15) {
playIncomingSound("12");
} elsif (clock >= 15 and clock < 45) {
playIncomingSound("1");
} elsif (clock >= 45 and clock < 75) {
playIncomingSound("2");
} elsif (clock >= 75 and clock < 105) {
playIncomingSound("3");
} elsif (clock >= 105 and clock < 135) {
playIncomingSound("4");
} elsif (clock >= 135 and clock < 165) {
playIncomingSound("5");
} elsif (clock >= 165 and clock < 195) {
playIncomingSound("6");
} elsif (clock >= 195 and clock < 225) {
playIncomingSound("7");
} elsif (clock >= 225 and clock < 255) {
playIncomingSound("8");
} elsif (clock >= 255 and clock < 285) {
playIncomingSound("9");
} elsif (clock >= 285 and clock < 315) {
playIncomingSound("10");
} elsif (clock >= 315 and clock < 345) {
playIncomingSound("11");
} else {
playIncomingSound("");
}
return;
}
}
}
}
}
var playIncomingSound = func (clock) {
setprop("sound/incoming"~clock, 1);
settimer(func {stopIncomingSound(clock);},3);
@ -267,6 +467,20 @@ var stopIncomingSound = func (clock) {
setprop("sound/incoming"~clock, 0);
}
var nearby_explosion = func {
setprop("damage/sounds/nearby-explode-on", 0);
settimer(nearby_explosion_a, 0);
}
var nearby_explosion_a = func {
setprop("damage/sounds/nearby-explode-on", 1);
settimer(nearby_explosion_b, 0.5);
}
var nearby_explosion_b = func {
setprop("damage/sounds/nearby-explode-on", 0);
}
var callsign_struct = {};
var getCallsign = func (callsign) {
var node = callsign_struct[callsign];
@ -282,20 +496,25 @@ var processCallsigns = func () {
callsign_struct[callsign] = player;
}
}
settimer(processCallsigns, 1.5);
settimer(processCallsigns, 5);
}
processCallsigns();
var logTime = func{
#log time and date for outputing ucsv files for converting into KML files for google earth.
if (getprop("logging/log[0]/enabled") == TRUE and getprop("sim/time/utc/year") != nil) {
var date = getprop("sim/time/utc/year")~"/"~getprop("sim/time/utc/month")~"/"~getprop("sim/time/utc/day");
var time = getprop("sim/time/utc/hour")~":"~getprop("sim/time/utc/minute")~":"~getprop("sim/time/utc/second");
setlistener("/sim/multiplay/chat-history", incoming_listener, 0, 0);
setprop("logging/date-log", date);
setprop("logging/time-log", time);
# prevent flooding the pilots screen with failure modes that fail when getting hit.
setprop("/sim/failure-manager/display-on-screen", FALSE);
var re_init = func {
# repair the aircraft at relocation to another airport.
var failure_modes = FailureMgr._failmgr.failure_modes;
var mode_list = keys(failure_modes);
foreach(var failure_mode_id; mode_list) {
FailureMgr.set_failure_level(failure_mode_id, 0);
}
}
setlistener("/sim/multiplay/chat-history", incoming_listener, 0, 0);
setlistener("/sim/signals/reinit", re_init, 0, 0);

View File

@ -113,6 +113,12 @@
</multiplay>
</sim>
<payload>
<armament>
<msg type="bool">true</msg>
</armament>
</payload>
<nasal>
<carrier>
<file>Aircraft/depot/Nasal/fdm.nas</file>

317
fleet/Nasal/damage.nas Normal file
View File

@ -0,0 +1,317 @@
var clamp = func(v, min, max) { v < min ? min : v > max ? max : v }
var TRUE = 1;
var FALSE = 0;
var hp_max = 200;
var hp = [hp_max,hp_max,hp_max,hp_max,hp_max,hp_max,hp_max];
var cannon_types = {
" M70 rocket hit": 0.25, #135mm
" M55 cannon shell hit": 0.10, # 30mm
" KCA cannon shell hit": 0.10, # 30mm
" Gun Splash On ": 0.10, # 30mm
" M61A1 shell hit": 0.05, # 20mm
" GAU-8/A hit": 0.10, # 30mm
" BK27 cannon hit": 0.07, # 27mm
" GSh-30 hit": 0.10, # 30mm
" GSh-23 hit": 0.065,# 23mm
" 7.62 hit": 0.005,# 7.62mm
" 50 BMG hit": 0.015,# 12.7mm
" S-5 rocket hit": 0.20, #55mm
};
var warhead_lbs = {
"AGM-65": 126.00,
"AGM-84": 488.00,
"AGM-88": 146.00,
"AGM65": 200.00,
"AGM-154A": 493.00,
"AGM-158": 1000.00,
"ALARM": 450.00,
"AM39-Exocet": 364.00,
"AS-37-Martel": 330.00,
"AS30L": 529.00,
"CBU-87": 128.00,
"Exocet": 364.00,
"FAB-100": 92.59,
"FAB-250": 202.85,
"FAB-500": 564.38,
"GBU-12": 190.00,
"GBU-24": 945.00,
"GBU-31": 945.00,
"GBU12": 190.00,
"GBU16": 450.00,
"HVAR": 7.50,#P51
"KAB-500": 564.38,
"Kh-25MP": 197.53,
"Kh-66": 244.71,
"KN-06": 315.00,
"LAU-68": 10.00,
"M317": 145.00,
"M71": 200.00,
"M71R": 200.00,
"M90": 500.00,
"MK-82": 192.00,
"MK-83": 445.00,
"MK-84": 945.00,
"OFAB-100": 92.59,
"RB-04E": 661.00,
"RB-05A": 353.00,
"RB-15F": 440.92,
"RB-75": 126.00,
"RN-14T": 800.00, #fictional, thermobaeric replacement for the RN-24 nuclear bomb
"RN-18T": 1200.00, #fictional, thermobaeric replacement for the RN-28 nuclear bomb
"RS-2US": 28.66,
"S-21": 245.00,
"S-24": 271.00,
"S530D": 66.00,
"SCALP": 992.00,
"Sea Eagle": 505.00,
"SeaEagle": 505.00,
"STORMSHADOW": 850.00,
"ZB-250": 236.99,
"ZB-500": 473.99,
};
var incoming_listener = func {
var history = getprop("/sim/multiplay/chat-history");
var hist_vector = split("\n", history);
if (size(hist_vector) > 0) {
var last = hist_vector[size(hist_vector)-1];
var last_vector = split(":", last);
var author = last_vector[0];
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
if (size(last_vector) > 1 and author != callsign) {
# not myself
#print("not me");
var m2000 = FALSE;
if (find(" at " ~ callsign ~ ". Release ", last_vector[1]) != -1) {
# a m2000 is firing at us
m2000 = TRUE;
}
if (last_vector[1] == " FOX2 at" or last_vector[1] == " aim7 at" or last_vector[1] == " aim9 at"
or last_vector[1] == " aim120 at" or last_vector[1] == " RB-24J fired at" or last_vector[1] == " RB-74 fired at"
or last_vector[1] == " RB-71 fired at" or last_vector[1] == " RB-15F fired at"
or last_vector[1] == " RB-99 fired at" or m2000 == TRUE) {
# air2air being fired
if (size(last_vector) > 2 or m2000 == TRUE) {
#print("Missile launch detected at"~last_vector[2]~" from "~author);
if (m2000 == TRUE or last_vector[2] == " "~callsign) {
# its being fired at me
#print("Incoming!");
var enemy = getCallsign(author);
if (enemy != nil) {
#print("enemy identified");
var bearingNode = enemy.getNode("radar/bearing-deg");
if (bearingNode != nil) {
#print("bearing to enemy found");
var bearing = bearingNode.getValue();
var heading = getprop("orientation/heading-deg");
var clock = bearing - heading;
while(clock < 0) {
clock = clock + 360;
}
while(clock > 360) {
clock = clock - 360;
}
#print("incoming from "~clock);
if (clock >= 345 or clock < 15) {
playIncomingSound("12");
} elsif (clock >= 15 and clock < 45) {
playIncomingSound("1");
} elsif (clock >= 45 and clock < 75) {
playIncomingSound("2");
} elsif (clock >= 75 and clock < 105) {
playIncomingSound("3");
} elsif (clock >= 105 and clock < 135) {
playIncomingSound("4");
} elsif (clock >= 135 and clock < 165) {
playIncomingSound("5");
} elsif (clock >= 165 and clock < 195) {
playIncomingSound("6");
} elsif (clock >= 195 and clock < 225) {
playIncomingSound("7");
} elsif (clock >= 225 and clock < 255) {
playIncomingSound("8");
} elsif (clock >= 255 and clock < 285) {
playIncomingSound("9");
} elsif (clock >= 285 and clock < 315) {
playIncomingSound("10");
} elsif (clock >= 315 and clock < 345) {
playIncomingSound("11");
} else {
playIncomingSound("");
}
return;
}
}
}
}
} elsif (1 == 1) { # mirage: getprop("/controls/armament/mp-messaging")
# latest version of failure manager and taking damage enabled
#print("damage enabled");
var last1 = split(" ", last_vector[1]);
if(size(last1) > 2 and last1[size(last1)-1] == "exploded" ) {
#print("missile hitting someone");
if (size(last_vector) > 3 and last_vector[3] == " "~callsign) {
#print("that someone is me!");
var type = last1[1];
if (type == "Matra" or type == "Sea") {
for (var i = 2; i < size(last1)-1; i += 1) {
type = type~" "~last1[i];
}
}
var number = split(" ", last_vector[2]);
var distance = num(number[1]);
#print(type~"|");
if(distance != nil) {
var dist = distance;
#check distance w/ if statement here
if (contains(warhead_lbs, type)) {
#maxDist = maxDamageDistFromWarhead(warhead_lbs[type]);
} else {
return;
}
var prob = 1;
if (type == "M90" and distance < 300) {
var failed = fail_systems(warhead_lbs[type]/2);
return;
} elsif (distance < 150) {
if ( distance > 50 ) {
distance = distance - 50;
prob = 1 - (distance/100);
}
}
var failed = fail_systems(warhead_lbs[type] * prob);
#ar percent = 100 * probability;
#printf("Took %.1f%% damage from %s missile at %0.1f meters. %s systems was hit", percent,type,dist,failed);
}
}
} elsif (cannon_types[last_vector[1]] != nil) {
# cannon hitting someone
print("cannon");
if (size(last_vector) > 2 and last_vector[2] == " "~callsign) {
print("cannon hit us");
if (size(last_vector) < 4) {
# msg is either missing number of hits, or has no trailing dots from spam filter.
print('"'~last~'" is not a legal hit message, tell the shooter to upgrade his OPRF plane :)');
return;
}
var last3 = split(" ", last_vector[3]);
#print("last3[2]: " ~ last3[2]);
#print("last3[1]: " ~ last3[1]);
if(size(last3) > 2) {
if ( last3[2] == "hits" ) {
var hit_count = num(last3[1]);
}
} else {
var hit_count = 4;
}
var damaged_sys = 0;
var probability = cannon_types[last_vector[1]];
for (var i = 1; i <= hit_count; i = i + 1) {
var failed = fail_systems(probability);
#damaged_sys = damaged_sys + failed;
}
# that someone is me!
#print("hitting me");
#printf("Took %.1f%% damage from cannon! %s systems was hit.", probability*hit_count*100, damaged_sys);
}
}
}
}
}
}
var maxDamageDistFromWarhead = func (lbs) {
# very simple
var dist = 7*math.sqrt(lbs);
return dist;
}
var fail_systems = func (damage) {
var no = 7;
while (no > 6 or hp[no] < 0) {
no = int(rand()*7);
if (hp[no] < 0) {
if (rand() > 0.8) {
armament.defeatSpamFilter("You shot one of our already sinking ships, you are just mean.");
hp[no] = hp[no] - damage;
print("HP["~no~"]: " ~ hp[no] ~ "/" ~ hp_max);
return;
}
}
}
hp[no] = hp[no] - damage;
print("HP["~no~"]: " ~ hp[no] ~ "/" ~ hp_max);
if ( hp[no] < 0 ) {
setprop("/sim/multiplay/generic/bool["~(no+40)~"]",1);
armament.defeatSpamFilter("So you sank one of our ships, we will get you for that!");
if (!getprop("/carrier/disabled") and hp[0]<0 and hp[1]<0 and hp[2]<0) {
setprop("/carrier/disabled",1);
armament.defeatSpamFilter("Captain our offensive capability is crippled!");
}
if (hp[0]<0 and hp[1]<0 and hp[2]<0 and hp[3]<0 and hp[4]<0 and hp[5]<0 and hp[6]<0) {
setprop("/carrier/sunk",1);
armament.defeatSpamFilter("S.O.S. Heeelp");
} else {
armament.defeatSpamFilter("This is not over yet..");
}
}
};
var playIncomingSound = func (clock) {
setprop("sound/incoming"~clock, 1);
settimer(func {stopIncomingSound(clock);},3);
}
var stopIncomingSound = func (clock) {
setprop("sound/incoming"~clock, 0);
}
var callsign_struct = {};
var getCallsign = func (callsign) {
var node = callsign_struct[callsign];
return node;
}
var processCallsigns = func () {
callsign_struct = {};
var players = props.globals.getNode("ai/models").getChildren();
foreach (var player; players) {
if(player.getChild("valid") != nil and player.getChild("valid").getValue() == TRUE and player.getChild("callsign") != nil and player.getChild("callsign").getValue() != "" and player.getChild("callsign").getValue() != nil) {
var callsign = player.getChild("callsign").getValue();
callsign_struct[callsign] = player;
}
}
settimer(processCallsigns, 1.5);
}
processCallsigns();
var logTime = func{
#log time and date for outputing ucsv files for converting into KML files for google earth.
if (getprop("logging/log[0]/enabled") == TRUE and getprop("sim/time/utc/year") != nil) {
var date = getprop("sim/time/utc/year")~"/"~getprop("sim/time/utc/month")~"/"~getprop("sim/time/utc/day");
var time = getprop("sim/time/utc/hour")~":"~getprop("sim/time/utc/minute")~":"~getprop("sim/time/utc/second");
setprop("logging/date-log", date);
setprop("logging/time-log", time);
}
}
setlistener("/sim/multiplay/chat-history", incoming_listener, 0, 0);

View File

@ -145,6 +145,31 @@
<bool n="46" type="bool">false</bool>
</generic>
</multiplay>
<menubar>
<default>
<menu n="100">
<label>Missile-frigate</label>
<enabled type="bool">true</enabled>
<item>
<label>Reload</label>
<binding>
<command>nasal</command>
<script>
fire_control.reload();
</script>
</binding>
</item>
<item>
<label>Targets</label>
<name>enemies</name>
<binding>
<command>dialog-show</command>
<dialog-name>enemies</dialog-name>
</binding>
</item>
</menu>
</default>
</menubar>
<aircraft-data>
<!-- Properties that get saved to persist locally between FG sessions -->
@ -302,6 +327,132 @@
</controls>
<payload>
<weight n="0">
<name>Main Store</name>
<weight-lb alias="/fdm/jsbsim/inertia/pointmass-weight-lbs[1]"/>
<selected>none</selected>
<opt>
<name>KN-06</name>
<lbs>50</lbs>
</opt>
</weight>
<armament>
<models type="string">Aircraft/fleet/Models/Armament/Weapons/</models>
<modelsUseCase type="bool">true</modelsUseCase>
<modelsUpperCase type="bool">true</modelsUpperCase>
<MP-lat type="string">rotors/main/blade[0]/flap-deg</MP-lat>
<MP-lon type="string">rotors/main/blade[1]/flap-deg</MP-lon>
<MP-alt type="string">rotors/main/blade[2]/flap-deg</MP-alt>
<hit-interpolation type="bool">true</hit-interpolation>
<pylon-offset type="int">1</pylon-offset>
<pylon-stations>controls/armament</pylon-stations>
<station-name type="string">station</station-name>
<msg type="bool">true</msg>
<damage type="bool">true</damage>
<kn-06>
<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">APN</navigation> <!-- -->
<all-aspect type="bool">true</all-aspect>
<max-fire-range-nm type="int">85</max-fire-range-nm>
<FCS-field-deg type="int">360</FCS-field-deg>
<seeker-field-deg type="int">220</seeker-field-deg><!-- since launched vertical, it cannot be too small -->
<max-g type="int">22</max-g>
<thrust-lbf-stage-1 type="double">90000</thrust-lbf-stage-1>
<thrust-lbf-stage-2 type="double">77000</thrust-lbf-stage-2> <!-- max 2000 m/s speed, 93 NM range -->
<stage-1-duration-sec type="double">0.25</stage-1-duration-sec>
<stage-2-duration-sec type="double">8.0</stage-2-duration-sec>
<weight-launch-lbs>3920</weight-launch-lbs>
<weight-warhead-lbs>315</weight-warhead-lbs>
<weight-fuel-lbm>2800</weight-fuel-lbm> <!-- -->
<drag-coeff type="double">0.20</drag-coeff> <!-- max 2000 m/s speed, 93 NM range -->
<cross-section-sqft type="double">2.11349</cross-section-sqft>
<arming-time-sec type="double">2</arming-time-sec>
<min-speed-for-guiding-mach type="double">0.25</min-speed-for-guiding-mach>
<self-destruct-time-sec type="double">160</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">75000</loft-altitude>
<min-fire-range-nm type="double">0.85</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">90</rail-pitch-deg> <!-- new -->
<chaff-resistance type="double">0.95</chaff-resistance>
<proportionality-constant type="double">3</proportionality-constant>
<class type="string">A</class>
<fire-msg>Bird away</fire-msg>
</kn-06>
<!-- test: SAM -->
<test>
<sound-on-off type="bool">false</sound-on-off>
<sound-volume type="double">0.0</sound-volume>
<sound-fire-on-off type="bool">false</sound-fire-on-off>
<vol-search type="double">0.00</vol-search>
<guidance type="string">radar</guidance>
<all-aspect type="bool">true</all-aspect>
<max-fire-range-nm type="int">38.8</max-fire-range-nm>
<FCS-field-deg type="int">360</FCS-field-deg>
<seeker-field-deg type="int">360</seeker-field-deg>
<max-g type="int">30</max-g>
<thrust-lbf-stage-1 type="double">9000</thrust-lbf-stage-1>
<thrust-lbf-stage-2 type="double">1500</thrust-lbf-stage-2>
<stage-1-duration-sec type="double">4.0</stage-1-duration-sec>
<stage-2-duration-sec type="double">15.0</stage-2-duration-sec>
<weight-launch-lbs>291</weight-launch-lbs>
<weight-warhead-lbs>44</weight-warhead-lbs>
<drag-coeff type="double">0.5</drag-coeff>
<drag-area type="double">0.2739</drag-area>
<searcher-beam-width type="double">3.0</searcher-beam-width>
<arming-time-sec type="double">1.6</arming-time-sec>
<min-speed-for-guiding-mach type="double">0.9</min-speed-for-guiding-mach>
<self-destruct-time-sec type="double">90</self-destruct-time-sec>
<seeker-angular-speed-dps type="double">30</seeker-angular-speed-dps>
<loft-altitude>0</loft-altitude>
<min-fire-range-nm type="double">0.35</min-fire-range-nm>
<rail type="bool">true</rail>
<rail-length-m type="double">5</rail-length-m>
<rail-point-forward type="bool">false</rail-point-forward>
<class type="string">A/A</class>
<fire-msg>Chickenbeater</fire-msg>
</test>
<!--<test>
<sound-on-off type="bool">false</sound-on-off>
<sound-volume type="double">0.0</sound-volume>
<vol-search type="double">0.03</vol-search>
<guidance type="string">radar</guidance>
<all-aspect type="bool">true</all-aspect>
<max-fire-range-nm type="double">100</max-fire-range-nm>
<FCS-field-deg type="int">25</FCS-field-deg>
<seeker-field-deg type="int">180</seeker-field-deg>
<max-g type="int">20</max-g>
<max-launch-g type="int">7</max-launch-g>
<thrust-lbf-stage-1 type="double">150</thrust-lbf-stage-1>
<thrust-lbf-stage-2 type="double">0.0</thrust-lbf-stage-2>
<stage-1-duration-sec type="double">200.5</stage-1-duration-sec>
<stage-2-duration-sec type="double">1.0</stage-2-duration-sec>
<weight-launch-lbs type="double">179</weight-launch-lbs>
<weight-warhead-lbs type="double">20.8</weight-warhead-lbs>
<drag-coeff type="double">0.5</drag-coeff>
<drag-area type="double">0.143</drag-area>
<searcher-beam-width type="double">2.0</searcher-beam-width>
<arming-time-sec type="double">1.4</arming-time-sec>
<min-speed-for-guiding-mach type="double">0.4</min-speed-for-guiding-mach>
<self-destruct-time-sec type="double">250</self-destruct-time-sec>
<seeker-angular-speed-dps type="double">50</seeker-angular-speed-dps>
<loft-altitude>100</loft-altitude>
<min-fire-range-nm type="double">0.2</min-fire-range-nm>
<rail type="bool">false</rail>
<class type="string">A/G</class>
</test>-->
</armament>
</payload>
<rotors>
<main>
<blade n="0">
@ -331,6 +482,27 @@
<e12 userarchive="y" type="string">SNOWY1</e12>
</enemies>
<nasal>
<carrier>
<file>Aircraft/fleet/Nasal/fdm.nas</file>
</carrier>
<damage>
<file>Aircraft/fleet/Nasal/damage.nas</file>
</damage>
<radar_logic>
<file>Aircraft/fleet/Nasal/radar-logic.nas</file>
</radar_logic>
<vector>
<file>Aircraft/fleet/Nasal/vector.nas</file>
</vector>
<armament>
<file>Aircraft/fleet/Nasal/guided-missiles.nas</file>
</armament>
<fire_control>
<file>Aircraft/fleet/Nasal/fire-control.nas</file>
</fire_control>
</nasal>
<input>
<mice include="Sim/mice.xml"/>
</input>

View File

@ -29,10 +29,13 @@ var warhead_lbs = {
"AGM-84": 488.00,
"AGM-88": 146.00,
"AGM65": 200.00,
"AGM-154A": 493.00,
"AGM-158": 1000.00,
"ALARM": 450.00,
"AM39-Exocet": 364.00,
"AS-37-Martel": 330.00,
"AS30L": 529.00,
"CBU-87": 128.00,
"Exocet": 364.00,
"FAB-100": 92.59,
"FAB-250": 202.85,
@ -212,12 +215,12 @@ var incoming_listener = func {
var probability = cannon_types[last_vector[1]];
for (var i = 1; i <= hit_count; i = i + 1) {
var failed = fail_systems(probability);
damaged_sys = damaged_sys + failed;
#damaged_sys = damaged_sys + failed;
}
# that someone is me!
#print("hitting me");
printf("Took %.1f%% damage from cannon! %s systems was hit.", probability*hit_count*100, damaged_sys);
#printf("Took %.1f%% damage from cannon! %s systems was hit.", probability*hit_count*100, damaged_sys);
}
}
}

View File

@ -93,8 +93,9 @@
<multiplay>
<generic>
<int n="0" type="int">0</int>
<int n="2" type="int">0</int>
</generic>
<visibility-range-nm type="int">500</visibility-range-nm>
<!--<visibility-range-nm type="int">500</visibility-range-nm>-->
</multiplay>
</sim>

View File

@ -3,7 +3,7 @@ var clamp = func(v, min, max) { v < min ? min : v > max ? max : v }
var TRUE = 1;
var FALSE = 0;
var hp = 2500;
var hp = 5;
var hp_max = hp;
var cannon_types = {
@ -28,10 +28,13 @@ var warhead_lbs = {
"AGM-84": 488.00,
"AGM-88": 146.00,
"AGM65": 200.00,
"AGM-154A": 493.00,
"AGM-158": 1000.00,
"ALARM": 450.00,
"AM39-Exocet": 364.00,
"AS-37-Martel": 330.00,
"AS30L": 529.00,
"CBU-87": 128.00,
"Exocet": 364.00,
"FAB-100": 92.59,
"FAB-250": 202.85,
@ -73,7 +76,6 @@ var warhead_lbs = {
"ZB-500": 473.99,
};
var incoming_listener = func {
var history = getprop("/sim/multiplay/chat-history");
var hist_vector = split("\n", history);
@ -82,6 +84,7 @@ var incoming_listener = func {
var last_vector = split(":", last);
var author = last_vector[0];
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
if (size(last_vector) > 1 and author != callsign) {
# not myself
#print("not me");
@ -176,11 +179,11 @@ var incoming_listener = func {
return;
}
var prob = 1;
if (type == "M90" and distance < 300) {
var failed = fail_systems(warhead_lbs[type]/2);
return;
} elsif (distance < 150) {
var prob = 1;
if ( distance > 50 ) {
distance = distance - 50;
prob = 1 - (distance/100);
@ -188,7 +191,7 @@ var incoming_listener = func {
}
var failed = fail_systems(warhead_lbs[type] * prob);
fail_systems(warhead_lbs[type] * prob);
#ar percent = 100 * probability;
#printf("Took %.1f%% damage from %s missile at %0.1f meters. %s systems was hit", percent,type,dist,failed);
}
@ -198,6 +201,11 @@ var incoming_listener = func {
print("cannon");
if (size(last_vector) > 2 and last_vector[2] == " "~callsign) {
print("cannon hit us");
if (size(last_vector) < 4) {
# msg is either missing number of hits, or has no trailing dots from spam filter.
print('"'~last~'" is not a legal hit message, tell the shooter to upgrade his OPRF plane :)');
return;
}
var last3 = split(" ", last_vector[3]);
#print("last3[2]: " ~ last3[2]);
#print("last3[1]: " ~ last3[1]);
@ -211,8 +219,7 @@ var incoming_listener = func {
var damaged_sys = 0;
var probability = cannon_types[last_vector[1]];
for (var i = 1; i <= hit_count; i = i + 1) {
var failed = fail_systems(probability);
damaged_sys = damaged_sys + failed;
fail_systems(probability);
}
# that someone is me!
#print("hitting me");

View File

@ -33,12 +33,19 @@ setprop("/carrier/pitch-offset",0);
setprop("/carrier/roll-deg",0);
setprop("/carrier/roll-offset",0);
setprop("/carrier/sunk",0);
var arrived = 0;
var PositionUpdater = func () {
settimer( PositionUpdater, 1/frequency );
var position = geo.aircraft_position();
if ( arrived == 0 and getprop("/carrier/sunk") == 0 and getprop("/autopilot/route-manager/wp-last/dist") != nil and getprop("/autopilot/route-manager/wp-last/dist") < 1 ) {
setprop("/sim/multiplay/chat",getprop("sim/multiplay/callsign") ~ " has arrived safely!");
print("arrived");
arrived = 1;
#return;
}
var time_now = getprop("/sim/time/elapsed-sec");
var dt = (time_now - time_last) * sim_speed;
@ -53,7 +60,7 @@ var PositionUpdater = func () {
if ( getprop("/carrier/sunk") == 0 and getprop("/autopilot/route-manager/active") == 1 ) {
#for event
var speed = 50;
var speed = 25;
var cur_waypoint = getprop("/autopilot/route-manager/current-wp");
var cur_wp_lon = getprop("/autopilot/route-manager/route/wp[" ~ cur_waypoint ~ "]/longitude-deg");
var cur_wp_lat = getprop("/autopilot/route-manager/route/wp[" ~ cur_waypoint ~ "]/latitude-deg");
@ -68,7 +75,7 @@ var PositionUpdater = func () {
# Set new position
setprop("/position/latitude-deg", position.lat());
setprop("/position/longitude-deg", position.lon());
var g_alt = getprop("/position/ground-elev-ft");
var g_alt = getprop("/position/ground-elev-ft")+1;
setprop("/position/altitude-ft",g_alt);

View File

@ -37,53 +37,6 @@
<tick-length>variable</tick-length>
</tape> -->
<ladder>
<name>Ladder</name>
<type>pitch</type>
<x>-60</x>
<y>-90</y>
<width>120</width>
<height>180</height>
<condition>
<equals>
<property>/sim/current-view/name</property>
<value>Approach View</value>
</equals>
</condition>
<roll-input>
<property>/orientation/roll-deg</property>
<factor>-1.0</factor>
</roll-input>
<pitch-input>
<property>/orientation/pitch-deg</property>
<factor>-1.0</factor>
</pitch-input>
<compression-factor>30</compression-factor>
<display-span>8</display-span>
<divisions>1.0</divisions>
<screen-hole>100</screen-hole>
<lbl-pos>0</lbl-pos>
<glide-slope>0.0</glide-slope>
<enable-fuselage-ref-line>false</enable-fuselage-ref-line>
<enable-target-spot>false</enable-target-spot>
<enable-target-markers>true</enable-target-markers>
<enable-velocity-vector>false</enable-velocity-vector>
<enable-drift-marker>false</enable-drift-marker>
<enable-alpha-bracket>false</enable-alpha-bracket>
<enable-energy-marker>false</enable-energy-marker>
<enable-climb-dive-marker>false</enable-climb-dive-marker>
<enable-glide-slope-marker>false</enable-glide-slope-marker>
<enable-energy-worm>false</enable-energy-worm>
<enable-waypoint-marker>false</enable-waypoint-marker>
<enable-zenith>false</enable-zenith>
<enable-nadir>false</enable-nadir>
<enable-hat>false</enable-hat>
</ladder>
<label>
<name>Wind Angle Runway</name>
<x>-300</x>
@ -100,170 +53,6 @@
</input>
</label>
<label>
<name>Height</name>
<x>-300</x>
<y>80</y>
<width>200</width>
<height>25</height>
<condition>
<or>
<equals>
<property>/sim/current-view/name</property>
<value>Landing Signal Officer View</value>
</equals>
<equals>
<property>/sim/current-view/name</property>
<value>Approach View</value>
</equals>
</or>
</condition>
<box>false</box>
<prefix>HEIGHT: </prefix>
<halign>left</halign>
<input>
<property>/sim/current-view/height</property>
</input>
<blinking>
<interval>0.25</interval>
<condition>
<and>
<equals>
<property>/sim/current-view/height</property>
<value>VERY LOW</value>
</equals>
<less-than>
<property>/sim/current-view/distance</property>
<value>1</value>
</less-than>
</and>
</condition>
</blinking>
</label>
<label>
<name>Gear</name>
<x>-300</x>
<y>60</y>
<width>200</width>
<height>25</height>
<condition>
<or>
<equals>
<property>/sim/current-view/name</property>
<value>Landing Signal Officer View</value>
</equals>
<equals>
<property>/sim/current-view/name</property>
<value>Approach View</value>
</equals>
</or>
</condition>
<box>false</box>
<prefix>GEAR: </prefix>
<halign>left</halign>
<input>
<property>/sim/current-view/gear</property>
</input>
<blinking>
<interval>0.25</interval>
<condition>
<and>
<less-than>
<property>/sim/current-view/gear</property>
<value>1</value>
</less-than>
<less-than>
<property>/sim/current-view/distance</property>
<value>1</value>
</less-than>
</and>
</condition>
</blinking>
</label>
<label>
<name>Flap</name>
<x>-300</x>
<y>40</y>
<width>200</width>
<height>25</height>
<condition>
<or>
<equals>
<property>/sim/current-view/name</property>
<value>Landing Signal Officer View</value>
</equals>
<equals>
<property>/sim/current-view/name</property>
<value>Approach View</value>
</equals>
</or>
</condition>
<box>false</box>
<prefix>FLAPS: </prefix>
<halign>left</halign>
<input>
<property>/sim/current-view/flap</property>
</input>
<blinking>
<interval>0.25</interval>
<condition>
<and>
<less-than>
<property>/sim/current-view/flap</property>
<value>1</value>
</less-than>
<less-than>
<property>/sim/current-view/distance</property>
<value>1</value>
</less-than>
</and>
</condition>
</blinking>
</label>
<label>
<name>Hook</name>
<x>-300</x>
<y>20</y>
<width>200</width>
<height>25</height>
<condition>
<or>
<equals>
<property>/sim/current-view/name</property>
<value>Landing Signal Officer View</value>
</equals>
<equals>
<property>/sim/current-view/name</property>
<value>Approach View</value>
</equals>
</or>
</condition>
<box>false</box>
<prefix>HOOK: </prefix>
<halign>left</halign>
<input>
<property>/sim/current-view/hook</property>
</input>
</label>
<label>
<name>Magnetic Heading</name>
<x>-300</x>

View File

@ -28,10 +28,13 @@ var warhead_lbs = {
"AGM-84": 488.00,
"AGM-88": 146.00,
"AGM65": 200.00,
"AGM-154A": 493.00,
"AGM-158": 1000.00,
"ALARM": 450.00,
"AM39-Exocet": 364.00,
"AS-37-Martel": 330.00,
"AS30L": 529.00,
"CBU-87": 128.00,
"Exocet": 364.00,
"FAB-100": 92.59,
"FAB-250": 202.85,
@ -81,6 +84,7 @@ var incoming_listener = func {
var last_vector = split(":", last);
var author = last_vector[0];
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
if (size(last_vector) > 1 and author != callsign) {
# not myself
#print("not me");
@ -175,11 +179,11 @@ var incoming_listener = func {
return;
}
var prob = 1;
if (type == "M90" and distance < 300) {
var failed = fail_systems(warhead_lbs[type]/2);
return;
} elsif (distance < 150) {
var prob = 1;
if ( distance > 50 ) {
distance = distance - 50;
prob = 1 - (distance/100);
@ -197,6 +201,11 @@ var incoming_listener = func {
print("cannon");
if (size(last_vector) > 2 and last_vector[2] == " "~callsign) {
print("cannon hit us");
if (size(last_vector) < 4) {
# msg is either missing number of hits, or has no trailing dots from spam filter.
print('"'~last~'" is not a legal hit message, tell the shooter to upgrade his OPRF plane :)');
return;
}
var last3 = split(" ", last_vector[3]);
#print("last3[2]: " ~ last3[2]);
#print("last3[1]: " ~ last3[1]);
@ -211,12 +220,12 @@ var incoming_listener = func {
var probability = cannon_types[last_vector[1]];
for (var i = 1; i <= hit_count; i = i + 1) {
var failed = fail_systems(probability);
damaged_sys = damaged_sys + failed;
#damaged_sys = damaged_sys + failed;
}
# that someone is me!
#print("hitting me");
printf("Took %.1f%% damage from cannon! %s systems was hit.", probability*hit_count*100, damaged_sys);
#printf("Took %.1f%% damage from cannon! %s systems was hit.", probability*hit_count*100, damaged_sys);
}
}
}
@ -236,8 +245,8 @@ var fail_systems = func (damage) {
print("HP: " ~ hp ~ "/" ~ hp_max);
if ( hp < 0 ) {
setprop("/sim/multiplay/generic/int[2]",1);
setprop("/carrier/sunk/",1);
setprop("/sim/multiplay/generic/int[0]",1);
}
};

View File

@ -30,11 +30,14 @@ sink_rate = .025;
pitch_rate = .007;
roll_rate = .007;
var last_speed = 4;
setprop("/carrier/pitch-deg",0);
setprop("/carrier/pitch-offset",0);
setprop("/carrier/roll-deg",0);
setprop("/carrier/roll-offset",0);
setprop("/carrier/sunk",0);
setprop("/carrier/aground",0);
var PositionUpdater = func () {
@ -48,34 +51,67 @@ var PositionUpdater = func () {
time_last = time_now;
var heading = getprop("/orientation/heading-deg");
var speed = getprop("/velocities/groundspeed-kt");
var rudder = getprop("/surface-positions/rudder-pos-norm");
if ( getprop("/carrier/sunk") == 0 and getprop("/autopilot/route-manager/active") == 1 ) {
var aground_pos = geo.Coord.new().set_latlon(position.lat(),position.lon());
aground_pos.apply_course_distance(heading,25);
var aground = geodinfo(aground_pos.lat(), aground_pos.lon())[1].solid;
if ( aground == 0 ) {
aground_pos.apply_course_distance(heading,-50);
aground = geodinfo(aground_pos.lat(), aground_pos.lon())[1].solid;
}
if ( aground == 1 ) {
setprop("/carrier/aground",1);
setprop("/carrier/sunk",1);
}
#for event
var speed = 15;
var cur_waypoint = getprop("/autopilot/route-manager/current-wp");
var cur_wp_lon = getprop("/autopilot/route-manager/route/wp[" ~ cur_waypoint ~ "]/longitude-deg");
var cur_wp_lat = getprop("/autopilot/route-manager/route/wp[" ~ cur_waypoint ~ "]/latitude-deg");
var rm_destination = geo.Coord.new().set_latlon(cur_wp_lat,cur_wp_lon);
var heading = position.course_to(rm_destination);
if ( aground == 1 ) {
speed = 0;
}
#print(speed);
var distance = speed * globals.KT2MPS * dt;
position.apply_course_distance(heading, distance);
# check if we've ran aground
# Set new position
setprop("/position/latitude-deg", position.lat());
setprop("/position/longitude-deg", position.lon());
var g_alt = getprop("/position/ground-elev-ft");
setprop("/position/altitude-ft",g_alt);
# Update heading
var course = heading + rudder * heading_ps * dt;
setprop("/orientation/heading-deg", course);
if ( getprop("/carrier/sunk") == 0 ) {
# Update heading
var course = heading + rudder * heading_ps * dt;
setprop("/orientation/heading-deg", course);
setprop("/position/altitude-ft",getprop("/position/ground-elev-ft"));
# } elsif ( getprop("/carrier/sunk") == 0 and getprop("/autopilot/route-manager/active") == 1 ) {
#
# #for event
# var speed = 15;
# var cur_waypoint = getprop("/autopilot/route-manager/current-wp");
# var cur_wp_lon = getprop("/autopilot/route-manager/route/wp[" ~ cur_waypoint ~ "]/longitude-deg");
# var cur_wp_lat = getprop("/autopilot/route-manager/route/wp[" ~ cur_waypoint ~ "]/latitude-deg");
# var rm_destination = geo.Coord.new().set_latlon(cur_wp_lat,cur_wp_lon);
#
#
# var heading = position.course_to(rm_destination);
#
# 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());
# var g_alt = getprop("/position/ground-elev-ft");
# setprop("/position/altitude-ft",g_alt);
#
# # Update heading
# var course = heading + rudder * heading_ps * dt;
# setprop("/orientation/heading-deg", course);
#
} elsif ( getprop("/carrier/sunk") == 1 ) {
setprop("/carrier/fbw/target/groundspeed-kt",0);
setprop("/controls/engines/engine/throttle",0);
@ -85,9 +121,11 @@ var PositionUpdater = func () {
setprop("/position/longitude-deg", position.lon());
#calculate sinking.
setprop("/position/altitude-ft",getprop("/position/altitude-ft") - ( sink_rate ));
setprop("/carrier/pitch-offset",getprop("/carrier/pitch-offset") + ( pitch_rate ));
setprop("/carrier/roll-offset",getprop("/carrier/roll-offset") + ( roll_rate ));
if ( getprop("carrier/aground") != 1 ) {
setprop("/position/altitude-ft",getprop("/position/altitude-ft") - ( sink_rate ));
setprop("/carrier/pitch-offset",getprop("/carrier/pitch-offset") + ( pitch_rate ));
setprop("/carrier/roll-offset",getprop("/carrier/roll-offset") + ( roll_rate ));
}
}
#set pitch

View File

@ -121,50 +121,6 @@
</config>
</view>
<view n="104">
<name>Landing Signal Officer View</name>
<type>lookfrom</type>
<internal type="bool">false</internal>
<config>
<from-model type="bool">true</from-model>
<from-model-idx type="int">0</from-model-idx>
<heading-offset-deg>180</heading-offset-deg>
<x-offset-m>-19.7208</x-offset-m><!-- right -->
<y-offset-m>21.925</y-offset-m><!-- up -->
<z-offset-m>100.307</z-offset-m><!-- back -->
<pitch-offset-deg>2.5</pitch-offset-deg>
<default-field-of-view-deg>60</default-field-of-view-deg>
<ground-level-nearplane-m type="double">0.1f</ground-level-nearplane-m>
</config>
</view>
<view n="105">
<name>Approach View</name>
<type>lookfrom</type>
<internal type="bool">false</internal>
<config>
<!-- All these eye-*-deg-path elements are needed because
eye-heading-deg-path is overridden.
-->
<eye-lat-deg-path>/position/latitude-deg</eye-lat-deg-path>
<eye-lon-deg-path>/position/longitude-deg</eye-lon-deg-path>
<eye-alt-ft-path>/position/altitude-ft</eye-alt-ft-path>
<eye-heading-deg-path>/orientation/heading-runway-deg</eye-heading-deg-path>
<eye-pitch-deg-path>/orientation/pitch-deg</eye-pitch-deg-path>
<eye-roll-deg-path>/orientation/roll-deg</eye-roll-deg-path>
<x-offset-m>-15.4979</x-offset-m><!-- right -->
<y-offset-m>21.9</y-offset-m><!-- up -->
<z-offset-m>-8.315</z-offset-m><!-- back -->
<heading-offset-deg>180</heading-offset-deg>
<pitch-offset-deg>3</pitch-offset-deg>
<default-field-of-view-deg>25</default-field-of-view-deg>
<ground-level-nearplane-m type="double">0.1f</ground-level-nearplane-m>
</config>
</view>
<view n="106">
<name>Flight Deck Aft View</name>
<type>lookfrom</type>
@ -259,22 +215,4 @@
</config>
</view>
<view n="111">
<name>Bridge View</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>29.2083</x-offset-m><!-- right -->
<y-offset-m>33.235233</y-offset-m><!-- up -->
<z-offset-m>19.45</z-offset-m><!-- back -->
<pitch-offset-deg>-2</pitch-offset-deg>
<default-field-of-view-deg>45</default-field-of-view-deg>
<ground-level-nearplane-m type="double">0.1f</ground-level-nearplane-m>
</config>
</view>
</PropertyList>

View File

@ -31,24 +31,4 @@
</output>
</filter>
<filter>
<name>Flight Deck Antennas Position</name>
<type>noise-spike</type>
<input>
<condition>
<property>/carrier/antennas/enabled</property>
</condition>
<value>0.0</value>
</input>
<input>
<value>1.0</value>
</input>
<output>
<property>/carrier/antennas/antenna-pos-norm</property>
</output>
<!-- Change position in 5 seconds -->
<max-rate-of-change>0.2</max-rate-of-change>
</filter>
</PropertyList>

View File

@ -55,6 +55,7 @@
<movement type="bool">true</movement>
</settings>
</fdm>
<mode type="string">manual</mode>
</carrier>
<sim include="Sim/views.xml">
@ -75,10 +76,6 @@
<always-show-in-MP type="bool">true</always-show-in-MP>
</model>
<sound>
<path>Sounds/sound.xml</path>
</sound>
<presets>
<onground>true</onground>
</presets>
@ -113,6 +110,9 @@
<autopilot>
<path>Systems/fdm.xml</path>
</autopilot>
<autopilot>
<path>Aircraft/missile-frigate/autopilot.xml</path>
</autopilot>
<property-rule n="100">
<path>Systems/views.xml</path>
@ -120,7 +120,8 @@
</systems>
<multiplay>
<generic>
<int n="0" type="int">0</int>
<int n="0" alias="/carrier/sunk"/>
<int n="2" type="int">0</int>
</generic>
</multiplay>
<menubar>
@ -137,9 +138,34 @@
</script>
</binding>
</item>
<item>
<label>Targets</label>
<name>enemies</name>
<binding>
<command>dialog-show</command>
<dialog-name>enemies</dialog-name>
</binding>
</item>
</menu>
</default>
</menubar>
<aircraft-data>
<!-- Properties that get saved to persist locally between FG sessions -->
<path>enemies/e1</path>
<path>enemies/e2</path>
<path>enemies/e3</path>
<path>enemies/e4</path>
<path>enemies/e5</path>
<path>enemies/e6</path>
<path>enemies/e7</path>
<path>enemies/e8</path>
<path>enemies/e9</path>
<path>enemies/e10</path>
<path>enemies/e11</path>
<path>enemies/e12</path>
</aircraft-data>
</sim>
<!-- need to adjust this (probably) -->
@ -229,41 +255,51 @@
<armament>
<models type="string">Aircraft/missile-frigate/Models/Armament/Weapons/</models>
<modelsUseCase type="bool">true</modelsUseCase>
<modelsUpperCase type="bool">true</modelsUpperCase>
<MP-lat type="string">rotors/main/blade[0]/flap-deg</MP-lat>
<MP-lon type="string">rotors/main/blade[1]/flap-deg</MP-lon>
<MP-alt type="string">rotors/main/blade[2]/flap-deg</MP-alt>
<hit-interpolation type="bool">true</hit-interpolation>
<pylon-offset type="int">1</pylon-offset>
<pylon-stations>controls/armament</pylon-stations>
<station-name type="string">station</station-name>
<msg type="bool">true</msg>
<damage type="bool">true</damage>
<kn-06>
<sound-on-off type="bool">false</sound-on-off>
<sound-volume type="double">0.0</sound-volume>
<vol-search type="double">0.00</vol-search>
<vol-track type="double">0.15</vol-track> <!-- new -->
<vol-track-weak type="double">0.1</vol-track-weak> <!-- new -->
<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">APN</navigation> <!-- new -->
<navigation type="string">APN</navigation> <!-- -->
<all-aspect type="bool">true</all-aspect>
<max-fire-range-nm type="int">85</max-fire-range-nm>
<FCS-field-deg type="int">360</FCS-field-deg>
<seeker-field-deg type="int">360</seeker-field-deg>
<seeker-field-deg type="int">220</seeker-field-deg><!-- since launched vertical, it cannot be too small -->
<max-g type="int">22</max-g>
<thrust-lbf-stage-1 type="double">100000</thrust-lbf-stage-1>
<thrust-lbf-stage-2 type="double">80000</thrust-lbf-stage-2>
<thrust-lbf-stage-1 type="double">90000</thrust-lbf-stage-1>
<thrust-lbf-stage-2 type="double">77000</thrust-lbf-stage-2> <!-- max 2000 m/s speed, 93 NM range -->
<stage-1-duration-sec type="double">0.25</stage-1-duration-sec>
<stage-2-duration-sec type="double">12.0</stage-2-duration-sec>
<stage-2-duration-sec type="double">8.0</stage-2-duration-sec>
<weight-launch-lbs>3920</weight-launch-lbs>
<weight-warhead-lbs>315</weight-warhead-lbs>
<weight-fuel-lbs>2800</weight-fuel-lbs> <!-- new -->
<drag-coeff type="double">0.15</drag-coeff>
<drag-area type="double">2.11349</drag-area>
<weight-fuel-lbm>2800</weight-fuel-lbm> <!-- -->
<drag-coeff type="double">0.20</drag-coeff> <!-- max 2000 m/s speed, 93 NM range -->
<cross-section-sqft type="double">2.11349</cross-section-sqft>
<arming-time-sec type="double">2</arming-time-sec>
<min-speed-for-guiding-mach type="double">0.25</min-speed-for-guiding-mach>
<self-destruct-time-sec type="double">160</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">75000</loft-altitude>
<min-fire-range-nm type="double">0.85</min-fire-range-nm>
<max-report-distance type="double">200</max-report-distance> <!-- new -->
<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">90</rail-pitch-deg> <!-- new -->
<chaff-resistance type="double">0.95</chaff-resistance>
<proportionality-constant type="double">3</proportionality-constant>
<class type="string">A</class>
<fire-msg>Bird away</fire-msg>
</kn-06>
@ -271,6 +307,7 @@
<test>
<sound-on-off type="bool">false</sound-on-off>
<sound-volume type="double">0.0</sound-volume>
<sound-fire-on-off type="bool">false</sound-fire-on-off>
<vol-search type="double">0.00</vol-search>
<guidance type="string">radar</guidance>
<all-aspect type="bool">true</all-aspect>
@ -344,6 +381,21 @@
</blade>
</main>
</rotors>
<enemies>
<e1 userarchive="y" type="string">Leto</e1>
<e2 userarchive="y" type="string">swamp</e2>
<e3 userarchive="y" type="string">pinto</e3>
<e4 userarchive="y" type="string">fb237</e4>
<e5 userarchive="y" type="string">Wilco-1</e5>
<e6 userarchive="y" type="string">Kokos</e6>
<e7 userarchive="y" type="string">J-Mav16</e7>
<e8 userarchive="y" type="string">S</e8>
<e9 userarchive="y" type="string">Raider1</e9>
<e10 userarchive="y" type="string">Slobb</e10>
<e11 userarchive="y" type="string">5H1N0B1</e11>
<e12 userarchive="y" type="string">SNOWY1</e12>
</enemies>
<nasal>
<carrier>
@ -352,6 +404,18 @@
<damage>
<file>Aircraft/missile-frigate/Nasal/damage.nas</file>
</damage>
<radar_logic>
<file>Aircraft/missile-frigate/Nasal/radar-logic.nas</file>
</radar_logic>
<vector>
<file>Aircraft/missile-frigate/Nasal/vector.nas</file>
</vector>
<armament>
<file>Aircraft/missile-frigate/Nasal/guided-missiles.nas</file>
</armament>
<fire_control>
<file>Aircraft/missile-frigate/Nasal/fire-control.nas</file>
</fire_control>
</nasal>
<input>