diff --git a/addons/dragging/functions/fnc_handleAnimChanged.sqf b/addons/dragging/functions/fnc_handleAnimChanged.sqf index b5eb4d4d8f..91fa3d681b 100644 --- a/addons/dragging/functions/fnc_handleAnimChanged.sqf +++ b/addons/dragging/functions/fnc_handleAnimChanged.sqf @@ -13,7 +13,9 @@ if (_unit getVariable [QGVAR(isDragging), false]) then { private "_draggedObject"; _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; - [_unit, _draggedObject] call FUNC(dropObject); + if (!isNull _draggedObject) then { + [_unit, _draggedObject] call FUNC(dropObject); + }; }; }; @@ -25,7 +27,9 @@ if (_unit getVariable [QGVAR(isCarrying), false]) then { private "_carriedObject"; _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; - [_unit, _carriedObject] call FUNC(dropObject_carry); + if (!isNull _carriedObject) then { + [_unit, _carriedObject] call FUNC(dropObject_carry); + }; }; }; diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf index 1e286fb4a4..07ed7e5a90 100644 --- a/addons/dragging/functions/fnc_startDrag.sqf +++ b/addons/dragging/functions/fnc_startDrag.sqf @@ -40,4 +40,7 @@ _unit selectWeapon primaryWeapon _unit; // can't play action that depends on weapon if it was added the same frame [{_this playActionNow "grabDrag";}, _unit] call EFUNC(common,execNextFrame); +// prevents draging and carrying at the same time +_unit setVariable [QGVAR(isDragging), true, true]; + [FUNC(startDragPFH), 0.2, [_unit, _target, time + 5]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/dragging/functions/fnc_startDragPFH.sqf b/addons/dragging/functions/fnc_startDragPFH.sqf index b6515aa2d9..5c2aced5ef 100644 --- a/addons/dragging/functions/fnc_startDragPFH.sqf +++ b/addons/dragging/functions/fnc_startDragPFH.sqf @@ -10,6 +10,9 @@ _timeOut = _this select 0 select 2; // timeout. Do nothing. Quit. time, because anim length is linked to ingame time. if (time > _timeOut) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; + + // re-enable everything + _unit setVariable [QGVAR(isDragging), false, true]; }; // unit is ready to start dragging