Add option to define saved props
Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
parent
a7c87dc428
commit
75b1d4c4f2
2 changed files with 6 additions and 6 deletions
|
@ -190,13 +190,13 @@ setlistener("/sim/signals/fdm-initialized", func {
|
||||||
writeSettings();
|
writeSettings();
|
||||||
if (getprop("options/system/save-state") == 1)
|
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();
|
spinning.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
setlistener("/sim/signals/exit", func {
|
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 = {
|
var renderingSettings = {
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
# Save and restore properties between sessions
|
# Save and restore properties between sessions
|
||||||
|
|
||||||
# To add more properties, just add them here:
|
# To add more properties to autosave, just add them here.
|
||||||
var saved_props = [
|
var default = [
|
||||||
# CONSUMABLES
|
# CONSUMABLES
|
||||||
# Fuel
|
# Fuel
|
||||||
"/consumables/fuel/tank[0]/level-lbs",
|
"/consumables/fuel/tank[0]/level-lbs",
|
||||||
|
@ -43,7 +43,7 @@ var saved_props = [
|
||||||
"/controls/gear/brake-parking"
|
"/controls/gear/brake-parking"
|
||||||
];
|
];
|
||||||
|
|
||||||
var save = func (file) {
|
var save = func (saved_props, file) {
|
||||||
print("Saving state...");
|
print("Saving state...");
|
||||||
for (var i = 0; i < size(saved_props); i += 1)
|
for (var i = 0; i < size(saved_props); i += 1)
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ var save = func (file) {
|
||||||
print("State saved");
|
print("State saved");
|
||||||
}
|
}
|
||||||
|
|
||||||
var restore = func (file) {
|
var restore = func (saved_props, file) {
|
||||||
print("Loading saved state...");
|
print("Loading saved state...");
|
||||||
var readNode = props.globals.initNode("/save", );
|
var readNode = props.globals.initNode("/save", );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue