1
0
Fork 0

Some extra PTS

This commit is contained in:
legoboyvdlp R 2021-06-09 17:25:17 +01:00
parent 51e82aeb09
commit 35ddbf0426
5 changed files with 12 additions and 10 deletions

View file

@ -158,7 +158,7 @@ setlistener("/sim/signals/fdm-initialized", func {
writeSettings();
if (getprop("/options/system/save-state") == 1)
{
save.restore(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
save.restore(save.default, pts.Sim.fgHome.getValue() ~ "/Export/" ~ pts.Sim.aircraft.getValue() ~ "-save.xml");
}
if (getprop("/options/system/fo-view") == 1) {
@ -169,7 +169,7 @@ setlistener("/sim/signals/fdm-initialized", func {
});
setlistener("/sim/signals/exit", func {
save.save(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
save.save(save.default, pts.Sim.fgHome.getValue() ~ "/Export/" ~ pts.Sim.aircraft.getValue() ~ "-save.xml");
});
var renderingSettings = {
@ -202,7 +202,7 @@ var renderingSettings = {
};
var readSettings = func {
io.read_properties(getprop("/sim/fg-home") ~ "/Export/A320-family-config.xml", "/systems/acconfig/options");
io.read_properties(pts.Sim.fgHome.getValue() ~ "/Export/A320-family-config.xml", "/systems/acconfig/options");
setprop("/options/system/keyboard-mode", getprop("/systems/acconfig/options/keyboard-mode"));
setprop("/options/system/weight-kgs", getprop("/systems/acconfig/options/weight-kgs"));
setprop("/options/system/save-state", getprop("/systems/acconfig/options/save-state"));
@ -228,7 +228,7 @@ var writeSettings = func {
setprop("/systems/acconfig/options/simbrief-username", getprop("/FMGC/simbrief-username"));
setprop("/systems/acconfig/options/atis-server", getprop("/systems/atsu/atis-server"));
setprop("/systems/acconfig/options/wxr-server", getprop("/systems/atsu/wxr-server"));
io.write_properties(getprop("/sim/fg-home") ~ "/Export/A320-family-config.xml", "/systems/acconfig/options");
io.write_properties(pts.Sim.fgHome.getValue() ~ "/Export/A320-family-config.xml", "/systems/acconfig/options");
}
################

View file

@ -13,11 +13,11 @@ var SimbriefParser = {
fetch: func(username, i) {
me.inhibit = 1;
var stamp = systime();
http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml")
http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, pts.Sim.fgHome.getValue() ~ "/Export/A320-family-simbrief.xml")
.fail(func { me.failure(i) })
.done(func {
var errs = [];
call(me.read, [(getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml"),i], SimbriefParser, {}, errs);
call(me.read, [(pts.Sim.fgHome.getValue() ~ "/Export/A320-family-simbrief.xml"),i], SimbriefParser, {}, errs);
if (size(errs) > 0) {
debug.printerror(errs);
me.failure(i);

View file

@ -160,7 +160,7 @@ var WaypointDatabase = {
},
# write - write to file, as a hash structure
write: func() {
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWaypoints.xml";
var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWaypoints.xml";
var tree = {
waypoints: {
@ -177,7 +177,7 @@ var WaypointDatabase = {
},
# read - read from a file, extract using props interface
read: func() {
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWaypoints.xml";
var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWaypoints.xml";
# create file if it doesn't exist
if (io.stat(path) == nil) {
me.write();

View file

@ -226,7 +226,7 @@ var windController = {
},
# read - read from hist wind file, create one if it doesn't exist
read: func() {
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt";
var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWinds.txt";
# create file if it doesn't exist
if (io.stat(path) == nil) {
me.write();
@ -267,7 +267,7 @@ var windController = {
# write - write to hist wind file, called whenever winds changed
write: func() {
if (me.des_winds[2] != 0) {
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt";
var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWinds.txt";
var file = io.open(path, "wb");
var winds_added = 0;

View file

@ -217,6 +217,7 @@ var Position = {
var Sim = {
aero: props.globals.getNode("/sim/aero"),
aircraft: props.globals.getNode("/sim/aircraft"),
CurrentView: {
fieldOfView: props.globals.getNode("/sim/current-view/field-of-view", 1),
headingOffsetDeg: props.globals.getNode("/sim/current-view/heading-offset-deg", 1),
@ -232,6 +233,7 @@ var Sim = {
zOffsetMaxM: props.globals.getNode("/sim/current-view/z-offset-max-m", 1),
zOffsetMinM: props.globals.getNode("/sim/current-view/z-offset-min-m", 1),
},
fgHome: props.globals.getNode("/sim/fg-home"),
Input: {
Selected: {
engine: [props.globals.getNode("/sim/input/selected/engine[0]", 1),props.globals.getNode("/sim/input/selected/engine[1]", 1)],