From c39992199a39517de26d13ace9d0e3a4d721643a Mon Sep 17 00:00:00 2001 From: LachlanSneddon Date: Sun, 14 Jun 2020 08:51:47 +1200 Subject: [PATCH] Dragging - Add Keybind for Carry (#7746) * add carry keybind * Corrected canCarry Check * Removed 'False' in key up parameter * removed newline --- addons/dragging/XEH_postInit.sqf | 24 ++++++++++++++++++++++-- addons/dragging/stringtable.xml | 3 +++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/addons/dragging/XEH_postInit.sqf b/addons/dragging/XEH_postInit.sqf index f652162225..dd782eddb2 100644 --- a/addons/dragging/XEH_postInit.sqf +++ b/addons/dragging/XEH_postInit.sqf @@ -53,6 +53,26 @@ if (isNil "ACE_maxWeightCarry") then { [ACE_player, _cursor] call FUNC(startDrag); false -}, { +}, {}, [-1, [false, false, false]]] call CBA_fnc_addKeybind; // UNBOUND + +["ACE3 Common", QGVAR(carry), (localize LSTRING(CarryKeybind)), { + if (!alive ACE_player) exitWith {false}; + if !([ACE_player, objNull, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false}; + + // If we are drag/carrying something right now then just drop it: + if (ACE_player getVariable [QGVAR(isDragging), false]) exitWith { + [ACE_player, ACE_player getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject); + false + }; + if (ACE_player getVariable [QGVAR(isCarrying), false]) exitWith { + [ACE_player, ACE_player getVariable [QGVAR(carriedObject), objNull]] call FUNC(dropObject_carry); + false + }; + + private _cursor = cursorObject; + if ((isNull _cursor) || {(_cursor distance ACE_player) > 2.6}) exitWith {false}; + if (!([ACE_player, _cursor] call FUNC(canCarry))) exitWith {false}; + + [ACE_player, _cursor] call FUNC(startCarry); false -}, [-1, [false, false, false]]] call CBA_fnc_addKeybind; // UNBOUND +}, {}, [-1, [false, false, false]]] call CBA_fnc_addKeybind; // UNBOUND diff --git a/addons/dragging/stringtable.xml b/addons/dragging/stringtable.xml index 4dc245d98e..31635ed489 100644 --- a/addons/dragging/stringtable.xml +++ b/addons/dragging/stringtable.xml @@ -52,6 +52,9 @@ 拖拉/放开物品 Objeyi Sürükle/Bırak + + Carry/Release Object + Item too heavy Gegenstand ist zu schwer