ACE3/addons/map_gestures/functions/fnc_transmit.sqf

43 lines
1.0 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
/*
2015-08-10 06:45:43 +00:00
* Author: Dslyecxi, MikeMatrix
* Transmit PFH
*
* Arguments:
* 0: Arguments <ARRAY>
* 1: PFH ID <NUMBER>
*
* Return Value:
* Return description <TYPE>
*
* Example:
* [[], 2] call ace_map_gestures_fnc_transmit
*
* Public: No
*/
BEGIN_COUNTER(transmit);
params ["", "_pfhId"];
if (!visibleMap) then {
call FUNC(endTransmit);
2015-08-24 15:28:08 +00:00
};
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));
END_COUNTER(transmit);