1
0
Fork 0

Fuel selector for c172p.

This commit is contained in:
Stuart Buchanan 2010-12-24 18:42:29 +00:00
parent 13af11ae1f
commit 2c178fe750
3 changed files with 6040 additions and 4157 deletions

File diff suppressed because it is too large Load diff

View file

@ -1728,6 +1728,141 @@
</center>
</animation>
<!-- Fuel Selector -->
<animation>
<type>select</type>
<object-name>FuelSelectorOff</object-name>
<condition>
<and>
<not>
<property>consumables/fuel/tank[0]/selected</property>
</not>
<not>
<property>consumables/fuel/tank[1]/selected</property>
</not>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>FuelSelectorLeft</object-name>
<condition>
<and>
<property>consumables/fuel/tank[0]/selected</property>
<not>
<property>consumables/fuel/tank[1]/selected</property>
</not>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>FuelSelectorRight</object-name>
<condition>
<and>
<not>
<property>consumables/fuel/tank[0]/selected</property>
</not>
<property>consumables/fuel/tank[1]/selected</property>
</and>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>FuelSelectorBoth</object-name>
<condition>
<and>
<property>consumables/fuel/tank[0]/selected</property>
<property>consumables/fuel/tank[1]/selected</property>
</and>
</condition>
</animation>
<animation>
<type>pick</type>
<object-name>FuelHotspotOff</object-name>
<visible>true</visible>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>consumables/fuel/tank[0]/selected</property>
<value>false</value>
</binding>
<binding>
<command>property-assign</command>
<property>consumables/fuel/tank[1]/selected</property>
<value>false</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>FuelHotspotLeft</object-name>
<visible>true</visible>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>consumables/fuel/tank[0]/selected</property>
<value>true</value>
</binding>
<binding>
<command>property-assign</command>
<property>consumables/fuel/tank[1]/selected</property>
<value>false</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>FuelHotspotRight</object-name>
<visible>true</visible>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>consumables/fuel/tank[0]/selected</property>
<value>false</value>
</binding>
<binding>
<command>property-assign</command>
<property>consumables/fuel/tank[1]/selected</property>
<value>true</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>FuelHotspotBoth</object-name>
<visible>true</visible>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>consumables/fuel/tank[0]/selected</property>
<value>true</value>
</binding>
<binding>
<command>property-assign</command>
<property>consumables/fuel/tank[1]/selected</property>
<value>true</value>
</binding>
</action>
</animation>
<!-- Switches -->
<animation>
<type>rotate</type>

View file

@ -51,7 +51,7 @@ var init_actions = func {
filteredGS1.setDoubleValue(0.0);
# Make sure that init_actions is called when the sim is reset
setlistener("sim/signals/reset", init_actions);
setlistener("sim/signals/reset", init_actions);
# Request that the update fuction be called next frame
settimer(update_actions, 0);
@ -113,15 +113,25 @@ var update_actions = func {
var scissor_angle = func(H,C,L,phi) {
var a = (H - C)/2/L;
# Use 2 iterates of Newton's method and 4th order Taylor series to
# Use 2 iterates of Newton's method and 4th order Taylor series to
# approximate theta where sin(phi - theta) = a
var theta = phi - 2*a/3 - a/3/(1-a*a/2);
return theta;
}
# Setup listener call to start update loop once the fdm is initialized
#
setlistener("sim/signals/fdm-initialized", init_actions);
#
setlistener("sim/signals/fdm-initialized", init_actions);
#
# Listeners to tie the /consumables/fuels/tank[]/selected to
# /fdm/jsbsim/propulsion/tank[]/priority
setlistener("consumables/fuel/tank[0]/selected", func(selected) {
setprop("/fdm/jsbsim/propulsion/tank[0]/priority", selected.getBoolValue() ? 1 : 0);
});
setlistener("consumables/fuel/tank[1]/selected", func(selected) {
setprop("/fdm/jsbsim/propulsion/tank[1]/priority", selected.getBoolValue() ? 1 : 0);
});