From 8a4514f8e74cd99a7f6ed6e0c21bd20b520fdb69 Mon Sep 17 00:00:00 2001
From: commy2 <commy-2@gmx.de>
Date: Tue, 12 Jul 2016 16:16:01 +0200
Subject: [PATCH 1/5] use a function to do gestures

---
 addons/common/XEH_PREP.hpp                    |  1 +
 addons/common/XEH_postInit.sqf                |  4 ++--
 addons/common/functions/fnc_doGesture.sqf     | 24 +++++++++++++++++++
 addons/dragging/functions/fnc_dropObject.sqf  |  2 +-
 addons/dragging/functions/fnc_startDrag.sqf   |  4 +++-
 .../functions/fnc_placeExplosive.sqf          |  2 +-
 .../functions/fnc_setupExplosive.sqf          |  2 +-
 .../explosives/functions/fnc_startDefuse.sqf  |  4 ++--
 addons/finger/functions/fnc_keyPress.sqf      |  2 +-
 addons/gestures/CfgVehicles.hpp               | 12 +++++-----
 addons/gestures/functions/fnc_playSignal.sqf  |  3 +--
 addons/goggles/functions/fnc_clearGlasses.sqf |  2 +-
 addons/interaction/functions/fnc_getDown.sqf  |  2 +-
 .../functions/fnc_passMagazine.sqf            |  2 +-
 addons/interaction/functions/fnc_sendAway.sqf |  2 +-
 .../interaction/functions/fnc_tapShoulder.sqf |  2 +-
 .../functions/fnc_checkTemperature.sqf        |  2 +-
 addons/overheating/functions/fnc_clearJam.sqf |  2 +-
 .../overheating/functions/fnc_swapBarrel.sqf  |  2 +-
 .../functions/fnc_swapBarrelCallback.sqf      |  2 +-
 addons/parachute/functions/fnc_doLanding.sqf  | 18 +++++++++-----
 addons/reload/functions/fnc_checkAmmo.sqf     |  2 +-
 .../reload/functions/fnc_startLinkingBelt.sqf |  2 +-
 .../sandbag/functions/fnc_deployConfirm.sqf   |  2 +-
 addons/sandbag/functions/fnc_pickup.sqf       |  2 +-
 addons/tagging/functions/fnc_tag.sqf          |  2 +-
 26 files changed, 69 insertions(+), 37 deletions(-)
 create mode 100644 addons/common/functions/fnc_doGesture.sqf

diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp
index a66f12615f..ad11cfb447 100644
--- a/addons/common/XEH_PREP.hpp
+++ b/addons/common/XEH_PREP.hpp
@@ -32,6 +32,7 @@ PREP(displayText);
 PREP(displayTextPicture);
 PREP(displayTextStructured);
 PREP(doAnimation);
+PREP(doGesture);
 PREP(dropBackpack);
 PREP(endRadioTransmission);
 PREP(eraseCache);
diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf
index 32588189cb..2c50bf70cd 100644
--- a/addons/common/XEH_postInit.sqf
+++ b/addons/common/XEH_postInit.sqf
@@ -118,6 +118,8 @@ if (isServer) then {
 [QGVAR(setVelocity), {(_this select 0) setVelocity (_this select 1)}] call CBA_fnc_addEventHandler;
 [QGVAR(playMove), {(_this select 0) playMove (_this select 1)}] call CBA_fnc_addEventHandler;
 [QGVAR(playMoveNow), {(_this select 0) playMoveNow (_this select 1)}] call CBA_fnc_addEventHandler;
+[QGVAR(playAction), {(_this select 0) playAction (_this select 1)}] call CBA_fnc_addEventHandler;
+[QGVAR(playActionNow), {(_this select 0) playActionNow (_this select 1)}] call CBA_fnc_addEventHandler;
 [QGVAR(switchMove), {(_this select 0) switchMove (_this select 1)}] call CBA_fnc_addEventHandler;
 [QGVAR(setVectorDirAndUp), {(_this select 0) setVectorDirAndUp (_this select 1)}] call CBA_fnc_addEventHandler;
 [QGVAR(setVanillaHitPointDamage), {(_this select 0) setHitPointDamage (_this select 1)}] call CBA_fnc_addEventHandler;
@@ -406,8 +408,6 @@ GVAR(OldIsCamera) = false;
 
 GVAR(isReloading) = false;
 
-["isNotReloading", {!GVAR(isReloading)}] call FUNC(addCanInteractWithCondition);
-
 ["keyDown", {
     if ((_this select 1) in actionKeys "ReloadMagazine" && {alive ACE_player}) then {
         private _weapon = currentWeapon ACE_player;
diff --git a/addons/common/functions/fnc_doGesture.sqf b/addons/common/functions/fnc_doGesture.sqf
new file mode 100644
index 0000000000..cee117a85b
--- /dev/null
+++ b/addons/common/functions/fnc_doGesture.sqf
@@ -0,0 +1,24 @@
+/*
+ * Author: commy2
+ * Play a gesture.
+ *
+ * Arguments:
+ * 0: Unit <OBJECT>
+ * 1: Animation <STRING>
+ *
+ * Return Value:
+ * None
+ *
+ * Example:
+ * [player, "gestureGo"] call ace_common_fnc_doGesture
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+params ["_unit", "_animation"];
+TRACE_4("params",_unit,_animation);
+
+if (!GVAR(isReloading)) then {
+    [QGVAR(playActionNow), [_unit, _animation], _unit] call CBA_fnc_targetEvent;
+};
diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf
index c70bf90c38..f060c8d088 100644
--- a/addons/dragging/functions/fnc_dropObject.sqf
+++ b/addons/dragging/functions/fnc_dropObject.sqf
@@ -26,7 +26,7 @@ private _inBuilding = [_unit] call FUNC(isObjectOnObject);
 
 if !(_unit getVariable ["ACE_isUnconscious", false]) then {
     // play release animation
-    _unit playAction "released";
+    [_unit, "released"] call EFUNC(common,doGesture);
 };
 
 // prevent collision damage
diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf
index 5ddaa0ede4..8601c628e7 100644
--- a/addons/dragging/functions/fnc_startDrag.sqf
+++ b/addons/dragging/functions/fnc_startDrag.sqf
@@ -39,7 +39,9 @@ _unit selectWeapon primaryWeapon _unit;
 [_unit, _target, true] call EFUNC(common,claim);
 
 // can't play action that depends on weapon if it was added the same frame
-[{_this playActionNow "grabDrag";}, _unit] call CBA_fnc_execNextFrame;
+[{
+	[_this, "grabDrag"] call EFUNC(common,doGesture);
+}, _unit] call CBA_fnc_execNextFrame;
 
 // move a bit closer and adjust direction when trying to pick up a person
 if (_target isKindOf "CAManBase") then {
diff --git a/addons/explosives/functions/fnc_placeExplosive.sqf b/addons/explosives/functions/fnc_placeExplosive.sqf
index 455b768b97..4a3e06df4b 100644
--- a/addons/explosives/functions/fnc_placeExplosive.sqf
+++ b/addons/explosives/functions/fnc_placeExplosive.sqf
@@ -27,7 +27,7 @@ TRACE_7("params",_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificV
 
 private ["_ammo", "_explosive", "_attachedTo", "_magazineTrigger", "_pitch", "_digDistance", "_canDigDown", "_soundEnviron", "_surfaceType"];
 
-_unit playActionNow "PutDown";
+[_unit, "PutDown"] call EFUNC(common,doGesture);
 
 _attachedTo = objNull;
 if (!isNull _setupPlaceholderObject) then {
diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf
index 6dd1094c6a..0897836eb3 100644
--- a/addons/explosives/functions/fnc_setupExplosive.sqf
+++ b/addons/explosives/functions/fnc_setupExplosive.sqf
@@ -185,7 +185,7 @@ GVAR(TweakedAngle) = 0;
             _expSetupVehicle setVariable [QGVAR(Direction), _placeAngle, true];
 
             _unit removeMagazine _magClassname;
-            _unit playActionNow "PutDown";
+            [_unit, "PutDown"] call EFUNC(common,doGesture);
             _unit setVariable [QGVAR(PlantingExplosive), true];
             [{_this setVariable [QGVAR(PlantingExplosive), false]}, _unit, 1.5] call CBA_fnc_waitAndExecute;
 
diff --git a/addons/explosives/functions/fnc_startDefuse.sqf b/addons/explosives/functions/fnc_startDefuse.sqf
index dd991de4ff..99d68a5734 100644
--- a/addons/explosives/functions/fnc_startDefuse.sqf
+++ b/addons/explosives/functions/fnc_startDefuse.sqf
@@ -46,7 +46,7 @@ if (ACE_player != _unit) then {
     if (isPlayer _unit) then {
         [QGVAR(startDefuse), [_unit, _target], _unit] call CBA_fnc_targetEvent;
     } else {
-        _unit playActionNow _actionToPlay;
+        [_unit, _actionToPlay] call EFUNC(common,doGesture);
         _unit disableAI "MOVE";
         _unit disableAI "TARGET";
         _defuseTime = [[_unit] call EFUNC(Common,isEOD), _target] call _fnc_DefuseTime;
@@ -59,7 +59,7 @@ if (ACE_player != _unit) then {
         }, [_unit, _target], _defuseTime] call CBA_fnc_waitAndExecute;
     };
 } else {
-    _unit playActionNow _actionToPlay;
+    [_unit, _actionToPlay] call EFUNC(common,doGesture);
     _isEOD = [_unit] call EFUNC(Common,isEOD);
     _defuseTime = [_isEOD, _target] call _fnc_DefuseTime;
     if (_isEOD || {!GVAR(RequireSpecialist)}) then {
diff --git a/addons/finger/functions/fnc_keyPress.sqf b/addons/finger/functions/fnc_keyPress.sqf
index ec2d7722ad..b9231fb17b 100644
--- a/addons/finger/functions/fnc_keyPress.sqf
+++ b/addons/finger/functions/fnc_keyPress.sqf
@@ -60,6 +60,6 @@ TRACE_1("sending finger to",_sendFingerToPlayers);
 
 [QGVAR(fingered), [ACE_player, _fingerPosASL, _originASL vectorDistance _fingerPosASL], _sendFingerToPlayers] call CBA_fnc_targetEvent;
 
-ACE_player playActionNow "GestureGo";
+[ACE_player, "GestureGo"] call EFUNC(common,doGesture);
 
 true
diff --git a/addons/gestures/CfgVehicles.hpp b/addons/gestures/CfgVehicles.hpp
index d91c6df95e..6eb3990446 100644
--- a/addons/gestures/CfgVehicles.hpp
+++ b/addons/gestures/CfgVehicles.hpp
@@ -14,42 +14,42 @@ class CfgVehicles {
                 class GVAR(Advance) {
                     displayName = CSTRING(Advance);
                     condition = QUOTE(true);
-                    statement = QUOTE(_target playActionNow 'gestureAdvance';);
+                    statement = QUOTE([ARR_2(_target,'gestureAdvance')] call EFUNC(common,doGesture););
                     showDisabled = 1;
                     priority = 1.9;
                 };
                 class GVAR(Go) {
                     displayName = CSTRING(Go);
                     condition = QUOTE(true);
-                    statement = QUOTE(_target playActionNow ([ARR_2('gestureGo','gestureGoB')] select floor random 2););
+                    statement = QUOTE([ARR_2(_target,selectRandom [ARR_2('gestureGo','gestureGoB')])] call EFUNC(common,doGesture););
                     showDisabled = 1;
                     priority = 1.8;
                 };
                 class GVAR(Follow) {
                     displayName = CSTRING(Follow);
                     condition = QUOTE(true);
-                    statement = QUOTE(_target playActionNow 'gestureFollow';);
+                    statement = QUOTE([ARR_2(_target,'gestureFollow')] call EFUNC(common,doGesture););
                     showDisabled = 1;
                     priority = 1.7;
                 };
                 class GVAR(Up) {
                     displayName = CSTRING(Up);
                     condition = QUOTE(true);
-                    statement = QUOTE(_target playActionNow 'gestureUp';);
+                    statement = QUOTE([ARR_2(_target,'gestureUp')] call EFUNC(common,doGesture););
                     showDisabled = 1;
                     priority = 1.5;
                 };
                 class GVAR(CeaseFire) {
                     displayName = CSTRING(CeaseFire);
                     condition = QUOTE(true);
-                    statement = QUOTE(_target playActionNow 'gestureCeaseFire';);
+                    statement = QUOTE([ARR_2(_target,'gestureCeaseFire')] call EFUNC(common,doGesture););
                     showDisabled = 1;
                     priority = 1.3;
                 };
                 class GVAR(Stop) {
                     displayName = CSTRING(Stop);
                     condition = QUOTE(true);
-                    statement = QUOTE(_target playActionNow 'gestureFreeze';); // BI animation - is actualls "stop" in all stances but prone
+                    statement = QUOTE([ARR_2(_target,'gestureFreeze')] call EFUNC(common,doGesture);); // BI animation - is actualls "stop" in all stances but prone
                     showDisabled = 1;
                     priority = 1.2;
                 };
diff --git a/addons/gestures/functions/fnc_playSignal.sqf b/addons/gestures/functions/fnc_playSignal.sqf
index 56c3bceb01..273db82da1 100644
--- a/addons/gestures/functions/fnc_playSignal.sqf
+++ b/addons/gestures/functions/fnc_playSignal.sqf
@@ -17,7 +17,6 @@
 
 TRACE_1("params",_this);
 
-if (EGVAR(common,isReloading)) exitWith {false};
 if (GVAR(showOnInteractionMenu) == 0) exitWith {false};
 if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
 
@@ -34,5 +33,5 @@ private _gesture = if ((_this select [0,2]) == "BI") then {
 };
 
 TRACE_1("playing gesture",_gesture);
-ACE_player playAction _gesture;
+[ACE_player, _gesture] call EFUNC(common,doGesture);
 true
diff --git a/addons/goggles/functions/fnc_clearGlasses.sqf b/addons/goggles/functions/fnc_clearGlasses.sqf
index f1622c8680..b01960527a 100644
--- a/addons/goggles/functions/fnc_clearGlasses.sqf
+++ b/addons/goggles/functions/fnc_clearGlasses.sqf
@@ -27,7 +27,7 @@ _effects set [BROKEN, _broken];
 SETGLASSES(_unit,_effects);
 
 if ((stance _unit != "PRONE") && {primaryWeapon _unit != ""} && {currentWeapon _unit == primaryWeapon _unit}) then {
-    _unit playActionNow "gestureWipeFace";
+    [_unit, "gestureWipeFace"] call EFUNC(common,doGesture);
 };
 
 [{
diff --git a/addons/interaction/functions/fnc_getDown.sqf b/addons/interaction/functions/fnc_getDown.sqf
index af0a9da38c..53a846e1c3 100644
--- a/addons/interaction/functions/fnc_getDown.sqf
+++ b/addons/interaction/functions/fnc_getDown.sqf
@@ -20,7 +20,7 @@
 
 params ["_unit", "_target"];
 
-_unit playActionNow "GestureGo";
+[_unit, "GestureGo"] call EFUNC(common,doGesture);
 
 private "_chance";
 _chance = [0.5, 0.8] select (count weapons _unit > 0);
diff --git a/addons/interaction/functions/fnc_passMagazine.sqf b/addons/interaction/functions/fnc_passMagazine.sqf
index 5016215c39..15a193cd26 100644
--- a/addons/interaction/functions/fnc_passMagazine.sqf
+++ b/addons/interaction/functions/fnc_passMagazine.sqf
@@ -45,7 +45,7 @@ _player removeMagazines _magToPassClassName;
     };
 } foreach _filteredMags;
 
-_player playActionNow "PutDown";
+[_player, "PutDown"] call EFUNC(common,doGesture);
 
 _target addMagazine [_magToPassClassName, _magToPassAmmoCount];
 
diff --git a/addons/interaction/functions/fnc_sendAway.sqf b/addons/interaction/functions/fnc_sendAway.sqf
index c200587f2b..abd4ec50aa 100644
--- a/addons/interaction/functions/fnc_sendAway.sqf
+++ b/addons/interaction/functions/fnc_sendAway.sqf
@@ -20,7 +20,7 @@
 
 params ["_unit"];
 
-_unit playActionNow "GestureGo";
+[_unit, "GestureGo"] call EFUNC(common,doGesture);
 
 private "_chance";
 _chance = [0.5, 0.8] select (count weapons _unit > 0);
diff --git a/addons/interaction/functions/fnc_tapShoulder.sqf b/addons/interaction/functions/fnc_tapShoulder.sqf
index d6621d2c07..3926503746 100644
--- a/addons/interaction/functions/fnc_tapShoulder.sqf
+++ b/addons/interaction/functions/fnc_tapShoulder.sqf
@@ -23,6 +23,6 @@ if (_unit == ACE_player) then {
     addCamShake [4, 0.5, 5];
 };
 
-_unit playActionNow "PutDown";
+[_unit, "PutDown"] call EFUNC(common,doGesture);
 
 [QGVAR(tapShoulder), [_target, _shoulderNum], [_target]] call CBA_fnc_targetEvent;
diff --git a/addons/overheating/functions/fnc_checkTemperature.sqf b/addons/overheating/functions/fnc_checkTemperature.sqf
index 0fb600f83a..c58d14a29d 100644
--- a/addons/overheating/functions/fnc_checkTemperature.sqf
+++ b/addons/overheating/functions/fnc_checkTemperature.sqf
@@ -28,7 +28,7 @@ if (_assistant isEqualTo _gunner) then {
         _action = "Gear";
     };
 };
-_assistant playActionNow _action;
+[_assistant, _action] call EFUNC(common,doGesture);
 
 // Waits a sec before displaying the temperature
 [FUNC(displayTemperature), [_gunner, _weapon], 1.0] call CBA_fnc_waitAndExecute;
diff --git a/addons/overheating/functions/fnc_clearJam.sqf b/addons/overheating/functions/fnc_clearJam.sqf
index 7011385c02..52fdee41a7 100644
--- a/addons/overheating/functions/fnc_clearJam.sqf
+++ b/addons/overheating/functions/fnc_clearJam.sqf
@@ -32,7 +32,7 @@ if (_weapon in _jammedWeapons) then {
             _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction");
         };
 
-        _unit playActionNow _clearJamAction;
+        [_unit, _clearJamAction] call EFUNC(common,doGesture);
         if (_weapon == primaryWeapon _unit) then {
             playSound QGVAR(fixing_rifle);
         } else {
diff --git a/addons/overheating/functions/fnc_swapBarrel.sqf b/addons/overheating/functions/fnc_swapBarrel.sqf
index b904936403..3ad49df7d7 100644
--- a/addons/overheating/functions/fnc_swapBarrel.sqf
+++ b/addons/overheating/functions/fnc_swapBarrel.sqf
@@ -26,7 +26,7 @@ if (stance _gunner != "PRONE") then {
 };
 
 // Barrel dismount gesture
-_gunner playActionNow QGVAR(GestureDismountMuzzle);
+[_gunner, QGVAR(GestureDismountMuzzle)] call EFUNC(common,doGesture);
 playSound "ACE_BarrelSwap";
 
 private _duration = 3.0;
diff --git a/addons/overheating/functions/fnc_swapBarrelCallback.sqf b/addons/overheating/functions/fnc_swapBarrelCallback.sqf
index b2d559d1e2..0e4326cfea 100644
--- a/addons/overheating/functions/fnc_swapBarrelCallback.sqf
+++ b/addons/overheating/functions/fnc_swapBarrelCallback.sqf
@@ -23,7 +23,7 @@ TRACE_3("params",_assistant,_gunner,_weapon);
 
 if (_assistant isEqualTo _gunner) then {
     // Barrel mount gesture
-    _gunner playAction QGVAR(GestureMountMuzzle);
+    [_gunner, QGVAR(GestureMountMuzzle)] call EFUNC(common,doGesture);
     playSound "ACE_BarrelSwap";
 };
 
diff --git a/addons/parachute/functions/fnc_doLanding.sqf b/addons/parachute/functions/fnc_doLanding.sqf
index 213bf10887..a0c71b5dbb 100644
--- a/addons/parachute/functions/fnc_doLanding.sqf
+++ b/addons/parachute/functions/fnc_doLanding.sqf
@@ -14,14 +14,20 @@
  * Public: No
  */
 #include "script_component.hpp"
-private["_unit"];
-_unit = _this select 0;
+
+params ["_unit"];
+
 GVAR(PFH) = false;
+
 [_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call EFUNC(common,doAnimation);
+
 _unit setVariable [QGVAR(chuteIsCut), false, true];
+
 [{
-    if (CBA_missionTime >= ((_this select 0) select 0) + 1) then {
-        ((_this select 0) select 1) playActionNow "Crouch";
-        [(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);
+	(_this select 0) params ["_time", "_unit"];
+
+    if (CBA_missionTime > _time + 1) then {
+        [_unit, "Crouch"] call EFUNC(common,doGesture);
+        [_this select 1] call CALLSTACK(CBA_fnc_removePerFrameHandler);
     };
-}, 1, [CBA_missionTime,_unit]] call CALLSTACK(CBA_fnc_addPerFrameHandler);
+}, 1, [CBA_missionTime, _unit]] call CALLSTACK(CBA_fnc_addPerFrameHandler);
diff --git a/addons/reload/functions/fnc_checkAmmo.sqf b/addons/reload/functions/fnc_checkAmmo.sqf
index 49a1f0728d..8d2289ac8c 100644
--- a/addons/reload/functions/fnc_checkAmmo.sqf
+++ b/addons/reload/functions/fnc_checkAmmo.sqf
@@ -31,7 +31,7 @@ if (count _this > 1) then {
 };
 
 if (_unit == _target) then {
-    _unit playActionNow "Gear";
+    [_unit, "Gear"] call EFUNC(common,doGesture);
 };
 
 [FUNC(displayAmmo), [_target], 1, 0.1] call CBA_fnc_waitAndExecute;
diff --git a/addons/reload/functions/fnc_startLinkingBelt.sqf b/addons/reload/functions/fnc_startLinkingBelt.sqf
index 1590abbfab..a1cc73635d 100644
--- a/addons/reload/functions/fnc_startLinkingBelt.sqf
+++ b/addons/reload/functions/fnc_startLinkingBelt.sqf
@@ -57,7 +57,7 @@ private _onFailure = {
     _player addMagazine _magazine;
 };
 
-_player playActionNow "PutDown";
+[_player, "PutDown"] call EFUNC(common,doGesture);
 
 // Remove the magazine with maximum remaining ammo
 [_player, _magazineType, _maxAmmo] call EFUNC(common,removeSpecificMagazine);
diff --git a/addons/sandbag/functions/fnc_deployConfirm.sqf b/addons/sandbag/functions/fnc_deployConfirm.sqf
index c37e0ed0d9..47b74533a1 100644
--- a/addons/sandbag/functions/fnc_deployConfirm.sqf
+++ b/addons/sandbag/functions/fnc_deployConfirm.sqf
@@ -53,6 +53,6 @@ call EFUNC(interaction,hideMouseHint);
 [_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(common,removeActionEventHandler);
 
 // play animation
-_unit playActionNow "PutDown";
+[_unit, "PutDown"] call EFUNC(common,doGesture);
 
 _unit setVariable [QGVAR(isDeploying), false, true];
diff --git a/addons/sandbag/functions/fnc_pickup.sqf b/addons/sandbag/functions/fnc_pickup.sqf
index fd4560fdec..f7eaca9b72 100644
--- a/addons/sandbag/functions/fnc_pickup.sqf
+++ b/addons/sandbag/functions/fnc_pickup.sqf
@@ -18,7 +18,7 @@
 
 params ["_unit", "_sandbag"];
 
-_unit playActionNow "PutDown";
+[_unit, "PutDown"] call EFUNC(common,doGesture);
 
 _unit setVariable [QGVAR(isUsingSandbag), true];
 
diff --git a/addons/tagging/functions/fnc_tag.sqf b/addons/tagging/functions/fnc_tag.sqf
index 165441f80e..e39b6eed22 100644
--- a/addons/tagging/functions/fnc_tag.sqf
+++ b/addons/tagging/functions/fnc_tag.sqf
@@ -105,7 +105,7 @@ if ( !([ 0.5*TAG_SIZE, 0.5*TAG_SIZE] call _fnc_isOk) ||
 private _vectorDirAndUp = [_surfaceNormal vectorMultiply -1, _v3];
 
 // Everything ok, make the unit create the tag
-_unit playActionNow "PutDown";
+[_unit, "PutDown"] call EFUNC(common,doGesture);
 
 [{
     params ["", "", "", "", "_unit"];

From a0aea441b49ca2837d00b41b250305b87dba07d8 Mon Sep 17 00:00:00 2001
From: PabstMirror <pabstmirror@gmail.com>
Date: Mon, 11 Jul 2016 21:53:02 -0500
Subject: [PATCH 2/5] Fix reload mutex with binocs or mounted

Fix #4088
---
 addons/common/XEH_postInit.sqf | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf
index 2c50bf70cd..d9c90f14f8 100644
--- a/addons/common/XEH_postInit.sqf
+++ b/addons/common/XEH_postInit.sqf
@@ -410,10 +410,13 @@ GVAR(isReloading) = false;
 
 ["keyDown", {
     if ((_this select 1) in actionKeys "ReloadMagazine" && {alive ACE_player}) then {
+        //Ignore mounted (except ffv)
+        if (!(player call CBA_fnc_canUseWeapon)) exitWith {};
         private _weapon = currentWeapon ACE_player;
 
         if (_weapon != "") then {
             private _gesture  = getText (configfile >> "CfgWeapons" >> _weapon >> "reloadAction");
+            if (_gesture == "") exitWith {}; //Ignore weapons with no reload gesture (binoculars)
             private _isLauncher = _weapon isKindOf ["Launcher", configFile >> "CfgWeapons"];
             private _config = ["CfgGesturesMale", "CfgMovesMaleSdr"] select _isLauncher;
             private _duration = getNumber (configfile >> _config >> "States" >> _gesture >> "speed");

From ce72bfd07a93135746812d344951cb72f427742b Mon Sep 17 00:00:00 2001
From: commy2 <commy-2@gmx.de>
Date: Tue, 12 Jul 2016 16:28:36 +0200
Subject: [PATCH 3/5] replace tabs with spaces

---
 addons/dragging/functions/fnc_startDrag.sqf  | 2 +-
 addons/parachute/functions/fnc_doLanding.sqf | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf
index 8601c628e7..cf08074d94 100644
--- a/addons/dragging/functions/fnc_startDrag.sqf
+++ b/addons/dragging/functions/fnc_startDrag.sqf
@@ -40,7 +40,7 @@ _unit selectWeapon primaryWeapon _unit;
 
 // can't play action that depends on weapon if it was added the same frame
 [{
-	[_this, "grabDrag"] call EFUNC(common,doGesture);
+    [_this, "grabDrag"] call EFUNC(common,doGesture);
 }, _unit] call CBA_fnc_execNextFrame;
 
 // move a bit closer and adjust direction when trying to pick up a person
diff --git a/addons/parachute/functions/fnc_doLanding.sqf b/addons/parachute/functions/fnc_doLanding.sqf
index a0c71b5dbb..b80bc44d00 100644
--- a/addons/parachute/functions/fnc_doLanding.sqf
+++ b/addons/parachute/functions/fnc_doLanding.sqf
@@ -24,7 +24,7 @@ GVAR(PFH) = false;
 _unit setVariable [QGVAR(chuteIsCut), false, true];
 
 [{
-	(_this select 0) params ["_time", "_unit"];
+    (_this select 0) params ["_time", "_unit"];
 
     if (CBA_missionTime > _time + 1) then {
         [_unit, "Crouch"] call EFUNC(common,doGesture);

From 404d5b49b4acca5436b4b2584ad80f779f0eea01 Mon Sep 17 00:00:00 2001
From: commy2 <commy-2@gmx.de>
Date: Wed, 13 Jul 2016 10:40:28 +0200
Subject: [PATCH 4/5] add function to read vanilla keybinds

---
 addons/common/XEH_PREP.hpp                    |   1 +
 .../fnc_actionKeysNamesConverted.sqf          | 110 ++++++++++++++++++
 2 files changed, 111 insertions(+)
 create mode 100644 addons/common/functions/fnc_actionKeysNamesConverted.sqf

diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp
index ad11cfb447..0649dcefea 100644
--- a/addons/common/XEH_PREP.hpp
+++ b/addons/common/XEH_PREP.hpp
@@ -1,4 +1,5 @@
 
+PREP(actionKeysNamesConverted);
 PREP(addCanInteractWithCondition);
 PREP(addLineToDebugDraw);
 PREP(addSetting);
diff --git a/addons/common/functions/fnc_actionKeysNamesConverted.sqf b/addons/common/functions/fnc_actionKeysNamesConverted.sqf
new file mode 100644
index 0000000000..d60df89bfb
--- /dev/null
+++ b/addons/common/functions/fnc_actionKeysNamesConverted.sqf
@@ -0,0 +1,110 @@
+/*
+ * Author: commy2
+ * Reports same as actionKeysNames(Array) but in a format processable by "keyDown".
+ *
+ * Arguments:
+ * 0: Action name <STRING>
+ *
+ * Return Value:
+ * Keybinds, format: [DIK, _shift, _ctrl, _alt] <ARRAY>
+ *
+ * Example:
+ * "ReloadMagazine" call ace_common_fnc_actionKeysNamesConverted
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+#define LAST_DIK 250
+#define PLACEHOLDER_PLUS "<PLUS>"
+
+#define LKEYNAME_LSHIFT localize "STR_DIK_LSHIFT"
+#define LKEYNAME_RSHIFT localize "STR_DIK_RSHIFT"
+#define LKEYNAME_LCONTROL localize "STR_DIK_LCONTROL"
+#define LKEYNAME_RCONTROL localize "STR_DIK_RCONTROL"
+#define LKEYNAME_LALT localize "STR_DIK_LMENU"
+#define LKEYNAME_RALT localize "STR_DIK_RMENU"
+
+// stored in ui namespace to force it to be recreated every game start
+// this way we make it work in savegames after a language change
+private _keyTable = uiNamespace getVariable QGVAR(keyNameTable);
+
+if (isNil "_keyTable") then {
+    _keyTable = [];
+    uiNamespace setVariable [QGVAR(keyNameTable), _keyTable];
+
+    for "_i" from 0 to LAST_DIK do {
+        private _keyName = keyName _i;
+
+        // keys are reported as nested strings for god knows why
+        _keyName = _keyName select [1, count _keyName - 2];
+
+        _keyTable pushBack _keyName;
+    };
+};
+
+private _keyCache = uiNamespace getVariable [QGVAR(keyNameCache), locationNull];
+
+if (isNull _keyCache) then {
+    _keyCache = call CBA_fnc_createNamespace;
+    uiNamespace setVariable [QGVAR(keyNameCache), _keyCache];
+};
+
+params [["_action", "", [""]]];
+
+private _keybinds = actionKeysNamesArray _action apply {
+    private _keyName = _x;
+    private _keybind = _keyCache getVariable _keyName;
+
+    if (isNil "_keybind") then {
+        private _key = -1;
+        private _shift = false;
+        private _ctrl = false;
+        private _alt = false;
+
+        // copy, keep original varname for cache
+        private _keyImage = _keyName;
+
+        // handle "+" being a key and the seperator - as first character
+        if ((_keyImage select [0,1]) isEqualTo "+") then {
+            _keyImage = PLACEHOLDER_PLUS + (_keyImage select [1]);
+        };
+
+        // - and as character seperated by "+"
+        _keyImage = [_keyImage, "++", "+" + PLACEHOLDER_PLUS] call CBA_fnc_replace;
+
+        // get single keys (also revert back non-seperator "+" keys)
+        _keyImage = _keyImage splitString "+" apply {
+            [_x, "+"] select (_x isEqualTo PLACEHOLDER_PLUS);
+        };
+
+        // parse single keys
+        {
+            switch (true) do {
+                case (_x in [LKEYNAME_LSHIFT, LKEYNAME_RSHIFT]): {
+                    _shift = true;
+                };
+                case (_x in [LKEYNAME_LCONTROL, LKEYNAME_RCONTROL]): {
+                    _ctrl = true;
+                };
+                case (_x in [LKEYNAME_LALT, LKEYNAME_RALT]): {
+                    _alt = true;
+                };
+                default {
+                    // @todo handle double keys? ("C+R")
+                    // currently only reports last key
+                    // not usable by keyDown by default
+                    _key = _keyTable find _x;
+                };
+            };
+        } forEach _keyImage;
+
+        // cache
+        _keybind = [_key, _shift, _ctrl, _alt];
+        _keyCache setVariable [_keyName, _keybind];
+    };
+
+    _keybind
+};
+
+_keybinds

From cc76ac482a6083f4c0282920d4928fb114c64d88 Mon Sep 17 00:00:00 2001
From: commy2 <commy-2@gmx.de>
Date: Wed, 13 Jul 2016 11:00:31 +0200
Subject: [PATCH 5/5] add priority parameter to doGesture

---
 addons/common/functions/fnc_doGesture.sqf     | 6 +++---
 addons/overheating/XEH_postInit.sqf           | 7 ++-----
 addons/overheating/functions/fnc_clearJam.sqf | 2 +-
 addons/reload/XEH_postInit.sqf                | 7 ++-----
 addons/reload/functions/fnc_checkAmmo.sqf     | 2 +-
 5 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/addons/common/functions/fnc_doGesture.sqf b/addons/common/functions/fnc_doGesture.sqf
index cee117a85b..9805beffc7 100644
--- a/addons/common/functions/fnc_doGesture.sqf
+++ b/addons/common/functions/fnc_doGesture.sqf
@@ -16,9 +16,9 @@
  */
 #include "script_component.hpp"
 
-params ["_unit", "_animation"];
-TRACE_4("params",_unit,_animation);
+params ["_unit", "_animation", ["_priority", 0]];
+TRACE_3("params",_unit,_animation,_priority);
 
-if (!GVAR(isReloading)) then {
+if (!GVAR(isReloading) || {_priority > 0}) then {
     [QGVAR(playActionNow), [_unit, _animation], _unit] call CBA_fnc_targetEvent;
 };
diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf
index bc3dfad795..34390cbe20 100644
--- a/addons/overheating/XEH_postInit.sqf
+++ b/addons/overheating/XEH_postInit.sqf
@@ -3,8 +3,7 @@
 
 if (hasInterface) then {
     // Add keybinds
-    ["ACE3 Weapons", QGVAR(unjamWeapon), localize LSTRING(UnjamWeapon),
-    {
+    ["ACE3 Weapons", QGVAR(unjamWeapon), localize LSTRING(UnjamWeapon), {
         // Conditions: canInteract
         if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
         // Conditions: specific
@@ -14,9 +13,7 @@ if (hasInterface) then {
         // Statement
         [ACE_player, currentMuzzle ACE_player, false] call FUNC(clearJam);
         true
-    },
-    {false},
-    [19, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + R Key
+    }, {false}, [19, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + R Key
 };
 
 ["ace_settingsInitialized", {
diff --git a/addons/overheating/functions/fnc_clearJam.sqf b/addons/overheating/functions/fnc_clearJam.sqf
index 52fdee41a7..4dcdaa0caf 100644
--- a/addons/overheating/functions/fnc_clearJam.sqf
+++ b/addons/overheating/functions/fnc_clearJam.sqf
@@ -32,7 +32,7 @@ if (_weapon in _jammedWeapons) then {
             _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction");
         };
 
-        [_unit, _clearJamAction] call EFUNC(common,doGesture);
+        [_unit, _clearJamAction, 1] call EFUNC(common,doGesture);
         if (_weapon == primaryWeapon _unit) then {
             playSound QGVAR(fixing_rifle);
         } else {
diff --git a/addons/reload/XEH_postInit.sqf b/addons/reload/XEH_postInit.sqf
index b4579a96ee..7a5e17464c 100644
--- a/addons/reload/XEH_postInit.sqf
+++ b/addons/reload/XEH_postInit.sqf
@@ -4,8 +4,7 @@
 if (!hasInterface) exitWith {};
 
 // Add keybinds
-["ACE3 Weapons", QGVAR(checkAmmo), localize LSTRING(checkAmmo),
-{
+["ACE3 Weapons", QGVAR(checkAmmo), localize LSTRING(checkAmmo), {
     // Conditions: canInteract
     if !([ACE_player, vehicle ACE_player, ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false};
     // Conditions: specific
@@ -14,9 +13,7 @@ if (!hasInterface) exitWith {};
     // Statement
     [ACE_player] call FUNC(checkAmmo);
     true
-},
-{false},
-[19, [false, true, false]], false] call CBA_fnc_addKeybind;
+}, {false}, [19, [false, true, false]], false] call CBA_fnc_addKeybind;
 
 [QGVAR(syncAmmo), {
     //To propagate the setAmmo change, do it on all clients
diff --git a/addons/reload/functions/fnc_checkAmmo.sqf b/addons/reload/functions/fnc_checkAmmo.sqf
index 8d2289ac8c..baa0754f80 100644
--- a/addons/reload/functions/fnc_checkAmmo.sqf
+++ b/addons/reload/functions/fnc_checkAmmo.sqf
@@ -31,7 +31,7 @@ if (count _this > 1) then {
 };
 
 if (_unit == _target) then {
-    [_unit, "Gear"] call EFUNC(common,doGesture);
+    [_unit, "Gear", 1] call EFUNC(common,doGesture);
 };
 
 [FUNC(displayAmmo), [_target], 1, 0.1] call CBA_fnc_waitAndExecute;