little adjustements for the mp patch
This commit is contained in:
parent
dabaeea9fa
commit
12af1482e7
3 changed files with 32 additions and 24 deletions
|
@ -8,15 +8,26 @@ var apply_close = "false";
|
||||||
var master = 0;
|
var master = 0;
|
||||||
var close = 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 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) {
|
||||||
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 {
|
||||||
var lag = offset;
|
if (apply_close) {
|
||||||
if (apply_close) {
|
|
||||||
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");
|
||||||
|
@ -27,13 +38,13 @@ var mpCheck = func() {
|
||||||
setprop("/ai/models/multiplayer["~i~"]/controls/compensate-lag", 1);
|
setprop("/ai/models/multiplayer["~i~"]/controls/compensate-lag", 1);
|
||||||
} else {
|
} else {
|
||||||
setprop("/ai/models/multiplayer["~i~"]/controls/compensate-lag", 2);
|
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 {
|
} else {
|
||||||
setprop("/ai/models/multiplayer["~i~"]/controls/compensate-lag", 1);
|
setprop("/ai/models/multiplayer["~i~"]/controls/compensate-lag", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i += 1;
|
i += 1;
|
||||||
} else {
|
} else {
|
||||||
i = 0;
|
i = 0;
|
||||||
if (close) close = 0;
|
if (close) close = 0;
|
||||||
|
@ -45,22 +56,20 @@ var mpCheck = func() {
|
||||||
|
|
||||||
var mpInit = func() {
|
var mpInit = func() {
|
||||||
print("initialising the mp lag system");
|
print("initialising the mp lag system");
|
||||||
var 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);
|
||||||
var 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);
|
||||||
var 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);
|
||||||
var ls_wingmen = setlistener("/sim/multiplay/lag/apply-to-wingmen",func { apply_to_wingmen = getprop("/sim/multiplay/lag/apply-to-wingmen")}, 1);
|
ls_offset = setlistener("/sim/multiplay/lag/offset",func { offset = getprop("/sim/multiplay/lag/offset")}, 1);
|
||||||
var 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 ls_close = setlistener("/sim/multiplay/lag/apply-close", func { apply_close = getprop("/sim/multiplay/lag/apply-close")}, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var mpClean = func() {
|
var mpClean = func() {
|
||||||
i = 0;
|
removelistener(ls_spect);
|
||||||
spectator = 0;
|
removelistener(ls_spctoffset);
|
||||||
spectator_offset = 0.5;
|
removelistener(ls_range);
|
||||||
range = 3.0;
|
removelistener(ls_offset);
|
||||||
apply_to_wingmen = 0;
|
removelistener(ls_close);
|
||||||
apply_close = 0;
|
|
||||||
offset = 0.0;
|
|
||||||
close = 1;
|
close = 1;
|
||||||
master = 0;
|
master = 0;
|
||||||
}
|
}
|
||||||
|
@ -70,9 +79,8 @@ var mpStart = func() {
|
||||||
if (test == nil) {
|
if (test == nil) {
|
||||||
settimer(mpStart, 2);
|
settimer(mpStart, 2);
|
||||||
} else {
|
} else {
|
||||||
mpInit();
|
|
||||||
setlistener("/sim/multiplay/lag/master", masterSwitch,1);
|
setlistener("/sim/multiplay/lag/master", masterSwitch,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var masterSwitch = func() {
|
var masterSwitch = func() {
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
<mp-chat-menu>Chat Menu</mp-chat-menu>
|
<mp-chat-menu>Chat Menu</mp-chat-menu>
|
||||||
<mp-list>Pilot List</mp-list>
|
<mp-list>Pilot List</mp-list>
|
||||||
<mp-carrier>MPCarrier Selection</mp-carrier>
|
<mp-carrier>MPCarrier Selection</mp-carrier>
|
||||||
<lag-adjust>lag options</lag-adjust>
|
<lag-adjust>Lag Settings</lag-adjust>
|
||||||
|
|
||||||
<!-- Debug menu -->
|
<!-- Debug menu -->
|
||||||
<debug>Debug</debug>
|
<debug>Debug</debug>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<empty><stretch>1</stretch></empty>
|
<empty><stretch>1</stretch></empty>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<label>Lag-correction settings</label>
|
<label>Lag Correction Settings</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<empty><stretch>1</stretch></empty>
|
<empty><stretch>1</stretch></empty>
|
||||||
|
|
Loading…
Reference in a new issue