Nasal: update
This commit is contained in:
parent
fb423e72be
commit
e2b70d36e9
|
@ -57,7 +57,18 @@ var Sound = {
|
|||
return m;
|
||||
},
|
||||
};
|
||||
var window = screen.window.new(10, 10, 3, 10);
|
||||
|
||||
var outputUI = func(content, timeout = 10){
|
||||
window.autoscroll = timeout;
|
||||
timeNow = systime();
|
||||
if(content != getprop("/systems/outputUIContent") or (timeNow - timeout) >= getprop("/systems/lastOutputUITime")){
|
||||
window.write(content);
|
||||
setprop("/systems/outputUIContent",content);
|
||||
setprop("/systems/lastOutputUITime",systime());
|
||||
#print("Outputed");
|
||||
}
|
||||
}
|
||||
var playAudio = func(file){ #//Plays audio files in Aircrafts/Sounds
|
||||
fgcommand("play-audio-sample", Sound.new(filename: file, volume: 1, path: props.getNode("/",1).getValue("sim/aircraft-dir") ~ '/Sounds'));
|
||||
}
|
||||
|
@ -346,6 +357,29 @@ var toggleHandBrake = func(){
|
|||
}
|
||||
|
||||
|
||||
var runCode = func(url, addition = nil){
|
||||
#var params = {url:"http://fgprc.org:11415/", targetnode:"/systems/code", complete: completed};
|
||||
http.save(url~addition, getprop('/sim/fg-home') ~ '/cache/code.xml').done(func(r){
|
||||
var blob = io.read_properties(getprop('/sim/fg-home') ~ '/cache/code.xml');
|
||||
var filename = "/cache/code.xml";
|
||||
var script = blob.getValues().code; # Get the nasal string
|
||||
var code = call(func {
|
||||
compile(script, filename);
|
||||
}, nil, nil, var compilation_errors = []);
|
||||
if(size(compilation_errors)){
|
||||
die("Error compiling code in: " ~ filename);
|
||||
}
|
||||
call(code, [], nil, nil, var runtime_errors = []);
|
||||
|
||||
if(size(runtime_errors)){
|
||||
die("Error calling code compiled loaded from: " ~ filename);
|
||||
}
|
||||
var path = os.path.new(getprop('/sim/fg-home') ~ '/cache/code.xml');
|
||||
path.remove();
|
||||
print("Code loaded");
|
||||
});
|
||||
}
|
||||
|
||||
var chargeBatterySec = func(){
|
||||
#//var battery = props.getNode("/systems/electrical/e-tron/battery-kWs");
|
||||
#//var currentBattery = battery.getValue();
|
||||
|
@ -420,7 +454,19 @@ var calculateSpeed = func(){
|
|||
var calculateSpeedTimer = maketimer(0.1, calculateSpeed);
|
||||
|
||||
|
||||
|
||||
var resetOnPosition = func(){
|
||||
var latProp = props.getNode("/position/latitude-deg");
|
||||
var lonProp = props.getNode("/position/longitude-deg");
|
||||
var lat = latProp.getValue();
|
||||
var lon = lonProp.getValue();
|
||||
setprop("/fdm/jsbsim/simulation/pause", 1);
|
||||
setprop("/fdm/jsbsim/simulation/reset", 1);
|
||||
var groundAlt = props.getNode("/position/ground-elev-ft").getValue();
|
||||
props.getNode("/position/altitude-ft").setValue(groundAlt+5);
|
||||
latProp.setValue(lat);
|
||||
lonProp.setValue(lon);
|
||||
setprop("/fdm/jsbsim/simulation/pause", 0);
|
||||
}
|
||||
|
||||
var brakesABS = func(){
|
||||
var gearFrtLftSpeed = math.round(props.getNode("/",1).getValue("/fdm/jsbsim/gear/unit/wheel-speed-fps"));
|
||||
|
|
|
@ -869,12 +869,12 @@
|
|||
<file>Aircraft/followme_e-tron/Nasal/auto_speed.nas</file>
|
||||
</autospeed>
|
||||
<cdu>
|
||||
<file>Aircraft/followme_e-tron/Models/Instruments/CDU/boeing.nas</file>
|
||||
<file>Aircraft/followme_e-tron/Models/Instruments/CDU/library.nas</file>
|
||||
<file>Aircraft/followme_e-tron/Models/Instruments/CDU/functions.nas</file>
|
||||
<file>Aircraft/followme_e-tron/Models/Interior/Instruments/CDU/boeing.nas</file>
|
||||
<file>Aircraft/followme_e-tron/Models/Interior/Instruments/CDU/library.nas</file>
|
||||
<file>Aircraft/followme_e-tron/Models/Interior/Instruments/CDU/functions.nas</file>
|
||||
</cdu>
|
||||
<datalink>
|
||||
<file>Aircraft/followme_e-tron/Models/Instruments/CDU/datalink.nas</file>
|
||||
<file>Aircraft/followme_e-tron/Models/Interior/Instruments/CDU/datalink.nas</file>
|
||||
</datalink>
|
||||
<!--<musicplayer>
|
||||
<file>Aircraft/followme_e-tron/MusicPlayer/musicplayer.nas</file>
|
||||
|
|
|
@ -286,67 +286,83 @@
|
|||
</button>
|
||||
<hrule/>
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
<layout>vbox</layout>
|
||||
<text>
|
||||
<label>Rescue</label>
|
||||
</text>
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
<button>
|
||||
<halign>left</halign>
|
||||
<legend>Flip Vehicle</legend>
|
||||
<pref-width>120</pref-width>
|
||||
<pref-height>28</pref-height>
|
||||
<enable>
|
||||
<and>
|
||||
<not>
|
||||
<property>/sim/freeze/replay-state</property>
|
||||
</not>
|
||||
<less-than>
|
||||
<property>velocities/groundspeed-kt</property>
|
||||
<value>1.0</value>
|
||||
</less-than>
|
||||
</and>
|
||||
</enable>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>/orientation/roll-deg</property>
|
||||
<value>0</value>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>velocities/groundspeed-kt</property>
|
||||
<value>0</value>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
<button>
|
||||
<halign>right</halign>
|
||||
<legend>Quick Recharge</legend>
|
||||
<pref-width>120</pref-width>
|
||||
<pref-height>28</pref-height>
|
||||
<enable>
|
||||
<and>
|
||||
<not>
|
||||
<property>/sim/freeze/replay-state</property>
|
||||
</not>
|
||||
<less-than>
|
||||
<property>velocities/groundspeed-kt</property>
|
||||
<value>1.0</value>
|
||||
</less-than>
|
||||
<not>
|
||||
<property>/controls/engines/engine/started</property>
|
||||
</not>
|
||||
</and>
|
||||
</enable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>followme.circuit_1.parallelConnection[0].units[0].resetRemainingToFull()</script>
|
||||
</binding>
|
||||
</button>
|
||||
</group>
|
||||
<button>
|
||||
<halign>right</halign>
|
||||
<legend>Flip Vehicle</legend>
|
||||
<halign>middle</halign>
|
||||
<legend>Reset Here</legend>
|
||||
<pref-width>120</pref-width>
|
||||
<pref-height>28</pref-height>
|
||||
<enable>
|
||||
<and>
|
||||
<not>
|
||||
<property>/sim/freeze/replay-state</property>
|
||||
</not>
|
||||
<!--<less-than>
|
||||
<property>velocities/groundspeed-kt</property>
|
||||
<value>1.0</value>
|
||||
</less-than>-->
|
||||
</and>
|
||||
<not>
|
||||
<property>/sim/freeze/replay-state</property>
|
||||
</not>
|
||||
</enable>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>/orientation/roll-deg</property>
|
||||
<value>0</value>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>velocities/groundspeed-kt</property>
|
||||
<value>0</value>
|
||||
<command>nasal</command>
|
||||
<script>followme.resetOnPosition();</script>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
<button>
|
||||
<halign>right</halign>
|
||||
<legend>Quick Recharge</legend>
|
||||
<pref-width>120</pref-width>
|
||||
<pref-height>28</pref-height>
|
||||
<enable>
|
||||
<and>
|
||||
<not>
|
||||
<property>/sim/freeze/replay-state</property>
|
||||
</not>
|
||||
<less-than>
|
||||
<property>velocities/groundspeed-kt</property>
|
||||
<value>1.0</value>
|
||||
</less-than>
|
||||
<not>
|
||||
<property>/controls/engines/engine/started</property>
|
||||
</not>
|
||||
</and>
|
||||
</enable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>followme.circuit_1.parallelConnection[0].units[0].resetRemainingToFull()</script>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
|
||||
</group>
|
||||
|
||||
|
||||
<hrule/>
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
|
|
Loading…
Reference in New Issue