Update shooting SAMs

This commit is contained in:
Nikolai V. Chr 2023-09-25 22:08:40 +02:00
parent cecf8dd850
commit dd44318c9a
37 changed files with 463 additions and 3053 deletions

View File

@ -19,7 +19,7 @@
<sim>
<author>pinto, Nikolai V. Chr.</author>
<description>BUK-M2</description>
<long-description>BUK-M2 is a modern Russian self-propelled surface to air missile system.</long-description>
<long-description>BUK-M2 (SA-17) is a modern Russian self-propelled surface to air missile system.</long-description>
<status>alpha</status>
<aircraft-version>0.1</aircraft-version>

View File

@ -1,330 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<name>control-panel</name>
<layout>vbox</layout>
<width>250</width>
<resizable>false</resizable>
<group>
<layout>hbox</layout>
<empty><stretch>true</stretch></empty>
<text>
<label>Control Panel</label>
</text>
<empty><stretch>true</stretch></empty>
<button>
<legend/>
<keynum>27</keynum>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<padding>6</padding>
<text>
<label>Elevators</label>
</text>
<group>
<layout>table</layout>
<!-- 3rd -->
<text>
<row>0</row>
<col>1</col>
<label>3rd</label>
</text>
<!-- 3rd -->
<button>
<row>1</row>
<col>1</col>
<visible>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</binding>
</button>
<button>
<row>1</row>
<col>1</col>
<visible>
<not>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</binding>
</button>
<!-- 2nd -->
<text>
<row>2</row>
<col>1</col>
<label>2nd</label>
</text>
<!-- 2nd -->
<button>
<row>3</row>
<col>1</col>
<visible>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</binding>
</button>
<button>
<row>3</row>
<col>1</col>
<visible>
<not>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</binding>
</button>
<!-- 4th -->
<text>
<row>4</row>
<col>0</col>
<label>4th</label>
</text>
<!-- 1st -->
<text>
<row>4</row>
<col>1</col>
<label>1st</label>
</text>
<!-- 4th -->
<button>
<row>5</row>
<col>0</col>
<visible>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</binding>
</button>
<button>
<row>5</row>
<col>0</col>
<visible>
<not>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</binding>
</button>
<!-- 1st -->
<button>
<row>5</row>
<col>1</col>
<visible>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</binding>
</button>
<button>
<row>5</row>
<col>1</col>
<visible>
<not>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</binding>
</button>
</group>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<padding>6</padding>
<text>
<label>Flight Deck</label>
</text>
<group>
<layout>vbox</layout>
<checkbox>
<halign>left</halign>
<label>Runway lighting</label>
<property>/controls/lighting/deck-lights</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Antennas</label>
<property>/carrier/antennas/enabled</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
</group>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<padding>6</padding>
<text>
<label>Debug</label>
</text>
<group>
<layout>vbox</layout>
<checkbox>
<halign>left</halign>
<label>Enable ship movememnt</label>
<property>/carrier/fdm/settings/movement</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Show Phalanx aim points</label>
<property>/carrier/phalanx/settings/show-debug-aim</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
</group>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<default-padding>6</default-padding>
<empty><stretch>true</stretch></empty>
<button>
<legend>Close</legend>
<default>true</default>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</PropertyList>

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<default>
<menu n="10">
<label>CVN-70</label>
<enabled type="bool">true</enabled>
<item>
<label>Control Panel</label>
<binding>
<command>dialog-show</command>
<dialog-name>control-panel</dialog-name>
</binding>
</item>
</menu>
</default>
</PropertyList>

View File

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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 2 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/>.
-->
<PropertyList>
<mouse n="0">
<mode n="0">
<button n="3">
<binding n="0">
<script></script>
</binding>
<binding n="1">
<condition>
<property>/sim/current-view/can-change-z-offset</property>
</condition>
<command>nasal</command>
<script>
var distance = getprop("/sim/current-view/z-offset-m");
var multiple = getprop("/sim/current-view/z-offset-inc-step");
var min_dist = getprop("/sim/current-view/z-offset-min-m");
# Round distance to a multiple of the step
distance = math.round(std.min(-min_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meter", abs(getprop("/sim/current-view/z-offset-m"))));
</script>
</binding>
</button>
<button n="4">
<binding n="0">
<script></script>
</binding>
<binding n="1">
<condition>
<property>/sim/current-view/can-change-z-offset</property>
</condition>
<command>nasal</command>
<script>
var distance = getprop("/sim/current-view/z-offset-m");
var multiple = getprop("/sim/current-view/z-offset-dec-step");
var max_dist = getprop("/sim/current-view/z-offset-max-m");
# Round distance to a multiple of the step
distance = math.round(std.max(-max_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meter", abs(getprop("/sim/current-view/z-offset-m"))));
</script>
</binding>
</button>
</mode>
</mouse>
</PropertyList>

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<filter>
<name>FBW Throttle</name>
<type>gain</type>
<gain>80.0</gain>
<input>
<property>/controls/engines/engine[0]/throttle</property>
</input>
<output>
<property>/carrier/fbw/target/groundspeed-kt</property>
</output>
</filter>
<filter>
<name>FBW Rudder</name>
<type>gain</type>
<gain>8.0</gain>
<input>
<property>/controls/flight/rudder</property>
</input>
<output>
<property>/surface-positions/rudder-pos-norm</property>
</output>
</filter>
</PropertyList>

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<!-- Simulate the groundspeed -->
<filter>
<name>FDM Groundspeed</name>
<type>noise-spike</type>
<input>
<property>/carrier/fbw/target/groundspeed-kt</property>
</input>
<output>
<property>/velocities/groundspeed-kt</property>
</output>
<!-- Reaching maximum speed takes 20 minutes -->
<max-rate-of-change>7</max-rate-of-change>
</filter>
<!-- Flags use true-heading-deg because only that property is available
in multiplayer.
-->
<filter>
<name>FDM True Heading For Flags</name>
<type>gain</type>
<input>
<property>/orientation/heading-deg</property>
</input>
<output>
<property>/orientation/true-heading-deg</property>
</output>
</filter>
<!-- ================================================================== -->
<!-- Roll -->
<!-- ================================================================== -->
<!--
<filter>
<name>FDM Rudder</name>
<type>noise-spike</type>
<input>
<property>/controls/flight/rudder</property>
</input>
<output>
<property>/surface-positions/rudder-pos-norm</property>
</output>
<max-rate-of-change>5</max-rate-of-change>
</filter>-->
</PropertyList>

View File

@ -1,330 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<name>control-panel</name>
<layout>vbox</layout>
<width>250</width>
<resizable>false</resizable>
<group>
<layout>hbox</layout>
<empty><stretch>true</stretch></empty>
<text>
<label>Control Panel</label>
</text>
<empty><stretch>true</stretch></empty>
<button>
<legend/>
<keynum>27</keynum>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<padding>6</padding>
<text>
<label>Elevators</label>
</text>
<group>
<layout>table</layout>
<!-- 3rd -->
<text>
<row>0</row>
<col>1</col>
<label>3rd</label>
</text>
<!-- 3rd -->
<button>
<row>1</row>
<col>1</col>
<visible>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</binding>
</button>
<button>
<row>1</row>
<col>1</col>
<visible>
<not>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</binding>
</button>
<!-- 2nd -->
<text>
<row>2</row>
<col>1</col>
<label>2nd</label>
</text>
<!-- 2nd -->
<button>
<row>3</row>
<col>1</col>
<visible>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</binding>
</button>
<button>
<row>3</row>
<col>1</col>
<visible>
<not>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</binding>
</button>
<!-- 4th -->
<text>
<row>4</row>
<col>0</col>
<label>4th</label>
</text>
<!-- 1st -->
<text>
<row>4</row>
<col>1</col>
<label>1st</label>
</text>
<!-- 4th -->
<button>
<row>5</row>
<col>0</col>
<visible>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</binding>
</button>
<button>
<row>5</row>
<col>0</col>
<visible>
<not>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</binding>
</button>
<!-- 1st -->
<button>
<row>5</row>
<col>1</col>
<visible>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</binding>
</button>
<button>
<row>5</row>
<col>1</col>
<visible>
<not>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</binding>
</button>
</group>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<padding>6</padding>
<text>
<label>Flight Deck</label>
</text>
<group>
<layout>vbox</layout>
<checkbox>
<halign>left</halign>
<label>Runway lighting</label>
<property>/controls/lighting/deck-lights</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Antennas</label>
<property>/carrier/antennas/enabled</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
</group>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<padding>6</padding>
<text>
<label>Debug</label>
</text>
<group>
<layout>vbox</layout>
<checkbox>
<halign>left</halign>
<label>Enable ship movememnt</label>
<property>/carrier/fdm/settings/movement</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Show Phalanx aim points</label>
<property>/carrier/phalanx/settings/show-debug-aim</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
</group>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<default-padding>6</default-padding>
<empty><stretch>true</stretch></empty>
<button>
<legend>Close</legend>
<default>true</default>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</PropertyList>

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<default>
<menu n="10">
<label>CVN-70</label>
<enabled type="bool">true</enabled>
<item>
<label>Control Panel</label>
<binding>
<command>dialog-show</command>
<dialog-name>control-panel</dialog-name>
</binding>
</item>
</menu>
</default>
</PropertyList>

View File

@ -27,8 +27,6 @@ var mlw_max=getprop("payload/d-config/mlw_max"); #
var auto_flare_caller = getprop("payload/d-config/auto_flare_caller"); # If damage.nas should detect flare releases, or if function is called from somewhere in aircraft
############################################################################################################################
var TRUE = 1;
var FALSE = 0;
var hp = hp_max;
setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD
@ -164,7 +162,9 @@ var warheads = {
"pilot": [93, 0.00,1,0],# ejected pilot
"BETAB-500ShP": [94, 1160.00,1,0],
"Flare": [95, 0.00,0,0],
"3M9": [96, 125.00,0,0],# 3M9 Missile used with 2K12/SA-6
"3M9": [96, 125.00,0,0],# 3M9M3 Missile used with 2K12/SA-6
"5V28V": [97, 478.00,0,0],# Missile used with S-200D/SA-5
"AIM-9X": [98, 20.80,0,0],
};
var AIR_RADAR = "air";
@ -189,7 +189,8 @@ var radar_signatures = {
"E-8R": AIR_RADAR,
"EC-137D": AIR_RADAR,
"Mig-28": AIR_RADAR,
"SA-6": AIR_RADAR,#Air radar tone chosen so that there is at least some lock tone until asset-specific is created
"SA-6": "gnd-06",#Air radar tone chosen so that there is at least some lock tone until asset-specific is created
"s-200": "gnd-05",
"ZSU-23-4M": "gnd-23",
"S-75": "gnd-02",
"buk-m2": "gnd-11",
@ -203,7 +204,7 @@ var radar_signatures = {
var id2warhead = [];
var launched = {};# callsign: elapsed-sec
var approached = {};# callsign: uniqueID
var heavy_smoke = [61,62,63,65,92,96];
var heavy_smoke = [61,62,63,65,92,96,97];
var k = keys(warheads);
@ -241,6 +242,10 @@ for(var myid = 0;myid<size(k);myid+=1) {
}
}
var crater_model0 = getprop("payload/armament/models") ~ "crater_small.xml";
var crater_model1 = getprop("payload/armament/models") ~ "crater_big.xml";
var crater_model2 = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml";
#==================================================================
# Notification processing
#==================================================================
@ -281,6 +286,7 @@ var DamageRecipient =
# " Flags=",notification.Flags,
# " Radar=",bits.test(notification.Flags, 0),
# " Thrust=",bits.test(notification.Flags, 1));
# " CWI=",bits.test(notification.Flags, 2));
#
# todo:
# animate missiles
@ -301,6 +307,7 @@ var DamageRecipient =
var bearing = ownPos.course_to(notification.Position);
var radarOn = bits.test(notification.Flags, 0);
var thrustOn = bits.test(notification.Flags, 1);
var CWIOn = bits.test(notification.Flags, 2);
var index = notification.SecondaryKind-21;
var typ = id2warhead[index];
@ -334,7 +341,7 @@ var DamageRecipient =
dynamics["noti_"~notification.Callsign~"_"~notification.UniqueIdentity] = [systime()-(time_before_delete-1.6), notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.u_fps, notification.Heading, notification.Pitch,-1]
}
if (tacview_supported and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") {
if (tacview_supported and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) {
if (tacview.starttime) {
var tacID = left(md5(notification.Callsign~notification.UniqueIdentity),6);
if (notification.Kind == DESTROY) {
@ -348,7 +355,7 @@ var DamageRecipient =
var extra2 = typ[2]==0?",Type=Weapon+Missile":",Type=Weapon+Bomb";
extra2 = typ[4]=="Flare"?",Type=Flare":extra2;
extra2 = typp=="Parachutist"?"":extra2;
var color = radarOn?",Color=Red":",Color=Yellow";
var color = radarOn or CWIOn?",Color=Red":",Color=Yellow";
thread.lock(tacview.mutexWrite);
tacview.write("#" ~ (systime() - tacview.starttime)~"\n");
tacview.write(tacID~",T="~notification.Position.lon()~"|"~notification.Position.lat()~"|"~notification.Position.alt()~extra~",Name="~typp~color~extra2~"\n");
@ -376,9 +383,10 @@ var DamageRecipient =
setprop("payload/armament/MLW-launcher", notification.Callsign);
setprop("payload/armament/MLW-count", getprop("payload/armament/MLW-count")+1);
var out = sprintf("Missile Launch Warning from %03d degrees.", bearing);
if (rwr_to_screen) screen.log.write(out, 1,1,0);# temporary till someone models a RWR in RIO seat
if (rwr_to_screen) screen.log.write(out, 1,0.5,0);# temporary till someone models a RWR in RIO seat
print(out);
damageLog.push(sprintf("Missile Launch Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (m28_auto) mig28.missileLaunch();
}
}
}
@ -386,19 +394,29 @@ var DamageRecipient =
# Missile approach warning:
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
var clock = geo.normdeg(bearing - heading);
setprop("payload/armament/MAW-bearing", bearing);
setprop("payload/armament/MAW-active", 1);# resets every 1 seconds
if (!radarOn and !CWIOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
#var heading = getprop("orientation/heading-deg");
#var clock = geo.normdeg(bearing - heading);
if (radarOn) {
setprop("payload/armament/MAW-bearing", bearing);
setprop("payload/armament/MAW-active", 1);# resets every 1 seconds
} elsif (CWIOn) {
setprop("payload/armament/MAW-semiactive", 1);# resets every 1 seconds
}
MAW_elapsed = elapsed;
var appr = approached[notification.Callsign~notification.UniqueIdentity];
if (appr == nil or elapsed - appr > 450) {
printf("Missile Approach Warning from %03d degrees.", bearing);
damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,1,0);# temporary till someone models a RWR in RIO seat
if (radarOn) {
#printf("Missile Approach Warning from %03d degrees.", bearing);
damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,0.5,0);# temporary till someone models a RWR in RIO seat
} else {
#printf("Missile Approach Warning");
damageLog.push(sprintf("Missile Approach Warning from %s.", notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning (semi-active)."), 1,0.5,0);# temporary till someone models a RWR in RIO seat
}
approached[notification.Callsign~notification.UniqueIdentity] = elapsed;
if (m28_auto) mig28.engagedBy(notification.Callsign);
if (m28_auto) mig28.engagedBy(notification.Callsign, 1);
}
return emesary.Transmitter.ReceiptStatus_OK;
}
@ -415,7 +433,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
if (tacview_supported and tacview.starttime and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") {
if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) {
var node = getCallsign(notification.RemoteCallsign);
if (node != nil and notification.SecondaryKind > 20) {
# its a warhead
@ -439,9 +457,10 @@ var DamageRecipient =
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
if (notification.SecondaryKind < 0 and hitable_by_cannon) {
# cannon hit
if (m28_auto) mig28.engagedBy(notification.Callsign, 0);
var probability = id2shell[-1*notification.SecondaryKind-1][1];
var typ = id2shell[-1*notification.SecondaryKind-1][2];
var hit_count = notification.Distance;
@ -457,6 +476,7 @@ var DamageRecipient =
}
} elsif (notification.SecondaryKind > 20) {
# its a warhead
if (m28_auto) mig28.engagedBy(notification.Callsign, 1);
var dist = notification.Distance;
var wh = id2warhead[notification.SecondaryKind - 21];
var type = wh[4];#test code
@ -549,21 +569,18 @@ var DamageRecipient =
}
if (notification.Kind == CREATE and getprop("payload/armament/enable-craters") == 1 and statics["obj_"~notification.UniqueIdentity] == nil) {
if (notification.SecondaryKind == 0) {# TODO: make a hash with all the models
var crater_model = getprop("payload/armament/models") ~ "crater_small.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model0, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
#static is a PropertyNode inside /models
}
} elsif (notification.SecondaryKind == 1) {
var crater_model = getprop("payload/armament/models") ~ "crater_big.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model1, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
}
} elsif (notification.SecondaryKind == 2) {
var crater_model = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model2, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
}
@ -863,6 +880,7 @@ var flare_update_time = 0.4;
var flare_duration = 8;
var flare_terminal_speed = 50;#m/s
var flares_max_process_per_loop = 4;
var flare_sequencer = -120;
var flare_sorter = func(a, b) {
if(a[0] < b[0]){
@ -945,7 +963,9 @@ var flare_released = func {
getprop("orientation/heading-deg"),
FT2M*getprop("velocities/speed-down-fps"),
FT2M*math.sqrt(getprop("velocities/speed-north-fps")*getprop("velocities/speed-north-fps")+getprop("velocities/speed-east-fps")*getprop("velocities/speed-east-fps")),
int(rand()*240)-120];
flare_sequencer];
flare_sequencer += 1;
if (flare_sequencer > 120) flare_sequencer = -120;
append(flare_list, flare);
var msg = notifications.ObjectInFlightNotification.new("ffly", flare[6], MOVE, 21+95);
msg.Flags = 0;
@ -1233,7 +1253,7 @@ var processCallsigns = func () {
var painted = 0;
var paint_list = [];
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) {
if(player.getChild("valid") != nil and player.getChild("valid").getValue() == 1 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;
var str6 = player.getNode("sim/multiplay/generic/string[6]");
@ -1247,6 +1267,7 @@ var processCallsigns = func () {
}
if (getprop("sim/time/elapsed-sec")-MAW_elapsed > 1.1) {
setprop("payload/armament/MAW-active", 0);# resets every 1.1 seconds without warning
setprop("payload/armament/MAW-semiactive", 0);
}
# spike handling:
@ -1293,16 +1314,16 @@ processCallsignsTimer.start();
var code_ct = func () {
#ANTIC
if (getprop("payload/armament/msg")) {
setprop("sim/rendering/redout/enabled", TRUE);
setprop("sim/rendering/redout/enabled", 1);
#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= []);
if (!m28_auto) 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 = []);
call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "instrument-failures"}))},nil,var err2 = []);
}
setprop("sim/freeze/fuel",0);
setprop("/sim/speed-up", 1);
if (!m28_auto) setprop("/sim/speed-up", 1);
setprop("/gui/map/draw-traffic", 0);
setprop("/sim/marker-pins/traffic", 0);
setprop("/sim/gui/dialogs/map-canvas/draw-TFC", 0);
@ -1317,7 +1338,7 @@ code_ctTimer.simulatedTime = 1;
setprop("/sim/failure-manager/display-on-screen", FALSE);
setprop("/sim/failure-manager/display-on-screen", 0);
code_ctTimer.start();
@ -1337,6 +1358,22 @@ var re_init = func (node) {
}
stopLaunch();
damageLog.push("Aircraft was repaired due to re-init.");
# Remove all 3D craters and re-place them. Due to re-init can remove some of them.
foreach (var thekey ; keys(statics)) {
var sta = statics[thekey];
if (sta[0] != nil) {
sta[0].remove();
if (sta[5] == 0) {# TODO: make a hash with all the models
sta[0] = geo.put_model(crater_model0, sta[1], sta[2], sta[3], sta[4]);
} elsif (sta[5] == 1) {
sta[0] = geo.put_model(crater_model1, sta[1], sta[2], sta[3], sta[4]);
} elsif (sta[5] == 2) {
sta[0] = geo.put_model(crater_model2, sta[1], sta[2], sta[3], sta[4]);
}
}
}
}
#==================================================================
@ -1405,6 +1442,7 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0);
#screen.property_display.add("payload/armament/MAW-bearing");
#screen.property_display.add("payload/armament/MAW-active");
#screen.property_display.add("payload/armament/MAW-semiactive");
#screen.property_display.add("payload/armament/MLW-bearing");
#screen.property_display.add("payload/armament/MLW-count");
#screen.property_display.add("payload/armament/MLW-launcher");
@ -1412,6 +1450,8 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0);
#screen.property_display.add("payload/armament/spike-air");
#screen.property_display.add("payload/armament/spike-gnd-20");
#screen.property_display.add("payload/armament/spike-gnd-02");
#screen.property_display.add("payload/armament/spike-gnd-05");
#screen.property_display.add("payload/armament/spike-gnd-06");
#screen.property_display.add("payload/armament/spike-gnd-11");
#screen.property_display.add("payload/armament/spike-gnd-23");
#screen.property_display.add("payload/armament/spike-gnd-p2");

View File

@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#io.include("Aircraft/ExpansionPack/Nasal/init.nas");
srand();# seed the random generator with systime
#with("updateloop");
# Number of iterations per second

View File

@ -15,9 +15,6 @@ if ((major == 2017 and minor == 2 and pica >= 1) or (major == 2017 and minor > 2
pickingMethod = 1;
}
var FALSE = 0;
var TRUE = 1;
var AIR = 0;
var MARINE = 1;
var SURFACE = 2;
@ -73,6 +70,9 @@ var Contact = {
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;
@ -84,27 +84,63 @@ var Contact = {
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;
valid = 0;
}
if (me.callsign.getValue() != me.orig_callsign) {
valid = FALSE;
valid = 0;
}
return valid;
},
isPainted: func () {
if (me.painted == nil) {
me.painted = me.node.getNode("painted");
if (getprop("/carrier/sunk") == 1) {
return 0;
}
if (me.painted == nil) {
return nil;
return isNotBehindTerrain(me.node)[0];
},
isCommandActive: func {
if (getprop("/carrier/sunk") == 1) {
return 0;
}
var p = me.painted.getValue();
return p;
return isNotBehindTerrain(me.node)[0];
},
getUnique: func () {
@ -124,6 +160,7 @@ var Contact = {
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;
@ -343,108 +380,48 @@ var Contact = {
};
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 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 isVisible = 0;
}
var aircraftPos = geo.Coord.new().set_latlon(lat, lon, alt*0.3048);
#################
if (pickingMethod == 1) {
var myPos = geo.aircraft_position();
myPos.set_latlon(myPos.lat(),myPos.lon(),myPos.alt()+50);
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()};
var myPos = geo.aircraft_position();
# Check for terrain between own aircraft and other:
v = get_cart_ground_intersection(xyz, dir);
if (v == nil) {
return 1;
#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) {
#printf("terrain found between SAM and aircraft %.1f meter away.", terrainDist);
return 0;
} else {
#print("The planes has clear view of each other");
return 1;
}
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 {
var isVisible = 0;
var MyCoord = geo.aircraft_position();
# Because there is no terrain on earth that can be between these 2
if(MyCoord.alt() < 8900 and aircraftPos.alt() < 8900)
{
# Temporary variable
# A (our plane) coord in meters
var a = MyCoord.x();
var b = MyCoord.y();
var c = MyCoord.z();
# B (target) coord in meters
var d = aircraftPos.x();
var e = aircraftPos.y();
var f = aircraftPos.z();
var difa = d - a;
var difb = e - b;
var difc = f - c;
# direct Distance in meters
var myDistance = math.sqrt( math.pow((d-a),2) + math.pow((e-b),2) + math.pow((f-c),2)); #calculating distance ourselves to avoid another call to geo.nas (read: speed, probably).
var Aprime = geo.Coord.new();
# Here is to limit FPS drop on very long distance
var L = 500;
if(myDistance > 50000)
{
L = myDistance / 15;
}
var step = L;
var maxLoops = int(myDistance / L);
isVisible = 1;
# This loop will make travel a point between us and the target and check if there is terrain
for(var i = 1 ; i <= maxLoops ; i += 1)
{
#calculate intermediate step
#basically dividing the line into maxLoops number of steps, and checking at each step
#to ascii-art explain it:
# |us|----------|step 1|-----------|step 2|--------|step 3|----------|them|
#there will be as many steps as there is i
#every step will be equidistant
#also, if i == 0 then the first step will be our plane
var x = ((difa/(maxLoops+1))*i)+a;
var y = ((difb/(maxLoops+1))*i)+b;
var z = ((difc/(maxLoops+1))*i)+c;
#print("i:" ~ i ~ "|x,y,z | " ~ x ~ "," ~ y ~ "," ~ z);
Aprime.set_xyz(x,y,z);
var AprimeTerrainAlt = geo.elevation(Aprime.lat(), Aprime.lon());
if(AprimeTerrainAlt == nil)
{
AprimeTerrainAlt = 0;
}
if(AprimeTerrainAlt > Aprime.alt())
{
#print("behind terrain");
return 0;
}
}
}
else
{
isVisible = 1;
}
return isVisible;
#print("The planes has clear view of each other");
return [1,1]; # visible and in front of terrain
}
}
}

View File

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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 2 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/>.
-->
<PropertyList>
<mouse n="0">
<mode n="0">
<button n="3">
<binding n="0">
<script></script>
</binding>
<binding n="1">
<condition>
<property>/sim/current-view/can-change-z-offset</property>
</condition>
<command>nasal</command>
<script>
var distance = getprop("/sim/current-view/z-offset-m");
var multiple = getprop("/sim/current-view/z-offset-inc-step");
var min_dist = getprop("/sim/current-view/z-offset-min-m");
# Round distance to a multiple of the step
distance = math.round(std.min(-min_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meter", abs(getprop("/sim/current-view/z-offset-m"))));
</script>
</binding>
</button>
<button n="4">
<binding n="0">
<script></script>
</binding>
<binding n="1">
<condition>
<property>/sim/current-view/can-change-z-offset</property>
</condition>
<command>nasal</command>
<script>
var distance = getprop("/sim/current-view/z-offset-m");
var multiple = getprop("/sim/current-view/z-offset-dec-step");
var max_dist = getprop("/sim/current-view/z-offset-max-m");
# Round distance to a multiple of the step
distance = math.round(std.max(-max_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meter", abs(getprop("/sim/current-view/z-offset-m"))));
</script>
</binding>
</button>
</mode>
</mouse>
</PropertyList>

View File

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<filter>
<name>FBW Throttle</name>
<type>gain</type>
<gain>30.0</gain>
<input>
<property>/controls/engines/engine[0]/throttle</property>
</input>
<output>
<property>/carrier/fbw/target/groundspeed-kt</property>
</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

@ -1,410 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<!-- Simulate the groundspeed -->
<filter>
<name>FDM Groundspeed</name>
<type>noise-spike</type>
<input>
<property>/carrier/fbw/target/groundspeed-kt</property>
</input>
<output>
<property>/velocities/groundspeed-kt</property>
</output>
<!-- Reaching maximum speed takes 20 minutes -->
<max-rate-of-change>0.075</max-rate-of-change>
</filter>
<!-- Flags use true-heading-deg because only that property is available
in multiplayer.
-->
<filter>
<name>FDM True Heading For Flags</name>
<type>gain</type>
<input>
<property>/orientation/heading-deg</property>
</input>
<output>
<property>/orientation/true-heading-deg</property>
</output>
</filter>
<!-- ================================================================== -->
<!-- Waves -->
<!-- ================================================================== -->
<!-- Compute the heading of the waves relative to the ship. -90 or
90 if perpendicular, and 0 if colinear.
-->
<filter>
<name>FDM Wave Heading</name>
<type>gain</type>
<input>
<expression>
<difference>
<rad2deg>
<atan2>
<property>/environment/sea/surface/wind-from-east-fps</property>
<property>/environment/sea/surface/wind-from-north-fps</property>
</atan2>
</rad2deg>
<property>/orientation/heading-deg</property>
</difference>
</expression>
<period>
<min>-90</min>
<max>90</max>
</period>
</input>
<output>
<property>/carrier/fdm/output/wave-heading</property>
</output>
</filter>
<!-- Compute the normalized value of the relative wave heading. 1 if
perpendicular, 0 if sailing in to the wind.
-->
<filter>
<name>FDM Wave Perpendicular Normalized</name>
<type>gain</type>
<input>
<expression>
<div>
<abs>
<property>/carrier/fdm/output/wave-heading</property>
</abs>
<value>90.0</value>
</div>
</expression>
</input>
<output>
<property>/carrier/fdm/output/wave-perpendicular-norm</property>
</output>
</filter>
<!-- Computes the strength of the waves in knots -->
<filter>
<name>FDM Wave Strength</name>
<type>gain</type>
<input>
<expression>
<product>
<sqrt>
<sum>
<pow>
<property>/environment/sea/surface/wind-from-east-fps</property>
<value>2.0</value>
</pow>
<pow>
<property>/environment/sea/surface/wind-from-north-fps</property>
<value>2.0</value>
</pow>
</sum>
</sqrt>
<!-- fps to knots -->
<value>0.5924838012958964</value>
</product>
</expression>
</input>
<output>
<property>/carrier/fdm/output/wave-speed-kt</property>
</output>
</filter>
<filter>
<name>FDM Heel Wave Factor</name>
<type>gain</type>
<input>
<expression>
<div>
<min>
<product>
<property>/carrier/fdm/output/wave-speed-kt</property>
<sin>
<deg2rad>
<abs>
<property>/carrier/fdm/output/wave-heading</property>
</abs>
</deg2rad>
</sin>
</product>
<property>/carrier/fdm/settings/max-heel-oscillation-wave-kt</property>
</min>
<property>/carrier/fdm/settings/max-heel-oscillation-wave-kt</property>
</div>
</expression>
</input>
<output>
<property>/carrier/fdm/output/heel-wave-factor</property>
</output>
</filter>
<filter>
<name>FDM Trim Wave Factor</name>
<type>gain</type>
<input>
<expression>
<div>
<min>
<sum>
<product>
<property>/carrier/fdm/output/wave-speed-kt</property>
<cos>
<deg2rad>
<abs>
<property>/carrier/fdm/output/wave-heading</property>
</abs>
</deg2rad>
</cos>
</product>
<property>/velocities/groundspeed-kt</property>
</sum>
<property>/carrier/fdm/settings/max-trim-oscillation-wave-kt</property>
</min>
<property>/carrier/fdm/settings/max-trim-oscillation-wave-kt</property>
</div>
</expression>
</input>
<output>
<property>/carrier/fdm/output/trim-wave-factor</property>
</output>
</filter>
<!-- ================================================================== -->
<!-- Roll -->
<!-- ================================================================== -->
<!-- Simulate the movement of the rudder -->
<filter>
<name>FDM Rudder</name>
<type>noise-spike</type>
<input>
<property>/controls/flight/rudder</property>
</input>
<output>
<property>/surface-positions/rudder-pos-norm</property>
</output>
<!-- Moving the rudder to maximum deviation takes 5 seconds -->
<max-rate-of-change>0.2</max-rate-of-change>
</filter>
<!-- Simulate the roll of the ship depending on the rudder deflection
and groundspeed. A roll of 15 deg will be obtained at a groundspeed
of 30 knots and maximum rudder deflection.
-->
<filter>
<name>FDM Turn Centrifugal Force</name>
<type>gain</type>
<input>
<expression>
<product>
<div>
<property>/velocities/groundspeed-kt</property>
<value>30.0</value>
</div>
<property>/surface-positions/rudder-pos-norm</property>
<property>/carrier/fdm/settings/bank-limit</property>
<value>-1.0</value>
</product>
</expression>
</input>
<output>
<property>/carrier/fdm/target/roll-deg</property>
</output>
</filter>
<!-- PID controller used to simulate slowly reaching the target roll
degree representing the roll caused when turning.
-->
<pid-controller>
<name>FDM Turn PID</name>
<input>
<property>/carrier/roll-deg</property>
</input>
<reference>
<property>/carrier/fdm/target/roll-deg</property>
</reference>
<output>
<property>/carrier/fdm/output/roll-deg</property>
</output>
<config>
<Kp>0.5</Kp>
<Ti>2.0</Ti>
<u_min>
<property>/carrier/fdm/settings/bank-limit</property>
<scale>-1.0</scale>
</u_min>
<u_max>
<property>/carrier/fdm/settings/bank-limit</property>
</u_max>
</config>
</pid-controller>
<!-- An undamped oscillator simulating heeling (continuously rolling
around the longitudinal axis) of the ship. The output does not
oscillate around 0, instead it oscillates between 0 and some
negative value. See the gain filter below, which makes the value
oscillate around 0.
-->
<filter>
<name>FDM Heeling Force Oscillator</name>
<type>damped-oscillation</type>
<debug>false</debug>
<a>
<value>0.0</value>
</a>
<b>
<property>/carrier/fdm/settings/heel-frequency</property>
</b>
<c>
<expression>
<product>
<property>/carrier/fdm/settings/heel-frequency</property>
<property>/carrier/fdm/settings/heel-overshoot</property>
</product>
</expression>
</c>
<output>
<property>/carrier/fdm/output/heel-osci</property>
</output>
</filter>
<!-- Add the configured heel overshoot to make the oscillating value
oscillate around 0.
-->
<filter>
<name>FDM Heeling Degree</name>
<type>gain</type>
<input>
<expression>
<sum>
<property>/carrier/fdm/output/heel-osci</property>
<property>/carrier/fdm/settings/heel-overshoot</property>
</sum>
</expression>
</input>
<output>
<property>/carrier/fdm/output/heel-deg</property>
</output>
</filter>
<!-- Use the sum of the PID controller and the undamped oscillator
as the actual roll degree.
-->
<filter>
<name>FDM Roll</name>
<type>gain</type>
<input>
<condition>
<property>/carrier/fdm/settings/movement</property>
</condition>
<property>/carrier/fdm/output/roll-deg</property>
<offset>
<property>/carrier/fdm/output/heel-deg</property>
<scale>
<property>/carrier/fdm/output/heel-wave-factor</property>
</scale>
</offset>
</input>
<input>
<value>0.0</value>
</input>
<output>
<property>/carrier/roll-deg</property>
</output>
</filter>
<!-- ================================================================== -->
<!-- Pitch -->
<!-- ================================================================== -->
<!-- An undamped oscillator simulating trimming (continuously pitching
around the lateral axis) of the ship. The output does not
oscillate around 0, instead it oscillates between 0 and some
negative value. See the gain filter below, which makes the value
oscillate around 0.
-->
<filter>
<name>FDM Trimming Force Oscillator</name>
<type>damped-oscillation</type>
<debug>false</debug>
<a>
<value>0.0</value>
</a>
<b>
<property>/carrier/fdm/settings/trim-frequency</property>
</b>
<c>
<expression>
<product>
<property>/carrier/fdm/settings/trim-frequency</property>
<property>/carrier/fdm/settings/trim-overshoot</property>
</product>
</expression>
</c>
<output>
<property>/carrier/fdm/output/trim-osci</property>
</output>
</filter>
<!-- Add the configured trim overshoot to make the oscillating value
oscillate around 0.
-->
<filter>
<name>FDM Trimming Degree</name>
<type>gain</type>
<input>
<expression>
<sum>
<property>/carrier/fdm/output/trim-osci</property>
<property>/carrier/fdm/settings/trim-overshoot</property>
</sum>
</expression>
</input>
<output>
<property>/carrier/fdm/output/trim-deg</property>
</output>
</filter>
<filter>
<name>FDM Pitch</name>
<type>gain</type>
<input>
<condition>
<property>/carrier/fdm/settings/movement</property>
</condition>
<property>/carrier/fdm/output/trim-deg</property>
<scale>
<property>/carrier/fdm/output/trim-wave-factor</property>
</scale>
</input>
<input>
<value>0.0</value>
</input>
<output>
<property>/carrier/pitch-deg</property>
</output>
</filter>
</PropertyList>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<default>
<menu n="10">
<label>CVN-70</label>
<enabled type="bool">true</enabled>
<item>
<label>Control Panel</label>
<binding>
<command>dialog-show</command>
<dialog-name>control-panel</dialog-name>
</binding>
</item>
</menu>
</default>
</PropertyList>

View File

@ -1,116 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<name>type</name>
<layout>vbox</layout>
<width>250</width>
<resizable>false</resizable>
<group>
<layout>hbox</layout>
<empty><stretch>true</stretch></empty>
<text>
<label>Type</label>
</text>
<empty><stretch>true</stretch></empty>
<button>
<legend/>
<keynum>27</keynum>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<default-padding>6</default-padding>
<empty><stretch>true</stretch></empty>
<button>
<legend>Depot</legend>
<binding>
<command>property-assign</command>
<property>sim/multiplay/generic/int[17]</property>
<value>0</value>
</binding>
</button>
<button>
<legend>Shelter</legend>
<binding>
<command>property-assign</command>
<property>sim/multiplay/generic/int[17]</property>
<value>1</value>
</binding>
</button>
<button>
<legend>Fuel</legend>
<binding>
<command>property-assign</command>
<property>sim/multiplay/generic/int[17]</property>
<value>2</value>
</binding>
</button>
<button>
<legend>Small Hangar</legend>
<binding>
<command>property-assign</command>
<property>sim/multiplay/generic/int[17]</property>
<value>3</value>
</binding>
</button>
<button>
<legend>Hangar</legend>
<binding>
<command>property-assign</command>
<property>sim/multiplay/generic/int[17]</property>
<value>4</value>
</binding>
</button>
<button>
<legend>Factory</legend>
<binding>
<command>property-assign</command>
<property>sim/multiplay/generic/int[17]</property>
<value>5</value>
</binding>
</button>
<button>
<legend>Plex</legend>
<binding>
<command>property-assign</command>
<property>sim/multiplay/generic/int[17]</property>
<value>6</value>
</binding>
</button>
</group>
</PropertyList>

View File

@ -27,8 +27,6 @@ var mlw_max=getprop("payload/d-config/mlw_max"); #
var auto_flare_caller = getprop("payload/d-config/auto_flare_caller"); # If damage.nas should detect flare releases, or if function is called from somewhere in aircraft
############################################################################################################################
var TRUE = 1;
var FALSE = 0;
var hp = hp_max;
setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD
@ -164,7 +162,9 @@ var warheads = {
"pilot": [93, 0.00,1,0],# ejected pilot
"BETAB-500ShP": [94, 1160.00,1,0],
"Flare": [95, 0.00,0,0],
"3M9": [96, 125.00,0,0],# 3M9 Missile used with 2K12/SA-6
"3M9": [96, 125.00,0,0],# 3M9M3 Missile used with 2K12/SA-6
"5V28V": [97, 478.00,0,0],# Missile used with S-200D/SA-5
"AIM-9X": [98, 20.80,0,0],
};
var AIR_RADAR = "air";
@ -189,7 +189,8 @@ var radar_signatures = {
"E-8R": AIR_RADAR,
"EC-137D": AIR_RADAR,
"Mig-28": AIR_RADAR,
"SA-6": AIR_RADAR,#Air radar tone chosen so that there is at least some lock tone until asset-specific is created
"SA-6": "gnd-06",#Air radar tone chosen so that there is at least some lock tone until asset-specific is created
"s-200": "gnd-05",
"ZSU-23-4M": "gnd-23",
"S-75": "gnd-02",
"buk-m2": "gnd-11",
@ -203,7 +204,7 @@ var radar_signatures = {
var id2warhead = [];
var launched = {};# callsign: elapsed-sec
var approached = {};# callsign: uniqueID
var heavy_smoke = [61,62,63,65,92,96];
var heavy_smoke = [61,62,63,65,92,96,97];
var k = keys(warheads);
@ -241,6 +242,10 @@ for(var myid = 0;myid<size(k);myid+=1) {
}
}
var crater_model0 = getprop("payload/armament/models") ~ "crater_small.xml";
var crater_model1 = getprop("payload/armament/models") ~ "crater_big.xml";
var crater_model2 = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml";
#==================================================================
# Notification processing
#==================================================================
@ -281,6 +286,7 @@ var DamageRecipient =
# " Flags=",notification.Flags,
# " Radar=",bits.test(notification.Flags, 0),
# " Thrust=",bits.test(notification.Flags, 1));
# " CWI=",bits.test(notification.Flags, 2));
#
# todo:
# animate missiles
@ -301,6 +307,7 @@ var DamageRecipient =
var bearing = ownPos.course_to(notification.Position);
var radarOn = bits.test(notification.Flags, 0);
var thrustOn = bits.test(notification.Flags, 1);
var CWIOn = bits.test(notification.Flags, 2);
var index = notification.SecondaryKind-21;
var typ = id2warhead[index];
@ -334,7 +341,7 @@ var DamageRecipient =
dynamics["noti_"~notification.Callsign~"_"~notification.UniqueIdentity] = [systime()-(time_before_delete-1.6), notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.u_fps, notification.Heading, notification.Pitch,-1]
}
if (tacview_supported and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") {
if (tacview_supported and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) {
if (tacview.starttime) {
var tacID = left(md5(notification.Callsign~notification.UniqueIdentity),6);
if (notification.Kind == DESTROY) {
@ -348,7 +355,7 @@ var DamageRecipient =
var extra2 = typ[2]==0?",Type=Weapon+Missile":",Type=Weapon+Bomb";
extra2 = typ[4]=="Flare"?",Type=Flare":extra2;
extra2 = typp=="Parachutist"?"":extra2;
var color = radarOn?",Color=Red":",Color=Yellow";
var color = radarOn or CWIOn?",Color=Red":",Color=Yellow";
thread.lock(tacview.mutexWrite);
tacview.write("#" ~ (systime() - tacview.starttime)~"\n");
tacview.write(tacID~",T="~notification.Position.lon()~"|"~notification.Position.lat()~"|"~notification.Position.alt()~extra~",Name="~typp~color~extra2~"\n");
@ -376,9 +383,10 @@ var DamageRecipient =
setprop("payload/armament/MLW-launcher", notification.Callsign);
setprop("payload/armament/MLW-count", getprop("payload/armament/MLW-count")+1);
var out = sprintf("Missile Launch Warning from %03d degrees.", bearing);
if (rwr_to_screen) screen.log.write(out, 1,1,0);# temporary till someone models a RWR in RIO seat
if (rwr_to_screen) screen.log.write(out, 1,0.5,0);# temporary till someone models a RWR in RIO seat
print(out);
damageLog.push(sprintf("Missile Launch Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (m28_auto) mig28.missileLaunch();
}
}
}
@ -386,19 +394,29 @@ var DamageRecipient =
# Missile approach warning:
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
var clock = geo.normdeg(bearing - heading);
setprop("payload/armament/MAW-bearing", bearing);
setprop("payload/armament/MAW-active", 1);# resets every 1 seconds
if (!radarOn and !CWIOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
#var heading = getprop("orientation/heading-deg");
#var clock = geo.normdeg(bearing - heading);
if (radarOn) {
setprop("payload/armament/MAW-bearing", bearing);
setprop("payload/armament/MAW-active", 1);# resets every 1 seconds
} elsif (CWIOn) {
setprop("payload/armament/MAW-semiactive", 1);# resets every 1 seconds
}
MAW_elapsed = elapsed;
var appr = approached[notification.Callsign~notification.UniqueIdentity];
if (appr == nil or elapsed - appr > 450) {
printf("Missile Approach Warning from %03d degrees.", bearing);
damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,1,0);# temporary till someone models a RWR in RIO seat
if (radarOn) {
#printf("Missile Approach Warning from %03d degrees.", bearing);
damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,0.5,0);# temporary till someone models a RWR in RIO seat
} else {
#printf("Missile Approach Warning");
damageLog.push(sprintf("Missile Approach Warning from %s.", notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning (semi-active)."), 1,0.5,0);# temporary till someone models a RWR in RIO seat
}
approached[notification.Callsign~notification.UniqueIdentity] = elapsed;
if (m28_auto) mig28.engagedBy(notification.Callsign);
if (m28_auto) mig28.engagedBy(notification.Callsign, 1);
}
return emesary.Transmitter.ReceiptStatus_OK;
}
@ -415,7 +433,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
if (tacview_supported and tacview.starttime and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") {
if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) {
var node = getCallsign(notification.RemoteCallsign);
if (node != nil and notification.SecondaryKind > 20) {
# its a warhead
@ -439,9 +457,10 @@ var DamageRecipient =
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
if (notification.SecondaryKind < 0 and hitable_by_cannon) {
# cannon hit
if (m28_auto) mig28.engagedBy(notification.Callsign, 0);
var probability = id2shell[-1*notification.SecondaryKind-1][1];
var typ = id2shell[-1*notification.SecondaryKind-1][2];
var hit_count = notification.Distance;
@ -457,6 +476,7 @@ var DamageRecipient =
}
} elsif (notification.SecondaryKind > 20) {
# its a warhead
if (m28_auto) mig28.engagedBy(notification.Callsign, 1);
var dist = notification.Distance;
var wh = id2warhead[notification.SecondaryKind - 21];
var type = wh[4];#test code
@ -549,21 +569,18 @@ var DamageRecipient =
}
if (notification.Kind == CREATE and getprop("payload/armament/enable-craters") == 1 and statics["obj_"~notification.UniqueIdentity] == nil) {
if (notification.SecondaryKind == 0) {# TODO: make a hash with all the models
var crater_model = getprop("payload/armament/models") ~ "crater_small.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model0, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
#static is a PropertyNode inside /models
}
} elsif (notification.SecondaryKind == 1) {
var crater_model = getprop("payload/armament/models") ~ "crater_big.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model1, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
}
} elsif (notification.SecondaryKind == 2) {
var crater_model = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model2, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
}
@ -863,6 +880,7 @@ var flare_update_time = 0.4;
var flare_duration = 8;
var flare_terminal_speed = 50;#m/s
var flares_max_process_per_loop = 4;
var flare_sequencer = -120;
var flare_sorter = func(a, b) {
if(a[0] < b[0]){
@ -945,7 +963,9 @@ var flare_released = func {
getprop("orientation/heading-deg"),
FT2M*getprop("velocities/speed-down-fps"),
FT2M*math.sqrt(getprop("velocities/speed-north-fps")*getprop("velocities/speed-north-fps")+getprop("velocities/speed-east-fps")*getprop("velocities/speed-east-fps")),
int(rand()*240)-120];
flare_sequencer];
flare_sequencer += 1;
if (flare_sequencer > 120) flare_sequencer = -120;
append(flare_list, flare);
var msg = notifications.ObjectInFlightNotification.new("ffly", flare[6], MOVE, 21+95);
msg.Flags = 0;
@ -1233,7 +1253,7 @@ var processCallsigns = func () {
var painted = 0;
var paint_list = [];
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) {
if(player.getChild("valid") != nil and player.getChild("valid").getValue() == 1 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;
var str6 = player.getNode("sim/multiplay/generic/string[6]");
@ -1247,6 +1267,7 @@ var processCallsigns = func () {
}
if (getprop("sim/time/elapsed-sec")-MAW_elapsed > 1.1) {
setprop("payload/armament/MAW-active", 0);# resets every 1.1 seconds without warning
setprop("payload/armament/MAW-semiactive", 0);
}
# spike handling:
@ -1293,16 +1314,16 @@ processCallsignsTimer.start();
var code_ct = func () {
#ANTIC
if (getprop("payload/armament/msg")) {
setprop("sim/rendering/redout/enabled", TRUE);
setprop("sim/rendering/redout/enabled", 1);
#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= []);
if (!m28_auto) 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 = []);
call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "instrument-failures"}))},nil,var err2 = []);
}
setprop("sim/freeze/fuel",0);
setprop("/sim/speed-up", 1);
if (!m28_auto) setprop("/sim/speed-up", 1);
setprop("/gui/map/draw-traffic", 0);
setprop("/sim/marker-pins/traffic", 0);
setprop("/sim/gui/dialogs/map-canvas/draw-TFC", 0);
@ -1317,7 +1338,7 @@ code_ctTimer.simulatedTime = 1;
setprop("/sim/failure-manager/display-on-screen", FALSE);
setprop("/sim/failure-manager/display-on-screen", 0);
code_ctTimer.start();
@ -1337,6 +1358,22 @@ var re_init = func (node) {
}
stopLaunch();
damageLog.push("Aircraft was repaired due to re-init.");
# Remove all 3D craters and re-place them. Due to re-init can remove some of them.
foreach (var thekey ; keys(statics)) {
var sta = statics[thekey];
if (sta[0] != nil) {
sta[0].remove();
if (sta[5] == 0) {# TODO: make a hash with all the models
sta[0] = geo.put_model(crater_model0, sta[1], sta[2], sta[3], sta[4]);
} elsif (sta[5] == 1) {
sta[0] = geo.put_model(crater_model1, sta[1], sta[2], sta[3], sta[4]);
} elsif (sta[5] == 2) {
sta[0] = geo.put_model(crater_model2, sta[1], sta[2], sta[3], sta[4]);
}
}
}
}
#==================================================================
@ -1405,6 +1442,7 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0);
#screen.property_display.add("payload/armament/MAW-bearing");
#screen.property_display.add("payload/armament/MAW-active");
#screen.property_display.add("payload/armament/MAW-semiactive");
#screen.property_display.add("payload/armament/MLW-bearing");
#screen.property_display.add("payload/armament/MLW-count");
#screen.property_display.add("payload/armament/MLW-launcher");
@ -1412,6 +1450,8 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0);
#screen.property_display.add("payload/armament/spike-air");
#screen.property_display.add("payload/armament/spike-gnd-20");
#screen.property_display.add("payload/armament/spike-gnd-02");
#screen.property_display.add("payload/armament/spike-gnd-05");
#screen.property_display.add("payload/armament/spike-gnd-06");
#screen.property_display.add("payload/armament/spike-gnd-11");
#screen.property_display.add("payload/armament/spike-gnd-23");
#screen.property_display.add("payload/armament/spike-gnd-p2");

View File

@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#io.include("Aircraft/ExpansionPack/Nasal/init.nas");
srand();# seed the random generator with systime
#with("updateloop");
# Number of iterations per second

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<filter>
<name>FBW Throttle</name>
<type>gain</type>
<gain>80.0</gain>
<input>
<property>/controls/engines/engine[0]/throttle</property>
</input>
<output>
<property>/carrier/fbw/target/groundspeed-kt</property>
</output>
</filter>
<filter>
<name>FBW Rudder</name>
<type>gain</type>
<gain>8.0</gain>
<input>
<property>/controls/flight/rudder</property>
</input>
<output>
<property>/surface-positions/rudder-pos-norm</property>
</output>
</filter>
</PropertyList>

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<!-- Simulate the groundspeed -->
<filter>
<name>FDM Groundspeed</name>
<type>noise-spike</type>
<input>
<property>/carrier/fbw/target/groundspeed-kt</property>
</input>
<output>
<property>/velocities/groundspeed-kt</property>
</output>
<!-- Reaching maximum speed takes 20 minutes -->
<max-rate-of-change>7</max-rate-of-change>
</filter>
<!-- Flags use true-heading-deg because only that property is available
in multiplayer.
-->
<filter>
<name>FDM True Heading For Flags</name>
<type>gain</type>
<input>
<property>/orientation/heading-deg</property>
</input>
<output>
<property>/orientation/true-heading-deg</property>
</output>
</filter>
<!-- ================================================================== -->
<!-- Roll -->
<!-- ================================================================== -->
<!--
<filter>
<name>FDM Rudder</name>
<type>noise-spike</type>
<input>
<property>/controls/flight/rudder</property>
</input>
<output>
<property>/surface-positions/rudder-pos-norm</property>
</output>
<max-rate-of-change>5</max-rate-of-change>
</filter>-->
</PropertyList>

View File

@ -27,8 +27,6 @@ var mlw_max=getprop("payload/d-config/mlw_max"); #
var auto_flare_caller = getprop("payload/d-config/auto_flare_caller"); # If damage.nas should detect flare releases, or if function is called from somewhere in aircraft
############################################################################################################################
var TRUE = 1;
var FALSE = 0;
var hp = hp_max;
setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD
@ -164,7 +162,9 @@ var warheads = {
"pilot": [93, 0.00,1,0],# ejected pilot
"BETAB-500ShP": [94, 1160.00,1,0],
"Flare": [95, 0.00,0,0],
"3M9": [96, 125.00,0,0],# 3M9 Missile used with 2K12/SA-6
"3M9": [96, 125.00,0,0],# 3M9M3 Missile used with 2K12/SA-6
"5V28V": [97, 478.00,0,0],# Missile used with S-200D/SA-5
"AIM-9X": [98, 20.80,0,0],
};
var AIR_RADAR = "air";
@ -189,7 +189,8 @@ var radar_signatures = {
"E-8R": AIR_RADAR,
"EC-137D": AIR_RADAR,
"Mig-28": AIR_RADAR,
"SA-6": AIR_RADAR,#Air radar tone chosen so that there is at least some lock tone until asset-specific is created
"SA-6": "gnd-06",#Air radar tone chosen so that there is at least some lock tone until asset-specific is created
"s-200": "gnd-05",
"ZSU-23-4M": "gnd-23",
"S-75": "gnd-02",
"buk-m2": "gnd-11",
@ -203,7 +204,7 @@ var radar_signatures = {
var id2warhead = [];
var launched = {};# callsign: elapsed-sec
var approached = {};# callsign: uniqueID
var heavy_smoke = [61,62,63,65,92,96];
var heavy_smoke = [61,62,63,65,92,96,97];
var k = keys(warheads);
@ -241,6 +242,10 @@ for(var myid = 0;myid<size(k);myid+=1) {
}
}
var crater_model0 = getprop("payload/armament/models") ~ "crater_small.xml";
var crater_model1 = getprop("payload/armament/models") ~ "crater_big.xml";
var crater_model2 = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml";
#==================================================================
# Notification processing
#==================================================================
@ -281,6 +286,7 @@ var DamageRecipient =
# " Flags=",notification.Flags,
# " Radar=",bits.test(notification.Flags, 0),
# " Thrust=",bits.test(notification.Flags, 1));
# " CWI=",bits.test(notification.Flags, 2));
#
# todo:
# animate missiles
@ -301,6 +307,7 @@ var DamageRecipient =
var bearing = ownPos.course_to(notification.Position);
var radarOn = bits.test(notification.Flags, 0);
var thrustOn = bits.test(notification.Flags, 1);
var CWIOn = bits.test(notification.Flags, 2);
var index = notification.SecondaryKind-21;
var typ = id2warhead[index];
@ -334,7 +341,7 @@ var DamageRecipient =
dynamics["noti_"~notification.Callsign~"_"~notification.UniqueIdentity] = [systime()-(time_before_delete-1.6), notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.u_fps, notification.Heading, notification.Pitch,-1]
}
if (tacview_supported and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") {
if (tacview_supported and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) {
if (tacview.starttime) {
var tacID = left(md5(notification.Callsign~notification.UniqueIdentity),6);
if (notification.Kind == DESTROY) {
@ -348,7 +355,7 @@ var DamageRecipient =
var extra2 = typ[2]==0?",Type=Weapon+Missile":",Type=Weapon+Bomb";
extra2 = typ[4]=="Flare"?",Type=Flare":extra2;
extra2 = typp=="Parachutist"?"":extra2;
var color = radarOn?",Color=Red":",Color=Yellow";
var color = radarOn or CWIOn?",Color=Red":",Color=Yellow";
thread.lock(tacview.mutexWrite);
tacview.write("#" ~ (systime() - tacview.starttime)~"\n");
tacview.write(tacID~",T="~notification.Position.lon()~"|"~notification.Position.lat()~"|"~notification.Position.alt()~extra~",Name="~typp~color~extra2~"\n");
@ -376,9 +383,10 @@ var DamageRecipient =
setprop("payload/armament/MLW-launcher", notification.Callsign);
setprop("payload/armament/MLW-count", getprop("payload/armament/MLW-count")+1);
var out = sprintf("Missile Launch Warning from %03d degrees.", bearing);
if (rwr_to_screen) screen.log.write(out, 1,1,0);# temporary till someone models a RWR in RIO seat
if (rwr_to_screen) screen.log.write(out, 1,0.5,0);# temporary till someone models a RWR in RIO seat
print(out);
damageLog.push(sprintf("Missile Launch Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (m28_auto) mig28.missileLaunch();
}
}
}
@ -386,19 +394,29 @@ var DamageRecipient =
# Missile approach warning:
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
var clock = geo.normdeg(bearing - heading);
setprop("payload/armament/MAW-bearing", bearing);
setprop("payload/armament/MAW-active", 1);# resets every 1 seconds
if (!radarOn and !CWIOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
#var heading = getprop("orientation/heading-deg");
#var clock = geo.normdeg(bearing - heading);
if (radarOn) {
setprop("payload/armament/MAW-bearing", bearing);
setprop("payload/armament/MAW-active", 1);# resets every 1 seconds
} elsif (CWIOn) {
setprop("payload/armament/MAW-semiactive", 1);# resets every 1 seconds
}
MAW_elapsed = elapsed;
var appr = approached[notification.Callsign~notification.UniqueIdentity];
if (appr == nil or elapsed - appr > 450) {
printf("Missile Approach Warning from %03d degrees.", bearing);
damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,1,0);# temporary till someone models a RWR in RIO seat
if (radarOn) {
#printf("Missile Approach Warning from %03d degrees.", bearing);
damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,0.5,0);# temporary till someone models a RWR in RIO seat
} else {
#printf("Missile Approach Warning");
damageLog.push(sprintf("Missile Approach Warning from %s.", notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning (semi-active)."), 1,0.5,0);# temporary till someone models a RWR in RIO seat
}
approached[notification.Callsign~notification.UniqueIdentity] = elapsed;
if (m28_auto) mig28.engagedBy(notification.Callsign);
if (m28_auto) mig28.engagedBy(notification.Callsign, 1);
}
return emesary.Transmitter.ReceiptStatus_OK;
}
@ -415,7 +433,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
if (tacview_supported and tacview.starttime and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") {
if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) {
var node = getCallsign(notification.RemoteCallsign);
if (node != nil and notification.SecondaryKind > 20) {
# its a warhead
@ -439,9 +457,10 @@ var DamageRecipient =
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
if (notification.SecondaryKind < 0 and hitable_by_cannon) {
# cannon hit
if (m28_auto) mig28.engagedBy(notification.Callsign, 0);
var probability = id2shell[-1*notification.SecondaryKind-1][1];
var typ = id2shell[-1*notification.SecondaryKind-1][2];
var hit_count = notification.Distance;
@ -457,6 +476,7 @@ var DamageRecipient =
}
} elsif (notification.SecondaryKind > 20) {
# its a warhead
if (m28_auto) mig28.engagedBy(notification.Callsign, 1);
var dist = notification.Distance;
var wh = id2warhead[notification.SecondaryKind - 21];
var type = wh[4];#test code
@ -549,21 +569,18 @@ var DamageRecipient =
}
if (notification.Kind == CREATE and getprop("payload/armament/enable-craters") == 1 and statics["obj_"~notification.UniqueIdentity] == nil) {
if (notification.SecondaryKind == 0) {# TODO: make a hash with all the models
var crater_model = getprop("payload/armament/models") ~ "crater_small.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model0, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
#static is a PropertyNode inside /models
}
} elsif (notification.SecondaryKind == 1) {
var crater_model = getprop("payload/armament/models") ~ "crater_big.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model1, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
}
} elsif (notification.SecondaryKind == 2) {
var crater_model = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model2, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
}
@ -863,6 +880,7 @@ var flare_update_time = 0.4;
var flare_duration = 8;
var flare_terminal_speed = 50;#m/s
var flares_max_process_per_loop = 4;
var flare_sequencer = -120;
var flare_sorter = func(a, b) {
if(a[0] < b[0]){
@ -945,7 +963,9 @@ var flare_released = func {
getprop("orientation/heading-deg"),
FT2M*getprop("velocities/speed-down-fps"),
FT2M*math.sqrt(getprop("velocities/speed-north-fps")*getprop("velocities/speed-north-fps")+getprop("velocities/speed-east-fps")*getprop("velocities/speed-east-fps")),
int(rand()*240)-120];
flare_sequencer];
flare_sequencer += 1;
if (flare_sequencer > 120) flare_sequencer = -120;
append(flare_list, flare);
var msg = notifications.ObjectInFlightNotification.new("ffly", flare[6], MOVE, 21+95);
msg.Flags = 0;
@ -1233,7 +1253,7 @@ var processCallsigns = func () {
var painted = 0;
var paint_list = [];
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) {
if(player.getChild("valid") != nil and player.getChild("valid").getValue() == 1 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;
var str6 = player.getNode("sim/multiplay/generic/string[6]");
@ -1247,6 +1267,7 @@ var processCallsigns = func () {
}
if (getprop("sim/time/elapsed-sec")-MAW_elapsed > 1.1) {
setprop("payload/armament/MAW-active", 0);# resets every 1.1 seconds without warning
setprop("payload/armament/MAW-semiactive", 0);
}
# spike handling:
@ -1293,16 +1314,16 @@ processCallsignsTimer.start();
var code_ct = func () {
#ANTIC
if (getprop("payload/armament/msg")) {
setprop("sim/rendering/redout/enabled", TRUE);
setprop("sim/rendering/redout/enabled", 1);
#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= []);
if (!m28_auto) 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 = []);
call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "instrument-failures"}))},nil,var err2 = []);
}
setprop("sim/freeze/fuel",0);
setprop("/sim/speed-up", 1);
if (!m28_auto) setprop("/sim/speed-up", 1);
setprop("/gui/map/draw-traffic", 0);
setprop("/sim/marker-pins/traffic", 0);
setprop("/sim/gui/dialogs/map-canvas/draw-TFC", 0);
@ -1317,7 +1338,7 @@ code_ctTimer.simulatedTime = 1;
setprop("/sim/failure-manager/display-on-screen", FALSE);
setprop("/sim/failure-manager/display-on-screen", 0);
code_ctTimer.start();
@ -1337,6 +1358,22 @@ var re_init = func (node) {
}
stopLaunch();
damageLog.push("Aircraft was repaired due to re-init.");
# Remove all 3D craters and re-place them. Due to re-init can remove some of them.
foreach (var thekey ; keys(statics)) {
var sta = statics[thekey];
if (sta[0] != nil) {
sta[0].remove();
if (sta[5] == 0) {# TODO: make a hash with all the models
sta[0] = geo.put_model(crater_model0, sta[1], sta[2], sta[3], sta[4]);
} elsif (sta[5] == 1) {
sta[0] = geo.put_model(crater_model1, sta[1], sta[2], sta[3], sta[4]);
} elsif (sta[5] == 2) {
sta[0] = geo.put_model(crater_model2, sta[1], sta[2], sta[3], sta[4]);
}
}
}
}
#==================================================================
@ -1405,6 +1442,7 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0);
#screen.property_display.add("payload/armament/MAW-bearing");
#screen.property_display.add("payload/armament/MAW-active");
#screen.property_display.add("payload/armament/MAW-semiactive");
#screen.property_display.add("payload/armament/MLW-bearing");
#screen.property_display.add("payload/armament/MLW-count");
#screen.property_display.add("payload/armament/MLW-launcher");
@ -1412,6 +1450,8 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0);
#screen.property_display.add("payload/armament/spike-air");
#screen.property_display.add("payload/armament/spike-gnd-20");
#screen.property_display.add("payload/armament/spike-gnd-02");
#screen.property_display.add("payload/armament/spike-gnd-05");
#screen.property_display.add("payload/armament/spike-gnd-06");
#screen.property_display.add("payload/armament/spike-gnd-11");
#screen.property_display.add("payload/armament/spike-gnd-23");
#screen.property_display.add("payload/armament/spike-gnd-p2");

View File

@ -1,6 +1,6 @@
# (c) 2018 pinto
# license: gplv2+
srand();# seed the random generator with systime
# v0.2b
# will only report the closest bad guy, does no threat assessment.
# todo:

View File

@ -15,9 +15,6 @@ if ((major == 2017 and minor == 2 and pica >= 1) or (major == 2017 and minor > 2
pickingMethod = 1;
}
var FALSE = 0;
var TRUE = 1;
var AIR = 0;
var MARINE = 1;
var SURFACE = 2;
@ -73,6 +70,9 @@ var Contact = {
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;
@ -84,27 +84,63 @@ var Contact = {
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;
valid = 0;
}
if (me.callsign.getValue() != me.orig_callsign) {
valid = FALSE;
valid = 0;
}
return valid;
},
isPainted: func () {
if (me.painted == nil) {
me.painted = me.node.getNode("painted");
if (getprop("/carrier/sunk") == 1) {
return 0;
}
if (me.painted == nil) {
return nil;
return isNotBehindTerrain(me.node)[0];
},
isCommandActive: func {
if (getprop("/carrier/sunk") == 1) {
return 0;
}
var p = me.painted.getValue();
return p;
return isNotBehindTerrain(me.node)[0];
},
getUnique: func () {
@ -124,6 +160,7 @@ var Contact = {
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;
@ -343,108 +380,48 @@ var Contact = {
};
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 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 isVisible = 0;
}
var aircraftPos = geo.Coord.new().set_latlon(lat, lon, alt*0.3048);
#################
if (pickingMethod == 1) {
var myPos = geo.aircraft_position();
myPos.set_latlon(myPos.lat(),myPos.lon(),myPos.alt()+50);
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()};
var myPos = geo.aircraft_position();
# Check for terrain between own aircraft and other:
v = get_cart_ground_intersection(xyz, dir);
if (v == nil) {
return 1;
#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) {
#printf("terrain found between SAM and aircraft %.1f meter away.", terrainDist);
return 0;
} else {
#print("The planes has clear view of each other");
return 1;
}
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 {
var isVisible = 0;
var MyCoord = geo.aircraft_position();
# Because there is no terrain on earth that can be between these 2
if(MyCoord.alt() < 8900 and aircraftPos.alt() < 8900)
{
# Temporary variable
# A (our plane) coord in meters
var a = MyCoord.x();
var b = MyCoord.y();
var c = MyCoord.z();
# B (target) coord in meters
var d = aircraftPos.x();
var e = aircraftPos.y();
var f = aircraftPos.z();
var difa = d - a;
var difb = e - b;
var difc = f - c;
# direct Distance in meters
var myDistance = math.sqrt( math.pow((d-a),2) + math.pow((e-b),2) + math.pow((f-c),2)); #calculating distance ourselves to avoid another call to geo.nas (read: speed, probably).
var Aprime = geo.Coord.new();
# Here is to limit FPS drop on very long distance
var L = 500;
if(myDistance > 50000)
{
L = myDistance / 15;
}
var step = L;
var maxLoops = int(myDistance / L);
isVisible = 1;
# This loop will make travel a point between us and the target and check if there is terrain
for(var i = 1 ; i <= maxLoops ; i += 1)
{
#calculate intermediate step
#basically dividing the line into maxLoops number of steps, and checking at each step
#to ascii-art explain it:
# |us|----------|step 1|-----------|step 2|--------|step 3|----------|them|
#there will be as many steps as there is i
#every step will be equidistant
#also, if i == 0 then the first step will be our plane
var x = ((difa/(maxLoops+1))*i)+a;
var y = ((difb/(maxLoops+1))*i)+b;
var z = ((difc/(maxLoops+1))*i)+c;
#print("i:" ~ i ~ "|x,y,z | " ~ x ~ "," ~ y ~ "," ~ z);
Aprime.set_xyz(x,y,z);
var AprimeTerrainAlt = geo.elevation(Aprime.lat(), Aprime.lon());
if(AprimeTerrainAlt == nil)
{
AprimeTerrainAlt = 0;
}
if(AprimeTerrainAlt > Aprime.alt())
{
#print("behind terrain");
return 0;
}
}
}
else
{
isVisible = 1;
}
return isVisible;
#print("The planes has clear view of each other");
return [1,1]; # visible and in front of terrain
}
}
}

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<filter>
<name>FBW Throttle</name>
<type>gain</type>
<gain>80.0</gain>
<input>
<property>/controls/engines/engine[0]/throttle</property>
</input>
<output>
<property>/carrier/fbw/target/groundspeed-kt</property>
</output>
</filter>
<filter>
<name>FBW Rudder</name>
<type>gain</type>
<gain>8.0</gain>
<input>
<property>/controls/flight/rudder</property>
</input>
<output>
<property>/surface-positions/rudder-pos-norm</property>
</output>
</filter>
</PropertyList>

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<!-- Simulate the groundspeed -->
<filter>
<name>FDM Groundspeed</name>
<type>noise-spike</type>
<input>
<property>/carrier/fbw/target/groundspeed-kt</property>
</input>
<output>
<property>/velocities/groundspeed-kt</property>
</output>
<!-- Reaching maximum speed takes 20 minutes -->
<max-rate-of-change>7</max-rate-of-change>
</filter>
<!-- Flags use true-heading-deg because only that property is available
in multiplayer.
-->
<filter>
<name>FDM True Heading For Flags</name>
<type>gain</type>
<input>
<property>/orientation/heading-deg</property>
</input>
<output>
<property>/orientation/true-heading-deg</property>
</output>
</filter>
<!-- ================================================================== -->
<!-- Roll -->
<!-- ================================================================== -->
<!--
<filter>
<name>FDM Rudder</name>
<type>noise-spike</type>
<input>
<property>/controls/flight/rudder</property>
</input>
<output>
<property>/surface-positions/rudder-pos-norm</property>
</output>
<max-rate-of-change>5</max-rate-of-change>
</filter>-->
</PropertyList>

View File

@ -1,330 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<name>control-panel</name>
<layout>vbox</layout>
<width>250</width>
<resizable>false</resizable>
<group>
<layout>hbox</layout>
<empty><stretch>true</stretch></empty>
<text>
<label>Control Panel</label>
</text>
<empty><stretch>true</stretch></empty>
<button>
<legend/>
<keynum>27</keynum>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<padding>6</padding>
<text>
<label>Elevators</label>
</text>
<group>
<layout>table</layout>
<!-- 3rd -->
<text>
<row>0</row>
<col>1</col>
<label>3rd</label>
</text>
<!-- 3rd -->
<button>
<row>1</row>
<col>1</col>
<visible>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</binding>
</button>
<button>
<row>1</row>
<col>1</col>
<visible>
<not>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[2]/at-flight-deck</property>
</binding>
</button>
<!-- 2nd -->
<text>
<row>2</row>
<col>1</col>
<label>2nd</label>
</text>
<!-- 2nd -->
<button>
<row>3</row>
<col>1</col>
<visible>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</binding>
</button>
<button>
<row>3</row>
<col>1</col>
<visible>
<not>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[1]/at-flight-deck</property>
</binding>
</button>
<!-- 4th -->
<text>
<row>4</row>
<col>0</col>
<label>4th</label>
</text>
<!-- 1st -->
<text>
<row>4</row>
<col>1</col>
<label>1st</label>
</text>
<!-- 4th -->
<button>
<row>5</row>
<col>0</col>
<visible>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</binding>
</button>
<button>
<row>5</row>
<col>0</col>
<visible>
<not>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[3]/at-flight-deck</property>
</binding>
</button>
<!-- 1st -->
<button>
<row>5</row>
<col>1</col>
<visible>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</visible>
<legend>FLIGHT DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</binding>
</button>
<button>
<row>5</row>
<col>1</col>
<visible>
<not>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</not>
</visible>
<legend>HANGAR DECK</legend>
<pref-width>100</pref-width>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
<property>/carrier/elevators/elevator[0]/at-flight-deck</property>
</binding>
</button>
</group>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<padding>6</padding>
<text>
<label>Flight Deck</label>
</text>
<group>
<layout>vbox</layout>
<checkbox>
<halign>left</halign>
<label>Runway lighting</label>
<property>/controls/lighting/deck-lights</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Antennas</label>
<property>/carrier/antennas/enabled</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
</group>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<padding>6</padding>
<text>
<label>Debug</label>
</text>
<group>
<layout>vbox</layout>
<checkbox>
<halign>left</halign>
<label>Enable ship movememnt</label>
<property>/carrier/fdm/settings/movement</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
<checkbox>
<halign>left</halign>
<label>Show Phalanx aim points</label>
<property>/carrier/phalanx/settings/show-debug-aim</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
</group>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<default-padding>6</default-padding>
<empty><stretch>true</stretch></empty>
<button>
<legend>Close</legend>
<default>true</default>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</PropertyList>

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<default>
<menu n="10">
<label>CVN-70</label>
<enabled type="bool">true</enabled>
<item>
<label>Control Panel</label>
<binding>
<command>dialog-show</command>
<dialog-name>control-panel</dialog-name>
</binding>
</item>
</menu>
</default>
</PropertyList>

View File

@ -27,8 +27,6 @@ var mlw_max=getprop("payload/d-config/mlw_max"); #
var auto_flare_caller = getprop("payload/d-config/auto_flare_caller"); # If damage.nas should detect flare releases, or if function is called from somewhere in aircraft
############################################################################################################################
var TRUE = 1;
var FALSE = 0;
var hp = hp_max;
setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD
@ -164,7 +162,9 @@ var warheads = {
"pilot": [93, 0.00,1,0],# ejected pilot
"BETAB-500ShP": [94, 1160.00,1,0],
"Flare": [95, 0.00,0,0],
"3M9": [96, 125.00,0,0],# 3M9 Missile used with 2K12/SA-6
"3M9": [96, 125.00,0,0],# 3M9M3 Missile used with 2K12/SA-6
"5V28V": [97, 478.00,0,0],# Missile used with S-200D/SA-5
"AIM-9X": [98, 20.80,0,0],
};
var AIR_RADAR = "air";
@ -189,7 +189,8 @@ var radar_signatures = {
"E-8R": AIR_RADAR,
"EC-137D": AIR_RADAR,
"Mig-28": AIR_RADAR,
"SA-6": AIR_RADAR,#Air radar tone chosen so that there is at least some lock tone until asset-specific is created
"SA-6": "gnd-06",#Air radar tone chosen so that there is at least some lock tone until asset-specific is created
"s-200": "gnd-05",
"ZSU-23-4M": "gnd-23",
"S-75": "gnd-02",
"buk-m2": "gnd-11",
@ -203,7 +204,7 @@ var radar_signatures = {
var id2warhead = [];
var launched = {};# callsign: elapsed-sec
var approached = {};# callsign: uniqueID
var heavy_smoke = [61,62,63,65,92,96];
var heavy_smoke = [61,62,63,65,92,96,97];
var k = keys(warheads);
@ -241,6 +242,10 @@ for(var myid = 0;myid<size(k);myid+=1) {
}
}
var crater_model0 = getprop("payload/armament/models") ~ "crater_small.xml";
var crater_model1 = getprop("payload/armament/models") ~ "crater_big.xml";
var crater_model2 = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml";
#==================================================================
# Notification processing
#==================================================================
@ -281,6 +286,7 @@ var DamageRecipient =
# " Flags=",notification.Flags,
# " Radar=",bits.test(notification.Flags, 0),
# " Thrust=",bits.test(notification.Flags, 1));
# " CWI=",bits.test(notification.Flags, 2));
#
# todo:
# animate missiles
@ -301,6 +307,7 @@ var DamageRecipient =
var bearing = ownPos.course_to(notification.Position);
var radarOn = bits.test(notification.Flags, 0);
var thrustOn = bits.test(notification.Flags, 1);
var CWIOn = bits.test(notification.Flags, 2);
var index = notification.SecondaryKind-21;
var typ = id2warhead[index];
@ -334,7 +341,7 @@ var DamageRecipient =
dynamics["noti_"~notification.Callsign~"_"~notification.UniqueIdentity] = [systime()-(time_before_delete-1.6), notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.u_fps, notification.Heading, notification.Pitch,-1]
}
if (tacview_supported and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") {
if (tacview_supported and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) {
if (tacview.starttime) {
var tacID = left(md5(notification.Callsign~notification.UniqueIdentity),6);
if (notification.Kind == DESTROY) {
@ -348,7 +355,7 @@ var DamageRecipient =
var extra2 = typ[2]==0?",Type=Weapon+Missile":",Type=Weapon+Bomb";
extra2 = typ[4]=="Flare"?",Type=Flare":extra2;
extra2 = typp=="Parachutist"?"":extra2;
var color = radarOn?",Color=Red":",Color=Yellow";
var color = radarOn or CWIOn?",Color=Red":",Color=Yellow";
thread.lock(tacview.mutexWrite);
tacview.write("#" ~ (systime() - tacview.starttime)~"\n");
tacview.write(tacID~",T="~notification.Position.lon()~"|"~notification.Position.lat()~"|"~notification.Position.alt()~extra~",Name="~typp~color~extra2~"\n");
@ -376,9 +383,10 @@ var DamageRecipient =
setprop("payload/armament/MLW-launcher", notification.Callsign);
setprop("payload/armament/MLW-count", getprop("payload/armament/MLW-count")+1);
var out = sprintf("Missile Launch Warning from %03d degrees.", bearing);
if (rwr_to_screen) screen.log.write(out, 1,1,0);# temporary till someone models a RWR in RIO seat
if (rwr_to_screen) screen.log.write(out, 1,0.5,0);# temporary till someone models a RWR in RIO seat
print(out);
damageLog.push(sprintf("Missile Launch Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (m28_auto) mig28.missileLaunch();
}
}
}
@ -386,19 +394,29 @@ var DamageRecipient =
# Missile approach warning:
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
var clock = geo.normdeg(bearing - heading);
setprop("payload/armament/MAW-bearing", bearing);
setprop("payload/armament/MAW-active", 1);# resets every 1 seconds
if (!radarOn and !CWIOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
#var heading = getprop("orientation/heading-deg");
#var clock = geo.normdeg(bearing - heading);
if (radarOn) {
setprop("payload/armament/MAW-bearing", bearing);
setprop("payload/armament/MAW-active", 1);# resets every 1 seconds
} elsif (CWIOn) {
setprop("payload/armament/MAW-semiactive", 1);# resets every 1 seconds
}
MAW_elapsed = elapsed;
var appr = approached[notification.Callsign~notification.UniqueIdentity];
if (appr == nil or elapsed - appr > 450) {
printf("Missile Approach Warning from %03d degrees.", bearing);
damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,1,0);# temporary till someone models a RWR in RIO seat
if (radarOn) {
#printf("Missile Approach Warning from %03d degrees.", bearing);
damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,0.5,0);# temporary till someone models a RWR in RIO seat
} else {
#printf("Missile Approach Warning");
damageLog.push(sprintf("Missile Approach Warning from %s.", notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning (semi-active)."), 1,0.5,0);# temporary till someone models a RWR in RIO seat
}
approached[notification.Callsign~notification.UniqueIdentity] = elapsed;
if (m28_auto) mig28.engagedBy(notification.Callsign);
if (m28_auto) mig28.engagedBy(notification.Callsign, 1);
}
return emesary.Transmitter.ReceiptStatus_OK;
}
@ -415,7 +433,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
if (tacview_supported and tacview.starttime and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") {
if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) {
var node = getCallsign(notification.RemoteCallsign);
if (node != nil and notification.SecondaryKind > 20) {
# its a warhead
@ -439,9 +457,10 @@ var DamageRecipient =
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
if (notification.SecondaryKind < 0 and hitable_by_cannon) {
# cannon hit
if (m28_auto) mig28.engagedBy(notification.Callsign, 0);
var probability = id2shell[-1*notification.SecondaryKind-1][1];
var typ = id2shell[-1*notification.SecondaryKind-1][2];
var hit_count = notification.Distance;
@ -457,6 +476,7 @@ var DamageRecipient =
}
} elsif (notification.SecondaryKind > 20) {
# its a warhead
if (m28_auto) mig28.engagedBy(notification.Callsign, 1);
var dist = notification.Distance;
var wh = id2warhead[notification.SecondaryKind - 21];
var type = wh[4];#test code
@ -549,21 +569,18 @@ var DamageRecipient =
}
if (notification.Kind == CREATE and getprop("payload/armament/enable-craters") == 1 and statics["obj_"~notification.UniqueIdentity] == nil) {
if (notification.SecondaryKind == 0) {# TODO: make a hash with all the models
var crater_model = getprop("payload/armament/models") ~ "crater_small.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model0, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
#static is a PropertyNode inside /models
}
} elsif (notification.SecondaryKind == 1) {
var crater_model = getprop("payload/armament/models") ~ "crater_big.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model1, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
}
} elsif (notification.SecondaryKind == 2) {
var crater_model = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml";
var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
var static = geo.put_model(crater_model2, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading);
if (static != nil) {
statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind];
}
@ -863,6 +880,7 @@ var flare_update_time = 0.4;
var flare_duration = 8;
var flare_terminal_speed = 50;#m/s
var flares_max_process_per_loop = 4;
var flare_sequencer = -120;
var flare_sorter = func(a, b) {
if(a[0] < b[0]){
@ -945,7 +963,9 @@ var flare_released = func {
getprop("orientation/heading-deg"),
FT2M*getprop("velocities/speed-down-fps"),
FT2M*math.sqrt(getprop("velocities/speed-north-fps")*getprop("velocities/speed-north-fps")+getprop("velocities/speed-east-fps")*getprop("velocities/speed-east-fps")),
int(rand()*240)-120];
flare_sequencer];
flare_sequencer += 1;
if (flare_sequencer > 120) flare_sequencer = -120;
append(flare_list, flare);
var msg = notifications.ObjectInFlightNotification.new("ffly", flare[6], MOVE, 21+95);
msg.Flags = 0;
@ -1233,7 +1253,7 @@ var processCallsigns = func () {
var painted = 0;
var paint_list = [];
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) {
if(player.getChild("valid") != nil and player.getChild("valid").getValue() == 1 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;
var str6 = player.getNode("sim/multiplay/generic/string[6]");
@ -1247,6 +1267,7 @@ var processCallsigns = func () {
}
if (getprop("sim/time/elapsed-sec")-MAW_elapsed > 1.1) {
setprop("payload/armament/MAW-active", 0);# resets every 1.1 seconds without warning
setprop("payload/armament/MAW-semiactive", 0);
}
# spike handling:
@ -1293,16 +1314,16 @@ processCallsignsTimer.start();
var code_ct = func () {
#ANTIC
if (getprop("payload/armament/msg")) {
setprop("sim/rendering/redout/enabled", TRUE);
setprop("sim/rendering/redout/enabled", 1);
#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= []);
if (!m28_auto) 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 = []);
call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "instrument-failures"}))},nil,var err2 = []);
}
setprop("sim/freeze/fuel",0);
setprop("/sim/speed-up", 1);
if (!m28_auto) setprop("/sim/speed-up", 1);
setprop("/gui/map/draw-traffic", 0);
setprop("/sim/marker-pins/traffic", 0);
setprop("/sim/gui/dialogs/map-canvas/draw-TFC", 0);
@ -1317,7 +1338,7 @@ code_ctTimer.simulatedTime = 1;
setprop("/sim/failure-manager/display-on-screen", FALSE);
setprop("/sim/failure-manager/display-on-screen", 0);
code_ctTimer.start();
@ -1337,6 +1358,22 @@ var re_init = func (node) {
}
stopLaunch();
damageLog.push("Aircraft was repaired due to re-init.");
# Remove all 3D craters and re-place them. Due to re-init can remove some of them.
foreach (var thekey ; keys(statics)) {
var sta = statics[thekey];
if (sta[0] != nil) {
sta[0].remove();
if (sta[5] == 0) {# TODO: make a hash with all the models
sta[0] = geo.put_model(crater_model0, sta[1], sta[2], sta[3], sta[4]);
} elsif (sta[5] == 1) {
sta[0] = geo.put_model(crater_model1, sta[1], sta[2], sta[3], sta[4]);
} elsif (sta[5] == 2) {
sta[0] = geo.put_model(crater_model2, sta[1], sta[2], sta[3], sta[4]);
}
}
}
}
#==================================================================
@ -1405,6 +1442,7 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0);
#screen.property_display.add("payload/armament/MAW-bearing");
#screen.property_display.add("payload/armament/MAW-active");
#screen.property_display.add("payload/armament/MAW-semiactive");
#screen.property_display.add("payload/armament/MLW-bearing");
#screen.property_display.add("payload/armament/MLW-count");
#screen.property_display.add("payload/armament/MLW-launcher");
@ -1412,6 +1450,8 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0);
#screen.property_display.add("payload/armament/spike-air");
#screen.property_display.add("payload/armament/spike-gnd-20");
#screen.property_display.add("payload/armament/spike-gnd-02");
#screen.property_display.add("payload/armament/spike-gnd-05");
#screen.property_display.add("payload/armament/spike-gnd-06");
#screen.property_display.add("payload/armament/spike-gnd-11");
#screen.property_display.add("payload/armament/spike-gnd-23");
#screen.property_display.add("payload/armament/spike-gnd-p2");

View File

@ -1,16 +0,0 @@
# 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/>.
var control_panel = gui.Dialog.new("sim/gui/dialogs/control-panel/dialog", "Aircraft/CVN-70/Dialogs/control-panel.xml");

View File

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
srand();# seed the random generator with systime
#io.include("Aircraft/ExpansionPack/Nasal/init.nas");
#with("updateloop");

View File

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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 2 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/>.
-->
<PropertyList>
<mouse n="0">
<mode n="0">
<button n="3">
<binding n="0">
<script></script>
</binding>
<binding n="1">
<condition>
<property>/sim/current-view/can-change-z-offset</property>
</condition>
<command>nasal</command>
<script>
var distance = getprop("/sim/current-view/z-offset-m");
var multiple = getprop("/sim/current-view/z-offset-inc-step");
var min_dist = getprop("/sim/current-view/z-offset-min-m");
# Round distance to a multiple of the step
distance = math.round(std.min(-min_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meter", abs(getprop("/sim/current-view/z-offset-m"))));
</script>
</binding>
</button>
<button n="4">
<binding n="0">
<script></script>
</binding>
<binding n="1">
<condition>
<property>/sim/current-view/can-change-z-offset</property>
</condition>
<command>nasal</command>
<script>
var distance = getprop("/sim/current-view/z-offset-m");
var multiple = getprop("/sim/current-view/z-offset-dec-step");
var max_dist = getprop("/sim/current-view/z-offset-max-m");
# Round distance to a multiple of the step
distance = math.round(std.max(-max_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meter", abs(getprop("/sim/current-view/z-offset-m"))));
</script>
</binding>
</button>
</mode>
</mouse>
</PropertyList>

View File

@ -1,280 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2008 Alex (D-HUND)
Copyright (C) 2009 Vivian Meazza
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 2 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/>.
-->
<PropertyList>
<current-view>
<view-number type="int">1</view-number>
</current-view>
<chase-distance-m type="double">-200.0</chase-distance-m>
<view n="0">
<name>Cockpit View</name>
<enabled type="bool">false</enabled>
</view>
<view n="1">
<name>Helicopter View</name>
<config>
<pitch-offset-deg>-5</pitch-offset-deg>
<target-y-offset-m type="double">21.925</target-y-offset-m>
</config>
</view>
<view n="2">
<name>Chase View</name>
<enabled type="bool">false</enabled>
</view>
<view n="5">
<name>Chase View Without Yaw</name>
<enabled type="bool">false</enabled>
</view>
<view n="100">
<name>Hangar 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>2</x-offset-m><!-- right -->
<y-offset-m>15</y-offset-m><!-- up -->
<z-offset-m>113</z-offset-m><!-- back -->
<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="101">
<name>Phalanx Forward Left</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>
<x-offset-m>-21.1147</x-offset-m><!-- right -->
<y-offset-m>16.8345</y-offset-m><!-- up -->
<z-offset-m>-121.2666</z-offset-m><!-- back -->
<heading-offset-deg>90</heading-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="102">
<name>Phalanx Forward Right</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>
<x-offset-m>23.1336</x-offset-m><!-- right -->
<y-offset-m>16.6478</y-offset-m><!-- up -->
<z-offset-m>-112.684</z-offset-m><!-- back -->
<heading-offset-deg>90</heading-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="103">
<name>Phalanx Aft</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>
<x-offset-m>23.3165</x-offset-m><!-- right -->
<y-offset-m>18.1198</y-offset-m><!-- up -->
<z-offset-m>134.344</z-offset-m><!-- back -->
<heading-offset-deg>90</heading-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="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>
<internal type="bool">false</internal>
<config>
<from-model type="bool">true</from-model>
<from-model-idx type="int">0</from-model-idx>
<x-offset-m>10</x-offset-m><!-- right -->
<y-offset-m>21.925</y-offset-m><!-- up -->
<z-offset-m>42</z-offset-m><!-- back -->
<heading-offset-deg>163</heading-offset-deg>
<pitch-offset-deg>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="107">
<name>Flight Deck Forward 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>
<x-offset-m>0</x-offset-m><!-- right -->
<y-offset-m>21.925</y-offset-m><!-- up -->
<z-offset-m>-35</z-offset-m><!-- back -->
<heading-offset-deg>180</heading-offset-deg>
<pitch-offset-deg>10</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="108">
<name>Bubble 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>4.1</x-offset-m><!-- right -->
<y-offset-m>20.325</y-offset-m><!-- up -->
<z-offset-m>-93</z-offset-m><!-- back -->
<heading-offset-deg>180</heading-offset-deg>
<pitch-offset-deg>0</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="109">
<name>Goofers' 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>
<x-offset-m>27.074</x-offset-m><!-- right -->
<y-offset-m>35.3325</y-offset-m><!-- up -->
<z-offset-m>42.67</z-offset-m><!-- back -->
<heading-offset-deg>136</heading-offset-deg>
<pitch-offset-deg>-11</pitch-offset-deg>
<default-field-of-view-deg>40</default-field-of-view-deg>
<ground-level-nearplane-m type="double">0.1f</ground-level-nearplane-m>
</config>
</view>
<view n="110">
<name>Primary Flight Control 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>23.2669</x-offset-m><!-- right -->
<y-offset-m>35.082</y-offset-m><!-- up -->
<z-offset-m>20.1064</z-offset-m><!-- back -->
<pitch-offset-deg>-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="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

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<filter>
<name>FBW Throttle</name>
<type>gain</type>
<gain>80.0</gain>
<input>
<property>/controls/engines/engine[0]/throttle</property>
</input>
<output>
<property>/carrier/fbw/target/groundspeed-kt</property>
</output>
</filter>
<filter>
<name>FBW Rudder</name>
<type>gain</type>
<gain>8.0</gain>
<input>
<property>/controls/flight/rudder</property>
</input>
<output>
<property>/surface-positions/rudder-pos-norm</property>
</output>
</filter>
</PropertyList>

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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/>.
-->
<PropertyList>
<!-- Simulate the groundspeed -->
<filter>
<name>FDM Groundspeed</name>
<type>noise-spike</type>
<input>
<property>/carrier/fbw/target/groundspeed-kt</property>
</input>
<output>
<property>/velocities/groundspeed-kt</property>
</output>
<!-- Reaching maximum speed takes 20 minutes -->
<max-rate-of-change>7</max-rate-of-change>
</filter>
<!-- Flags use true-heading-deg because only that property is available
in multiplayer.
-->
<filter>
<name>FDM True Heading For Flags</name>
<type>gain</type>
<input>
<property>/orientation/heading-deg</property>
</input>
<output>
<property>/orientation/true-heading-deg</property>
</output>
</filter>
<!-- ================================================================== -->
<!-- Roll -->
<!-- ================================================================== -->
<!--
<filter>
<name>FDM Rudder</name>
<type>noise-spike</type>
<input>
<property>/controls/flight/rudder</property>
</input>
<output>
<property>/surface-positions/rudder-pos-norm</property>
</output>
<max-rate-of-change>5</max-rate-of-change>
</filter>-->
</PropertyList>