From 2c05db3ffb0a7eb2730a64b1fbe43432643ce8c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= <nicolas.d.badano@gmail.com>
Date: Fri, 20 Feb 2015 02:04:00 -0300
Subject: [PATCH] Create an interaction point for the current weapon

---
 addons/interact_menu/functions/fnc_renderMenu.sqf | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf
index 91104d9c6b..1c04221db8 100644
--- a/addons/interact_menu/functions/fnc_renderMenu.sqf
+++ b/addons/interact_menu/functions/fnc_renderMenu.sqf
@@ -17,7 +17,14 @@ if((count _this) > 4) then {
     if(typeName (_actionData select 2) == "ARRAY") then {
         _pos = _object modelToWorld (_actionData select 2);
     } else {
-        _pos = _object modelToWorld (_object selectionPosition (_actionData select 2));
+        if ((_actionData select 2) == "weapon") then {
+            // Craft a suitable position for weapon interaction
+            _weaponDir = _object weaponDirection currentWeapon _object;
+            _ref = _weaponDir call EFUNC(common,createOrthonormalReference);
+            _pos = (_object modelToWorld (_object selectionPosition "righthand")) vectorAdd ((_ref select 2) vectorMultiply 0.1);
+        } else {
+            _pos = _object modelToWorld (_object selectionPosition (_actionData select 2));
+        };
     };
 };
 _cursorScreenPos = (positionCameraToWorld [0, 0, 0]);