1
0
Fork 0

little adjustements for the mp patch

This commit is contained in:
janodesbois 2015-06-09 21:12:48 +02:00
parent dabaeea9fa
commit 12af1482e7
3 changed files with 32 additions and 24 deletions

View file

@ -8,15 +8,26 @@ var apply_close = "false";
var master = 0;
var close = 0;
var ls_spect = nil;
var ls_spctoffset = nil;
var ls_range = nil;
var ls_offset = nil;
var ls_close = nil;
# the compensatelag value are used like that by AIMultiplayer.cxx:
#
# 1 : old behaviour, trying to keep the plane without doing prediction
# 2 : predict the plane position in the futur
# 3 : display more in the past to avoid predictions
var mpCheck = func() {
var mpname = getprop("/ai/models/multiplayer["~i~"]/callsign");
if (mpname != nil) {
if (spectator) {
var mpname = getprop("/ai/models/multiplayer["~i~"]/callsign");
if (mpname != nil) {
if (spectator) {
setprop("/ai/models/multiplayer["~i~"]/controls/compensate-lag", 3);
setprop("/ai/models/multiplayer["~i~"]/controls/player-lag", -spectator_offset);
} else {
var lag = offset;
if (apply_close) {
if (apply_close) {
var self = geo.aircraft_position();
var x = getprop("/ai/models/multiplayer["~i~"]/position/global-x");
var y = getprop("/ai/models/multiplayer["~i~"]/position/global-y");
@ -27,13 +38,13 @@ var mpCheck = func() {
setprop("/ai/models/multiplayer["~i~"]/controls/compensate-lag", 1);
} else {
setprop("/ai/models/multiplayer["~i~"]/controls/compensate-lag", 2);
setprop("/ai/models/multiplayer["~i~"]/controls/player-lag", lag);
setprop("/ai/models/multiplayer["~i~"]/controls/player-lag", offset);
}
} else {
setprop("/ai/models/multiplayer["~i~"]/controls/compensate-lag", 1);
}
}
i += 1;
i += 1;
} else {
i = 0;
if (close) close = 0;
@ -45,22 +56,20 @@ var mpCheck = func() {
var mpInit = func() {
print("initialising the mp lag system");
var ls_spect = setlistener("/sim/multiplay/lag/spectator",func { spectator = getprop("/sim/multiplay/lag/spectator")}, 1);
var ls_spctoffset = setlistener("/sim/multiplay/lag/spectator-offset",func { spectator_offset = getprop("/sim/multiplay/lag/spectator-offset")}, 1);
var ls_range = setlistener("/sim/multiplay/lag/range",func { range = getprop("/sim/multiplay/lag/range")}, 1);
var ls_wingmen = setlistener("/sim/multiplay/lag/apply-to-wingmen",func { apply_to_wingmen = getprop("/sim/multiplay/lag/apply-to-wingmen")}, 1);
var ls_offset = setlistener("/sim/multiplay/lag/offset",func { offset = getprop("/sim/multiplay/lag/offset")}, 1);
var ls_close = setlistener("/sim/multiplay/lag/apply-close", func { apply_close = getprop("/sim/multiplay/lag/apply-close")}, 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_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_close = setlistener("/sim/multiplay/lag/apply-close", func { apply_close = getprop("/sim/multiplay/lag/apply-close")}, 1);
}
var mpClean = func() {
i = 0;
spectator = 0;
spectator_offset = 0.5;
range = 3.0;
apply_to_wingmen = 0;
apply_close = 0;
offset = 0.0;
removelistener(ls_spect);
removelistener(ls_spctoffset);
removelistener(ls_range);
removelistener(ls_offset);
removelistener(ls_close);
close = 1;
master = 0;
}
@ -70,9 +79,8 @@ var mpStart = func() {
if (test == nil) {
settimer(mpStart, 2);
} else {
mpInit();
setlistener("/sim/multiplay/lag/master", masterSwitch,1);
}
}
}
var masterSwitch = func() {

View file

@ -83,7 +83,7 @@
<mp-chat-menu>Chat Menu</mp-chat-menu>
<mp-list>Pilot List</mp-list>
<mp-carrier>MPCarrier Selection</mp-carrier>
<lag-adjust>lag options</lag-adjust>
<lag-adjust>Lag Settings</lag-adjust>
<!-- Debug menu -->
<debug>Debug</debug>

View file

@ -13,7 +13,7 @@
<empty><stretch>1</stretch></empty>
<text>
<label>Lag-correction settings</label>
<label>Lag Correction Settings</label>
</text>
<empty><stretch>1</stretch></empty>