ACE3/addons/map_gestures/functions/fnc_transmit.sqf
PabstMirror aeb0614e7e Cleanup map gesture sync / color mapping (#4486)
* Cleanup map gesture sync / color mapping

- Adds ace_common_fnc_setPlayerOwner which syncs player's owner var
- Redo publicVarClient with CBA's ownerEvent
- Remove old ace_settings
- Make color module run globaly
- Ad public ace_map_gestures_fnc_addGroupColorMapping

* fix return
2016-10-27 19:54:58 +02:00

43 lines
1.0 KiB
Plaintext

/*
* 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
*/
#include "script_component.hpp"
BEGIN_COUNTER(transmit);
params ["", "_pfhId"];
if (!visibleMap) then {
call FUNC(endTransmit);
};
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);