Hi,
Endlich: new (and simpler) nasal script for the A-10 canopy. Thanks M.
The diff file, A-10-20070410b.diff is attached.
Alexis
Index: Nasal/canopy.nas
===================================================================
RCS file: /var/cvs/FlightGear-0.9/data/Aircraft/A-10/Nasal/canopy.nas,v
retrieving revision 1.3
diff -u -p -r1.3 canopy.nas
--- Nasal/canopy.nas 11 Jan 2007 12:54:49 -0000 1.3
+++ Nasal/canopy.nas 10 May 2007 20:03:20 -0000
@@ -1,52 +1,32 @@
-# animation of the canopy switch and the canopy move
-# arg[0]: 1 and -1 = mouse click up/down aeras, 2 = keyb "C" toggle like.
+# used to the animation of the canopy switch and the canopy move
+# toggle keystroke or 2 position switch
-canopy_switch = func {
- input = arg[0];
- if ( ! getprop("sim/model/A-10/controls/canopy-lock") ) {
- setprop("sim/model/A-10/controls/canopy-lock", 1);
- if (input == 2 ) {
- if ( getprop("canopy/position-norm") < 1 ) {
- input = 1;
- } elsif ( getprop("canopy/position-norm") >= 1 ) {
- input = -1;
- }
- }
- if (input == 1 ) {
- setprop("controls/canopy-switch", 3);
- do_open();
- }
- elsif (input == -1) {
- setprop("controls/canopy-switch", 1);
- do_close();
+var cnpy = aircraft.door.new("canopy", 10);
+var switch =
props.globals.getNode("sim/model/A-10/controls/canopy/canopy-switch", 1);
+var pos = props.globals.getNode("canopy/position-norm", 1);
+
+canopy_switch = func(v) {
+
+ p = pos.getValue();
+
+ if (v == 2 ) {
+ if ( p < 1 ) {
+ v = 1;
+ } elsif ( p >= 1 ) {
+ v = -1;
}
}
-}
-do_open = func {
- if ( getprop("canopy/position-norm") < 1 ) {
- continue_move( 0.015 );
- } else {
- setprop("sim/model/A-10/controls/canopy-lock", 0);
- }
-}
+ if (v < 0) {
+ switch.setValue(1);
+ cnpy.close();
-do_close = func {
- if ( getprop("canopy/position-norm") > 0.01 ) {
- continue_move( -0.015 );
- } else {
- setprop("sim/model/A-10/controls/canopy-lock", 0);
- setprop("canopy/position-norm", 0)
- }
-}
+ } elsif (v > 0) {
+ switch.setValue(3);
+ cnpy.open();
-continue_move = func {
- position = getprop("canopy/position-norm");
- new_position = position + arg[0];
- setprop("canopy/position-norm", new_position);
- if ( arg[0] > 0 ) {
- settimer( do_open, 0.05);
- } elsif ( arg[0] < 0 ) {
- settimer( do_close, 0.05);
}
}
+
+
+
Index: A-10-set.xml
===================================================================
RCS file: /var/cvs/FlightGear-0.9/data/Aircraft/A-10/A-10-set.xml,v
retrieving revision 1.9
diff -u -p -r1.9 A-10-set.xml
--- A-10-set.xml 4 May 2007 15:52:59 -0000 1.9
+++ A-10-set.xml 10 May 2007 20:04:19 -0000
@@ -198,8 +198,9 @@ Fairchild A-10 simulation config.
</fuel>
</consumables>
<controls>
- <canopy-lock
type="bool">false</canopy-lock>
- <canopy-switch
type="int">2</canopy-switch>
+ <canopy>
+ <canopy-switch
type="int">2</canopy-switch>
+ </canopy>
<engines>
<engine n="0">
<starter-switch-position type="int">1</starter-switch-position>
Index: Models/A-10-canopy-switch.xml
===================================================================
RCS file:
/var/cvs/FlightGear-0.9/data/Aircraft/A-10/Models/A-10-canopy-switch.xml,v
retrieving revision 1.2
diff -u -p -r1.2 A-10-canopy-switch.xml
--- Models/A-10-canopy-switch.xml 5 Dec 2006 20:55:41 -0000 1.2
+++ Models/A-10-canopy-switch.xml 10 May 2007 20:05:24 -0000
@@ -8,7 +8,7 @@
<animation>
<object-name>switch</object-name>
<type>rotate</type>
- <property>controls/canopy-switch</property>
+ <property>sim/model/A-10/controls/canopy/canopy-switch</property>
<factor>30</factor>
<center>
<x-m>2.4829</x-m>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel