Map Gestures - Improve transmit process (#7646)

* simplify map gestures transmit process

* Update addons/map_gestures/functions/fnc_transmit.sqf

Co-Authored-By: mharis001 <34453221+mharis001@users.noreply.github.com>

* Update addons/map_gestures/functions/fnc_transmit.sqf

Co-Authored-By: mharis001 <34453221+mharis001@users.noreply.github.com>

* Update addons/map_gestures/functions/fnc_transmit.sqf

Co-Authored-By: mharis001 <34453221+mharis001@users.noreply.github.com>

* remove setPlayerOwner call

Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>
This commit is contained in:
Joko 2020-04-19 02:15:12 +02:00 committed by GitHub
parent 4302a944d7
commit ab989d4c34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 19 deletions

View File

@ -8,16 +8,8 @@ if (!hasInterface) exitWith {};
["ace_settingsInitialized", {
if (!GVAR(enabled)) exitWith {};
// This will set QEGVAR(common,playerOwner) var on player objects
[] call EFUNC(common,setPlayerOwner);
GVAR(pointPosition) = [0,0,0];
[QGVAR(syncPos), {
params ["_unit", "_pointPos"];
_unit setVariable [QGVAR(pointPosition), _pointPos];
}] call CBA_fnc_addEventHandler;
GVAR(pointPosition) = [0,0,0];
[{
if (isNull (findDisplay 12)) exitWith {};

View File

@ -28,15 +28,9 @@ if (!GVAR(EnableTransmit) || !visibleMap) exitWith {
[_pfhId] call CBA_fnc_removePerFrameHandler;
};
{
private _owner = _x getVariable [QEGVAR(common,playerOwner), -1];
if (_owner > -1) then {
private _remotePos = _x getVariable [QGVAR(remotePos), [0,0,0]];
if ((_remotePos distance2d GVAR(pointPosition)) > 1) then { // Only transmit when actually moving
[QGVAR(syncPos), [ACE_Player, GVAR(pointPosition)], _owner] call CBA_fnc_ownerEvent;
_x setVariable [QGVAR(remotePos), GVAR(pointPosition)];
};
};
} count ([ACE_player, GVAR(maxRange)] call FUNC(getProximityPlayers));
private _remotePos = ACE_player getVariable [QGVAR(pointPosition), [0, 0, 0]];
if (_remotePos distance2D GVAR(pointPosition) > 1) then { // Only transmit when actually moving
ACE_player setVariable [QGVAR(pointPosition), GVAR(pointPosition), true];
};
END_COUNTER(transmit);