Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map Gestures - Improve transmit process #7646

Merged
merged 5 commits into from
Apr 19, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions addons/map_gestures/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ 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 {};
Expand Down
14 changes: 4 additions & 10 deletions addons/map_gestures/functions/fnc_transmit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);