Systems: Divided some sounds in different queue and fixed the issue of queue not enabled
This commit is contained in:
parent
ff8ca55a3a
commit
9bebfb4132
|
@ -18,60 +18,6 @@ var Debugger = {
|
|||
},
|
||||
};
|
||||
|
||||
var isInternalView = func(){ #// return 1 if is in internal view, otherwise return 0.
|
||||
return props.getNode("sim/current-view/internal", 1).getValue();
|
||||
}
|
||||
|
||||
var Sound = {
|
||||
new: func(filename, volume = 1, path=nil) {
|
||||
var m = props.Node.new({
|
||||
path : path,
|
||||
file : filename,
|
||||
volume : volume,
|
||||
});
|
||||
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, audioVolume=1, audioPath=""){ #//Plays audio files in Aircrafts/Sounds
|
||||
if(!audioPath) audioPath = props.getNode("/",1).getValue("sim/aircraft-dir") ~ '/Sounds';
|
||||
fgcommand("play-audio-sample", Sound.new(filename: file, volume: audioVolume, path: audioPath));
|
||||
}
|
||||
|
||||
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 universalVariableDebug = Debugger.new("Universal Variable");
|
||||
universalVariableDebug.setDebugLevel(2);
|
||||
|
||||
|
@ -166,3 +112,60 @@ var Variable = {
|
|||
return me._listenPropertyTree;
|
||||
},
|
||||
};
|
||||
|
||||
var isInternalView = func(){ #// return 1 if is in internal view, otherwise return 0.
|
||||
return props.getNode("sim/current-view/internal", 1).getValue();
|
||||
}
|
||||
|
||||
var Sound = {
|
||||
new: func(filename, volume = 1, path=nil, queue="chatter") {
|
||||
var m = props.Node.new({
|
||||
path : path,
|
||||
file : filename,
|
||||
volume : volume,
|
||||
queue : queue
|
||||
});
|
||||
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, audioVolume=1, audioPath="", queue="followme_fx"){ #//Plays audio files in Aircrafts/Sounds
|
||||
if(!audioPath) audioPath = props.getNode("/",1).getValue("sim/aircraft-dir") ~ '/Sounds';
|
||||
props.getNode("/sim/sound", 1).getNode(queue, 1).getNode("enabled", 1).setValue("true");#//Enable the queue
|
||||
fgcommand("play-audio-sample", Sound.new(filename: file, volume: audioVolume, path: audioPath, queue: queue));
|
||||
}
|
||||
|
||||
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");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ var Radar = {
|
|||
me.isRunning = 1;
|
||||
if(me.warnEnabled){
|
||||
print("Parking radar started!");
|
||||
playAudio("parking_radar_init.wav");
|
||||
playAudio(file: "parking_radar_init.wav", queue: "fx_radar");
|
||||
}else{
|
||||
#print("Radar initialized!");
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ var Radar = {
|
|||
getElevByCoord: func(coord){
|
||||
return geo.elevation(coord.lat(), coord.lon());
|
||||
},
|
||||
position_change: func(position_val,value){
|
||||
position_change: func(position_val, value){
|
||||
if(position_val+value>180)
|
||||
position_val += value-360;
|
||||
else if(position_val+value<-180)
|
||||
|
@ -272,7 +272,7 @@ var Radar = {
|
|||
},
|
||||
warn: func(){
|
||||
me.warningTimer.restart(me.warningInterval);
|
||||
playAudio(me.warningSound);
|
||||
playAudio(file: me.warningSound, queue: "fx_radar");
|
||||
},
|
||||
warnControl: func(meters){
|
||||
if(meters == 10000){
|
||||
|
|
|
@ -15,16 +15,16 @@ var tyreSmoke_3 = aircraft.tyresmoke.new(3, auto = 1, diff_norm = 0.4, check_vsp
|
|||
|
||||
var frontleft_door = aircraft.door.new("/controls/doors/frontleft", 1);
|
||||
frontleft_door.informationNode = vehicleInformation.controls.doors.FL;
|
||||
frontleft_door.isDoor = 1;
|
||||
frontleft_door.doorNum = "1";
|
||||
var frontright_door = aircraft.door.new("/controls/doors/frontright", 1);
|
||||
frontright_door.informationNode = vehicleInformation.controls.doors.FR;
|
||||
frontright_door.isDoor = 1;
|
||||
frontright_door.doorNum = "2";
|
||||
var rearleft_door = aircraft.door.new("/controls/doors/rearleft", 1);
|
||||
rearleft_door.informationNode = vehicleInformation.controls.doors.RL;
|
||||
rearleft_door.isDoor = 1;
|
||||
rearleft_door.doorNum = "3";
|
||||
var rearright_door = aircraft.door.new("/controls/doors/rearright", 1);
|
||||
rearright_door.informationNode = vehicleInformation.controls.doors.RR;
|
||||
rearright_door.isDoor = 1;
|
||||
rearright_door.doorNum = "4";
|
||||
|
||||
var charging_cap = aircraft.door.new("/controls/doors/charging_cap", 1);
|
||||
charging_cap.informationNode = vehicleInformation.controls.doors.charging_cap;
|
||||
|
@ -34,11 +34,11 @@ aircraft.door.toggle = func(){
|
|||
me.informationNode.setValue(1 - me.getpos());
|
||||
if(pos == 0){
|
||||
me.open();
|
||||
if(me.isDoor) playAudio('door_open.wav');
|
||||
if(me.doorNum) playAudio(file: 'door_open.wav', queue: 'fx_door_'~me.doorNum);
|
||||
}
|
||||
if(pos == 1){
|
||||
me.close();
|
||||
if(me.isDoor) playAudio('door_shut.wav');
|
||||
if(me.doorNum) playAudio(file: 'door_shut.wav', queue: 'fx_door_'~me.doorNum);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -587,7 +587,7 @@ var Safety = {
|
|||
toggleAEB: func(){
|
||||
if(!me.aebEnabled){
|
||||
me.enableAEB();
|
||||
playAudio("parking_radar_init.wav");
|
||||
playAudio(file: "parking_radar_init.wav", queue: "fx_aeb");
|
||||
}
|
||||
else me.disableAEB();
|
||||
},
|
||||
|
@ -633,9 +633,9 @@ var Safety = {
|
|||
brakeController.releaseAllBrakes();
|
||||
},
|
||||
aebWarning: func(){
|
||||
playAudio("parking_radar_high.wav");
|
||||
playAudio("parking_radar_high.wav");
|
||||
playAudio("parking_radar_high.wav");
|
||||
playAudio(file: "parking_radar_high.wav", queue: "fx_aeb");
|
||||
playAudio(file: "parking_radar_high.wav", queue: "fx_aeb");
|
||||
playAudio(file: "parking_radar_high.wav", queue: "fx_aeb");
|
||||
},
|
||||
aebFullBrake: func(){
|
||||
brakeController.activeEmergencyBrake();
|
||||
|
|
Loading…
Reference in New Issue