This commit is contained in:
merspieler 2018-10-14 13:08:36 +02:00
commit 4f8c0c2cbd
10 changed files with 136 additions and 234 deletions

View file

@ -160,9 +160,6 @@
<path>Aircraft/IDG-A32X/Systems/pfd.xml</path>
</autopilot>
<!-- 10 is sound -->
<autopilot n="11">
<path>Aircraft/IDG-A32X/Systems/zoom-views.xml</path>
</autopilot>
</systems>
<sounde>
@ -412,10 +409,6 @@
<gui n="0" include="Systems/it-gui.xml"/>
<current-view>
<z-offset-dec-step type="double">0.0</z-offset-dec-step>
<z-offset-inc-step type="double">0.0</z-offset-inc-step>
<can-change-z-offset type="bool">false</can-change-z-offset>
<z-offset-default type="float">80.0</z-offset-default>
<z-offset-min-m type="float">30.0</z-offset-min-m>
<z-offset-max-m type="float">300.0</z-offset-max-m>
@ -1044,20 +1037,7 @@
</and>
</condition>
<command>nasal</command>
<script>
if (getprop("/sim/current-view/can-change-z-offset")) {
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");
distance = math.round(std.min(-min_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meters", abs(distance)));
} else {
view.decrease();
}
</script>
<script>libraries.fovZoom(-1);</script>
</binding>
</button>
<button n="4">
@ -1072,20 +1052,7 @@
</and>
</condition>
<command>nasal</command>
<script>
if (getprop("/sim/current-view/can-change-z-offset")) {
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");
distance = math.round(std.max(-max_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meters", abs(distance)));
} else {
view.increase();
}
</script>
<script>libraries.fovZoom(1);</script>
</binding>
</button>
</mode>
@ -1119,15 +1086,7 @@
<desc>Reset zoom to default</desc>
<binding>
<command>nasal</command>
<script>
if (getprop("/sim/current-view/can-change-z-offset")) {
setprop("/sim/current-view/z-offset-m", getprop("/sim/current-view/z-offset-default") * -1);
gui.popupTip(sprintf("%d meters", getprop("/sim/current-view/z-offset-default")));
} else {
setprop("/sim/current-view/field-of-view", getprop("/sim/view/config/default-field-of-view-deg"));
}
</script>
<script>libraries.fovZoom(0);</script>
</binding>
</key>
<key n="33">
@ -1373,21 +1332,8 @@
<desc>Increase field of view</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>
if (getprop("/sim/current-view/can-change-z-offset")) {
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");
distance = math.round(std.max(-max_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meters", abs(distance)));
} else {
view.increase();
}
</script>
<command>nasal</command>
<script>libraries.fovZoom(1);</script>
</binding>
</key>
<key n="120">
@ -1396,20 +1342,7 @@
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>
if (getprop("/sim/current-view/can-change-z-offset")) {
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");
distance = math.round(std.min(-min_dist, distance + multiple) / multiple) * multiple;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meters", abs(distance)));
} else {
view.decrease();
}
</script>
<script>libraries.fovZoom(-1);</script>
</binding>
</key>
<key n="127">
@ -1538,6 +1471,7 @@
<file>Aircraft/IDG-A32X/Nasal/ECAM.nas</file>
<file>Aircraft/IDG-A32X/Nasal/shake.nas</file>
<file>Aircraft/IDG-A32X/Nasal/light-manager.nas</file>
<file>Aircraft/IDG-A32X/Nasal/zoom-views.nas</file>
</libraries>
<acconfig>
<file>Aircraft/IDG-A32X/AircraftConfig/acconfig.nas</file>

View file

@ -346,10 +346,10 @@
<!-- Nasal code -->
<nasal>
<load>
var livery_update = aircraft.livery_update.new("Aircraft/IDG-A32X/Models/Liveries/A320/CFM-100");
var livery_update = aircraft.livery_update.new("Aircraft/IDG-A32X/Models/Liveries/A320/CFM-100");
</load>
<unload>
livery_update.stop();
livery_update.stop();
</unload>
</nasal>

View file

@ -376,10 +376,10 @@
<!-- Nasal code -->
<nasal>
<load>
var livery_update = aircraft.livery_update.new("Aircraft/IDG-A32X/Models/Liveries/A320/CFM");
var livery_update = aircraft.livery_update.new("Aircraft/IDG-A32X/Models/Liveries/A320/CFM");
</load>
<unload>
livery_update.stop();
livery_update.stop();
</unload>
</nasal>

View file

@ -375,10 +375,10 @@
<!-- Nasal code -->
<nasal>
<load>
var livery_update = aircraft.livery_update.new("Aircraft/IDG-A32X/Models/Liveries/A320/IAE");
var livery_update = aircraft.livery_update.new("Aircraft/IDG-A32X/Models/Liveries/A320/IAE");
</load>
<unload>
livery_update.stop();
livery_update.stop();
</unload>
</nasal>

View file

@ -355,10 +355,10 @@
<!-- Nasal code -->
<nasal>
<load>
var livery_update = aircraft.livery_update.new("Aircraft/IDG-A32X/Models/Liveries/A320/CFM-NEO");
var livery_update = aircraft.livery_update.new("Aircraft/IDG-A32X/Models/Liveries/A320/CFM-NEO");
</load>
<unload>
livery_update.stop();
livery_update.stop();
</unload>
</nasal>

View file

@ -353,7 +353,7 @@
<!-- Engines -->
<object-name>NacellePW1100G</object-name>
<object-name>ReverserPW1100G</object-name>
<!-- Fuselage -->
<!-- Engines -->
<property-base>sim/model/eng</property-base>
<texture-prop>texture</texture-prop>
<texture>PW_PurePower_1100G.png</texture>
@ -362,10 +362,10 @@
<!-- Nasal code -->
<nasal>
<load>
var livery_update = aircraft.livery_update.new("Aircraft/IDG-A32X/Models/Liveries/A320/PW-NEO");
var livery_update = aircraft.livery_update.new("Aircraft/IDG-A32X/Models/Liveries/A320/PW-NEO");
</load>
<unload>
livery_update.stop();
livery_update.stop();
</unload>
</nasal>

62
Nasal/zoom-views.nas Normal file
View file

@ -0,0 +1,62 @@
# IDG Distance Zooming
# Copyright (c) 2018 Joshua Davidson (it0uchpods)
# Based on PropertyRule file by onox
var distance = 0;
var min_dist = 0;
var max_dist = 0;
var canChangeZOffset = 0;
var decStep = -5;
var incStep = 5;
var viewName = "XX";
var fovZoom = func(d) {
viewName = getprop("/sim/current-view/name");
canChangeZOffset = getprop("/sim/current-view/type") == "lookat" and viewName != "Tower View" and viewName != "Fly-By View" and viewName != "Chase View" and viewName != "Chase View Without Yaw" and viewName != "Walk View";
if (getprop("/sim/current-view/z-offset-m") <= -50) {
decStep = -10;
} else {
decStep = -5;
}
if (getprop("/sim/current-view/z-offset-m") < -50) { # Not a typo, the conditions are different
incStep = 10;
} else {
incStep = 5;
}
if (d == -1) {
if (canChangeZOffset) {
distance = getprop("/sim/current-view/z-offset-m");
min_dist = getprop("/sim/current-view/z-offset-min-m");
distance = math.round(std.min(-min_dist, distance + incStep) / incStep, 0.1) * incStep;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meters", abs(distance)));
} else {
view.decrease();
}
} else if (d == 1) {
if (canChangeZOffset) {
distance = getprop("/sim/current-view/z-offset-m");
max_dist = getprop("/sim/current-view/z-offset-max-m");
distance = math.round(std.max(-max_dist, distance + decStep) / decStep, 0.1) * decStep;
setprop("/sim/current-view/z-offset-m", distance);
gui.popupTip(sprintf("%d meters", abs(distance)));
} else {
view.increase();
}
} else if (d == 0) {
if (canChangeZOffset) {
setprop("/sim/current-view/z-offset-m", getprop("/sim/current-view/z-offset-default") * -1);
gui.popupTip(sprintf("%d meters", getprop("/sim/current-view/z-offset-default")));
} else {
setprop("/sim/current-view/field-of-view", getprop("/sim/view/config/default-field-of-view-deg"));
gui.popupTip(sprintf("FOV: %.1f", getprop("/sim/current-view/field-of-view")))
}
}
}

View file

@ -6,117 +6,107 @@
##############################################
-->
<!-- A3XX FLight Recorder -->
<!-- A3XX Flight Recorder -->
<PropertyList>
<replay-config type="int">0</replay-config>
<config n="0">
<name>A3XX Flight Recorder</name>
<!-- Include Generic Stuff -->
<signals include="/Aircraft/Generic/flightrecorder/components/position.xml" />
<signals include="/Aircraft/Generic/flightrecorder/components/controls.xml" />
<signals include="/Aircraft/Generic/flightrecorder/components/surfaces.xml"/>
<signals include="/Aircraft/Generic/flightrecorder/components/engine-jet.xml">
<count type="int">2</count>
</signals>
<signals include="/Aircraft/Generic/flightrecorder/components/gear-retractable.xml">
<count type="int">3</count>
</signals>
<signals include="/Aircraft/Generic/flightrecorder/components/tanks.xml">
<count type="int">7</count>
</signals>
<signals> <!-- Now Custom Stuff -->
<signal>
<type>double</type>
<property>gear/gear[0]/compression-ft</property>
</signal>
<signal>
<type>double</type>
<property>gear/gear[1]/compression-ft</property>
</signal>
<signal>
<type>double</type>
<property>gear/gear[2]/compression-ft</property>
</signal>
<signal>
<type>double</type>
<property>velocities/groundspeed-kt</property>
</signal>
<signal>
<type>double</type>
<property>position/gear-agl-ft</property>
</signal>
<signal>
<type>double</type>
<property>engines/engine[0]/reverser-pos-norm</property>
</signal>
<signal>
<type>double</type>
<property>engines/engine[1]/reverser-pos-norm</property>
</signal>
<replay-config type="int">0</replay-config>
<config n="0">
<name>A3XX Flight Recorder</name>
<!-- Include Generic Stuff -->
<signals include="/Aircraft/Generic/flightrecorder/components/position.xml" />
<signals include="/Aircraft/Generic/flightrecorder/components/controls.xml" />
<signals include="/Aircraft/Generic/flightrecorder/components/surfaces.xml"/>
<signals include="/Aircraft/Generic/flightrecorder/components/engine-jet.xml">
<count type="int">2</count>
</signals>
<signals include="/Aircraft/Generic/flightrecorder/components/gear-retractable.xml">
<count type="int">3</count>
</signals>
<signals include="/Aircraft/Generic/flightrecorder/components/tanks.xml">
<count type="int">5</count>
</signals>
<!-- Now Custom Stuff -->
<signals>
<signal>
<type>double</type>
<property>fdm/jsbsim/fcs/slat-pos-norm</property>
<property>/velocities/groundspeed-kt</property>
</signal>
<signal>
<type>double</type>
<property>engines/engine[0]/n1-actual</property>
<property>/position/gear-agl-ft</property>
</signal>
<signal>
<type>double</type>
<property>engines/engine[1]/n1-actual</property>
<property>/engines/engine[0]/reverser-pos-norm</property>
</signal>
<signal>
<type>double</type>
<property>engines/engine[0]/n2-actual</property>
<property>/engines/engine[1]/reverser-pos-norm</property>
</signal>
<signal>
<type>double</type>
<property>engines/engine[1]/n2-actual</property>
<property>/fdm/jsbsim/fcs/slat-pos-norm</property>
</signal>
<signal>
<type>double</type>
<property>fdm/jsbsim/hydraulics/spoiler-l1/final-deg</property>
<property>/engines/engine[0]/n1-actual</property>
</signal>
<signal>
<type>double</type>
<property>fdm/jsbsim/hydraulics/spoiler-l2/final-deg</property>
<property>/engines/engine[1]/n1-actual</property>
</signal>
<signal>
<type>double</type>
<property>fdm/jsbsim/hydraulics/spoiler-l3/final-deg</property>
<property>/engines/engine[0]/n2-actual</property>
</signal>
<signal>
<type>double</type>
<property>fdm/jsbsim/hydraulics/spoiler-l4/final-deg</property>
<property>/engines/engine[1]/n2-actual</property>
</signal>
<signal>
<type>double</type>
<property>fdm/jsbsim/hydraulics/spoiler-l5/final-deg</property>
<property>/fdm/jsbsim/hydraulics/spoiler-l1/final-deg</property>
</signal>
<signal>
<type>double</type>
<property>fdm/jsbsim/hydraulics/spoiler-r1/final-deg</property>
<property>/fdm/jsbsim/hydraulics/spoiler-l2/final-deg</property>
</signal>
<signal>
<type>double</type>
<property>fdm/jsbsim/hydraulics/spoiler-r2/final-deg</property>
<property>/fdm/jsbsim/hydraulics/spoiler-l3/final-deg</property>
</signal>
<signal>
<type>double</type>
<property>fdm/jsbsim/hydraulics/spoiler-r3/final-deg</property>
<property>/fdm/jsbsim/hydraulics/spoiler-l4/final-deg</property>
</signal>
<signal>
<type>double</type>
<property>fdm/jsbsim/hydraulics/spoiler-r4/final-deg</property>
<property>/fdm/jsbsim/hydraulics/spoiler-l5/final-deg</property>
</signal>
<signal>
<type>double</type>
<property>fdm/jsbsim/hydraulics/spoiler-r5/final-deg</property>
<property>/fdm/jsbsim/hydraulics/spoiler-r1/final-deg</property>
</signal>
</signals>
</config>
<signal>
<type>double</type>
<property>/fdm/jsbsim/hydraulics/spoiler-r2/final-deg</property>
</signal>
<signal>
<type>double</type>
<property>/fdm/jsbsim/hydraulics/spoiler-r3/final-deg</property>
</signal>
<signal>
<type>double</type>
<property>/fdm/jsbsim/hydraulics/spoiler-r4/final-deg</property>
</signal>
<signal>
<type>double</type>
<property>/fdm/jsbsim/hydraulics/spoiler-r5/final-deg</property>
</signal>
</signals>
</config>
</PropertyList>

View file

@ -1,84 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- IDG Distance Zooming -->
<!-- Copyright (c) 2015-2017 onox -->
<!-- Modified by Joshua Davidson (it0uchpods) -->
<PropertyList>
<logic>
<name>View Zoom Enabled</name>
<input>
<and>
<equals>
<property>/sim/current-view/type</property>
<value>lookat</value>
</equals>
<not-equals>
<property>/sim/current-view/name</property>
<value>Tower View</value>
</not-equals>
<not-equals>
<property>/sim/current-view/name</property>
<value>Fly-By View</value>
</not-equals>
<not-equals>
<property>/sim/current-view/name</property>
<value>Chase View</value>
</not-equals>
<not-equals>
<property>/sim/current-view/name</property>
<value>Chase View Without Yaw</value>
</not-equals>
<not-equals>
<property>/sim/current-view/name</property>
<value>Walk View</value>
</not-equals>
</and>
</input>
<output>
<property>/sim/current-view/can-change-z-offset</property>
</output>
</logic>
<filter>
<name>View Zoom Decrease Step</name>
<type>gain</type>
<input>
<condition>
<less-than-equals>
<property>/sim/current-view/z-offset-m</property>
<value>-50.0</value>
</less-than-equals>
</condition>
<value>-10.0</value>
</input>
<input>
<value>-5.0</value>
</input>
<output>
<property>/sim/current-view/z-offset-dec-step</property>
</output>
</filter>
<filter>
<name>View Zoom Increase Step</name>
<type>gain</type>
<input>
<condition>
<less-than>
<property>/sim/current-view/z-offset-m</property>
<value>-50.0</value>
</less-than>
</condition>
<value>10.0</value>
</input>
<input>
<value>5.0</value>
</input>
<output>
<property>/sim/current-view/z-offset-inc-step</property>
</output>
</filter>
</PropertyList>

View file

@ -1 +1 @@
4667
4670