ACE3/addons/markers/functions/fnc_onMouseButtonDown.sqf
McDiod fcfe278f7f markers - add setting allowing only marker creator to move (#6734)
* markers - add setting allowing only marker creator to move

* shorten setting display names

* delete some whitespace, superfluous command

* single arg needs no array

* delete some whitespace

* don't save directPlayID default value

* Save array of user placed markers
2019-01-03 13:31:21 -06:00

42 lines
1.2 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: chris579
* Triggered when a mouse button is pressed on the map.
*
* Arguments:
* 0: Map Control the EVH was assigned to <CONTROL>
* 1: Button code <NUMBER>
* 2: Position of x <NUMBER>
* 3: Position of y <NUMBER>
* 4: State of Shift <BOOL>
* 5: State of Ctrl <BOOL>
* 6: State of Alt <BOOL>
*
* Return Value:
* None
*
* Example:
* [CONTROL, 2, 0, 0, true, false, false] call ace_markers_fnc_onMouseButtonDown
*
* Public: No
*/
params ["_ctrlMap", "_button", "_x", "_y", "_shift", "_ctrl", "_alt"];
if (_button != 0 || {!([_shift, _ctrl, _alt] isEqualTo [false, false, true])}) exitWith {};
ctrlMapMouseOver _ctrlMap params [["_type", ""], "_marker"];
if (_type == "marker" && {_marker find "_USER_DEFINED" != -1 && {_marker call FUNC(canMove)}}) then {
_ctrlMap ctrlMapCursor ["Track", "Move"];
private _originalPos = getMarkerPos _marker;
private _originalAlpha = markerAlpha _marker;
if !([QGVAR(markerMoveStarted), [ACE_player, _marker, _originalPos]] call CBA_fnc_localEvent) exitWith {};
GVAR(moving) = true;
_marker setMarkerAlphaLocal 0.5;
[FUNC(movePFH), 0, [_marker, _ctrlMap, _originalPos, _originalAlpha]] call CBA_fnc_addPerFrameHandler;
};