Ryan Miller: Get rid of no-op jetway XML files.
This commit is contained in:
parent
782add34b3
commit
1f64676296
3 changed files with 27 additions and 46 deletions
|
@ -302,9 +302,9 @@ var loaded_airports = [];
|
|||
var jetways = [];
|
||||
|
||||
# properties
|
||||
var on_switch = "/nasal/jetways/enabled";
|
||||
var debug_switch = "/sim/jetways/debug";
|
||||
var mp_switch = "/sim/jetways/interact-with-multiplay";
|
||||
var on_switch = nil;
|
||||
var debug_switch = nil;
|
||||
var mp_switch = nil;
|
||||
var jetway_id_prop = "/sim/jetways/last-loaded-jetway";
|
||||
|
||||
# interpolation tables
|
||||
|
@ -408,6 +408,7 @@ var Jetway =
|
|||
parents: [Jetway]
|
||||
};
|
||||
m._active = 1; # set this to 'true' on the first run so that the offsets can take effect
|
||||
m._edit = 0;
|
||||
m.airport = airport;
|
||||
m.gate = gate;
|
||||
m.airline = airline;
|
||||
|
@ -794,14 +795,17 @@ var update_jetways = func(loopid)
|
|||
for (var i = 0; i < size(jetways); i += 1)
|
||||
{
|
||||
var jetway = jetways[i];
|
||||
if (jetway == nil or !jetway._active) continue;
|
||||
var position = jetway.door_object.getpos();
|
||||
if (position == 0 or position == 1) jetway._active = 0;
|
||||
jetway.node.getNode("jetway-position/extend-m").setValue(interpolate_table(extend_table, position) * jetway.target_extend + jetway.init_extend);
|
||||
jetway.node.getNode("jetway-position/pitch-deg").setValue(interpolate_table(pitch_table, position) * jetway.target_pitch + jetway.init_pitch);
|
||||
jetway.node.getNode("jetway-position/heading-deg").setValue(interpolate_table(heading_table, position) * jetway.target_heading + jetway.init_heading);
|
||||
jetway.node.getNode("jetway-position/entrance-heading-deg").setValue(interpolate_table(heading_entrance_table, position) * jetway.target_ent_heading + jetway.init_ent_heading);
|
||||
jetway.node.getNode("jetway-position/hood-deg").setValue(interpolate_table(hood_table, position) * jetway.target_hood);
|
||||
if (jetway == nil) continue;
|
||||
if (jetway._active or jetway._edit)
|
||||
{
|
||||
var position = jetway.door_object.getpos();
|
||||
if (position == 0 or position == 1) jetway._active = 0;
|
||||
jetway.node.getNode("jetway-position/extend-m").setValue(interpolate_table(extend_table, position) * jetway.target_extend + jetway.init_extend);
|
||||
jetway.node.getNode("jetway-position/pitch-deg").setValue(interpolate_table(pitch_table, position) * jetway.target_pitch + jetway.init_pitch);
|
||||
jetway.node.getNode("jetway-position/heading-deg").setValue(interpolate_table(heading_table, position) * jetway.target_heading + jetway.init_heading);
|
||||
jetway.node.getNode("jetway-position/entrance-heading-deg").setValue(interpolate_table(heading_entrance_table, position) * jetway.target_ent_heading + jetway.init_ent_heading);
|
||||
jetway.node.getNode("jetway-position/hood-deg").setValue(interpolate_table(hood_table, position) * jetway.target_hood);
|
||||
}
|
||||
}
|
||||
settimer(func update_jetways(loopid), UPDATE_PERIOD);
|
||||
};
|
||||
|
@ -889,9 +893,9 @@ _setlistener("/nasal/jetways/loaded", func
|
|||
if (size(scenery) == 0) append(scenery, root ~ "/Scenery");
|
||||
|
||||
# properties
|
||||
on_switch = props.globals.getNode(on_switch, 1);
|
||||
debug_switch = props.globals.getNode(debug_switch, 1);
|
||||
mp_switch = props.globals.getNode(mp_switch, 1);
|
||||
on_switch = props.globals.getNode("/nasal/jetways/enabled", 1);
|
||||
debug_switch = props.globals.getNode("/sim/jetways/debug", 1);
|
||||
mp_switch = props.globals.getNode("/sim/jetways/interact-with-multiplay", 1);
|
||||
|
||||
jetway_id_prop = props.globals.getNode(jetway_id_prop, 1);
|
||||
restart();
|
||||
|
|
|
@ -243,11 +243,13 @@ var click = func(pos)
|
|||
}
|
||||
if (nearest_jetway != nil)
|
||||
{
|
||||
if (selected_jetway != nil) selected_jetway._edit = 0;
|
||||
selected_jetway = nearest_jetway;
|
||||
setprop("/sim/jetways/adjust/model", selected_jetway.model);
|
||||
setprop("/sim/jetways/adjust/door", selected_jetway.door);
|
||||
setprop("/sim/jetways/adjust/airline", selected_jetway.airline);
|
||||
setprop("/sim/jetways/adjust/gate", selected_jetway.gate);
|
||||
selected_jetway._edit = 1;
|
||||
flash(nearest_jetway);
|
||||
}
|
||||
}
|
||||
|
@ -256,6 +258,7 @@ var click = func(pos)
|
|||
var airport = getprop("/sim/airport/closest-airport-id");
|
||||
if (airport == "") return;
|
||||
selected_jetway = jetways.Jetway.new(airport, "generic", "FG", 0, "FGFS", pos.lat(), pos.lon(), pos.alt(), 0);
|
||||
selected_jetway._edit = 1;
|
||||
if (!jetways.isin(jetways.loaded_airports, airport)) append(jetways.loaded_airports, airport);
|
||||
setprop("/sim/jetways/adjust/model", selected_jetway.model);
|
||||
setprop("/sim/jetways/adjust/door", selected_jetway.door);
|
||||
|
@ -367,7 +370,10 @@ var export = func
|
|||
node.getNode("airline", 1).setValue(jetway.airline);
|
||||
node.getNode("latitude-deg", 1).setDoubleValue(jetway.lat);
|
||||
node.getNode("longitude-deg", 1).setDoubleValue(jetway.lon);
|
||||
node.getNode("elevation-m", 1).setDoubleValue(jetway.alt - geo.elevation(jetway.lat, jetway.lon));
|
||||
var alt = jetway.alt;
|
||||
jetway.setpos(jetway.lat, jetway.lon, jetway.heading, -geo.ERAD);
|
||||
node.getNode("elevation-m", 1).setDoubleValue(alt - geo.elevation(jetway.lat, jetway.lon));
|
||||
jetway.setpos(jetway.lat, jetway.lon, jetway.heading, alt);
|
||||
node.getNode("heading-deg", 1).setDoubleValue(geo.normdeg(180 - jetway.heading));
|
||||
node.getNode("initial-position/jetway-extension-m", 1).setDoubleValue(jetway.init_extend);
|
||||
node.getNode("initial-position/jetway-heading-deg", 1).setDoubleValue(jetway.init_heading);
|
||||
|
|
|
@ -18,37 +18,8 @@
|
|||
{
|
||||
if (substr(file, -3) == "xml")
|
||||
{
|
||||
var model = "";
|
||||
var isamodel = 0;
|
||||
for (var i = 0; i < size(file); i += 1)
|
||||
{
|
||||
model ~= substr(file, i, 1);
|
||||
if (substr(model, -9) == ".airline.")
|
||||
{
|
||||
model = substr(model, 0, size(model) - 9);
|
||||
isamodel = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isamodel) continue;
|
||||
if (size(models) == 0)
|
||||
{
|
||||
models = [model];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = 0; i < size(models); i += 1)
|
||||
{
|
||||
if (models[i] == model)
|
||||
{
|
||||
break;
|
||||
}
|
||||
elsif (i == size(models) - 1)
|
||||
{
|
||||
append(models, model)
|
||||
}
|
||||
}
|
||||
}
|
||||
var tree = io.read_properties("Models/Airport/Jetway/" ~ file);
|
||||
if (tree.getNode("is-animated-jetway", 1).getBoolValue()) append(models, substr(file, 0, size(file) - 4));
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < size(models); i += 1)
|
||||
|
|
Loading…
Add table
Reference in a new issue