1
0
Fork 0

Add option to define saved props

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2020-03-10 02:18:24 +00:00
parent a7c87dc428
commit 75b1d4c4f2
2 changed files with 6 additions and 6 deletions

View file

@ -190,13 +190,13 @@ setlistener("/sim/signals/fdm-initialized", func {
writeSettings();
if (getprop("options/system/save-state") == 1)
{
save.restore(getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
save.restore(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
}
spinning.stop();
});
setlistener("/sim/signals/exit", func {
save.save(getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
save.save(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
});
var renderingSettings = {

View file

@ -16,8 +16,8 @@
# Save and restore properties between sessions
# To add more properties, just add them here:
var saved_props = [
# To add more properties to autosave, just add them here.
var default = [
# CONSUMABLES
# Fuel
"/consumables/fuel/tank[0]/level-lbs",
@ -43,7 +43,7 @@ var saved_props = [
"/controls/gear/brake-parking"
];
var save = func (file) {
var save = func (saved_props, file) {
print("Saving state...");
for (var i = 0; i < size(saved_props); i += 1)
{
@ -56,7 +56,7 @@ var save = func (file) {
print("State saved");
}
var restore = func (file) {
var restore = func (saved_props, file) {
print("Loading saved state...");
var readNode = props.globals.initNode("/save", );