1
0
Fork 0

minor correction in lag_adjust.nas (mp patch)

This commit is contained in:
janodesbois 2015-06-15 00:06:20 +02:00
parent 432a442afc
commit 3feafef999

View file

@ -1,12 +1,12 @@
var i = 0; var i = 0;
var net_raw = "false"; var spectator = 0;
var spectator = "false";
var spectator_offset = 0.5; var spectator_offset = 0.5;
var range = 3.0; var range = 3.0;
var offset = 0.0; var offset = 0.0;
var apply_close = "false"; var apply_close = 0;
var master = 0; var master = 0;
var close = 0; var close = 0;
var initialised = 0;
var ls_spect = nil; var ls_spect = nil;
var ls_spctoffset = nil; var ls_spctoffset = nil;
@ -23,11 +23,11 @@ var ls_close = nil;
var mpCheck = func() { var mpCheck = func() {
var mpname = getprop("/ai/models/multiplayer["~i~"]/callsign"); var mpname = getprop("/ai/models/multiplayer["~i~"]/callsign");
if (mpname != nil) { if (mpname != nil) {
if (spectator) { if ((spectator) and (master)) {
setprop("/ai/models/multiplayer["~i~"]/controls/compensate-lag", 3); setprop("/ai/models/multiplayer["~i~"]/controls/compensate-lag", 3);
setprop("/ai/models/multiplayer["~i~"]/controls/player-lag", -spectator_offset); setprop("/ai/models/multiplayer["~i~"]/controls/player-lag", -spectator_offset);
} else { } else {
if (apply_close) { if ((apply_close) and (master)) {
var self = geo.aircraft_position(); var self = geo.aircraft_position();
var x = getprop("/ai/models/multiplayer["~i~"]/position/global-x"); var x = getprop("/ai/models/multiplayer["~i~"]/position/global-x");
var y = getprop("/ai/models/multiplayer["~i~"]/position/global-y"); var y = getprop("/ai/models/multiplayer["~i~"]/position/global-y");
@ -55,21 +55,18 @@ var mpCheck = func() {
} }
var mpInit = func() { var mpInit = func() {
if (!initialised) {
print("initialising the mp lag system"); print("initialising the mp lag system");
initialised = 1;
ls_spect = setlistener("/sim/multiplay/lag/spectator",func { spectator = getprop("/sim/multiplay/lag/spectator")}, 1); ls_spect = setlistener("/sim/multiplay/lag/spectator",func { spectator = getprop("/sim/multiplay/lag/spectator")}, 1);
ls_spctoffset = setlistener("/sim/multiplay/lag/spectator-offset",func { spectator_offset = getprop("/sim/multiplay/lag/spectator-offset")}, 1); ls_spctoffset = setlistener("/sim/multiplay/lag/spectator-offset",func { spectator_offset = getprop("/sim/multiplay/lag/spectator-offset")}, 1);
ls_range = setlistener("/sim/multiplay/lag/range",func { range = getprop("/sim/multiplay/lag/range")}, 1); ls_range = setlistener("/sim/multiplay/lag/range",func { range = getprop("/sim/multiplay/lag/range")}, 1);
ls_offset = setlistener("/sim/multiplay/lag/offset",func { offset = getprop("/sim/multiplay/lag/offset")}, 1); ls_offset = setlistener("/sim/multiplay/lag/offset",func { offset = getprop("/sim/multiplay/lag/offset")}, 1);
ls_close = setlistener("/sim/multiplay/lag/apply-close", func { apply_close = getprop("/sim/multiplay/lag/apply-close")}, 1); ls_close = setlistener("/sim/multiplay/lag/apply-close", func { apply_close = getprop("/sim/multiplay/lag/apply-close")}, 1);
} }
}
var mpClean = func() { var mpClean = func() {
removelistener(ls_spect);
removelistener(ls_spctoffset);
removelistener(ls_range);
removelistener(ls_offset);
removelistener(ls_close);
close = 1; close = 1;
master = 0; master = 0;
} }