fix: could drag and carry object at the same time

This commit is contained in:
commy2 2015-03-22 17:12:14 +01:00
parent c243513227
commit 11bb1a050a
3 changed files with 12 additions and 2 deletions

View File

@ -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);
};
};
};

View File

@ -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;

View File

@ -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