Service: use relative path in xml

This commit is contained in:
Sidi Liang 2020-11-26 11:10:36 +08:00
parent e1e162f1db
commit 73162e269d
1 changed files with 23 additions and 20 deletions

View File

@ -4,15 +4,18 @@ var AdditionalModel = {
newCoord = geo.Coord.new();
newCoord.set_latlon(0, 0, 0);
m.coord = newCoord;
m._aircraftPath = getprop("sim/aircraft-dir") ~ "/";
print("AdditionalModel: Model initialized");
return m;
},
name: "New Model",
info: "This is a new model for followme EV created by FGPRC",
path: "",
path: me._aircraftPath ~ me.relativePath,
relativePath: "",
hdg: 0,
coord: nil,
_aircraftPath: "",
_tileIndex:0,
_isPlaced: 0,
@ -41,7 +44,7 @@ var AdditionalModel = {
var node = props.Node.new();
node.getNode("name", 1).setValue(me.name);
node.getNode("info", 1).setValue(me.info);
node.getNode("path", 1).setValue(me.path);
node.getNode("path", 1).setValue(me.relativePath);
node.getNode("hdg", 1).setValue(me.hdg);
node.getNode("lat", 1).setDoubleValue(me.coord.lat() or 0);
node.getNode("lon", 1).setDoubleValue(me.coord.lon() or 0);
@ -51,7 +54,7 @@ var AdditionalModel = {
loadFromNode: func(node){
me.name = node.getNode("name", 1).getValue();
me.info = node.getNode("info", 1).getValue();
me.path = node.getNode("path", 1).getValue();
me.relativePath = node.getNode("path", 1).getValue();
me.hdg = node.getNode("hdg", 1).getValue();
me.setLonLat(node.getNode("lon", 1).getValue(), node.getNode("lat", 1).getValue());
me.coord.set_alt(node.getNode("alt", 1).getValue());
@ -174,7 +177,7 @@ var path = getprop("/sim/fg-home") ~ '/Export/followmeEV/service.xml';
var modelManager = ModelManager.new(path);
#//var serviceStationModel = AdditionalModel.new();
#//var stationPath = getprop("sim/aircraft-dir")~'/Models/Service-Station/Service-Staion.ac';
#//var stationPath = 'Models/Service-Station/Service-Staion.ac';
#//serviceStationModel.name = "service station";
#//serviceStationModel.info = "this is a service station";