Merge branch 'master' into medical-jip-fixes

Conflicts:
	addons/medical/CfgVehicles.hpp
This commit is contained in:
Glowbal 2015-03-22 22:35:32 +01:00
commit df43b7fd2d
5 changed files with 24 additions and 6 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

@ -48,8 +48,8 @@ if (_type in _initializedClasses) exitWith {};
_initializedClasses pushBack _type;
GVAR(initializedClasses_carry) = _initializedClasses;
_carryAction = [QGVAR(drag), localize "STR_ACE_Dragging_Carry", "", {[_player, _target] call FUNC(carryObject)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction);
_dropAction = [QGVAR(drop), localize "STR_ACE_Dragging_Drop", "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction);
_carryAction = [QGVAR(carry), localize "STR_ACE_Dragging_Carry", "", {[_player, _target] call FUNC(carryObject)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction);
_dropAction = [QGVAR(drop_carry), localize "STR_ACE_Dragging_Drop", "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction);
[_type, 0, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass);
[_type, 0, ["ACE_MainActions"], _dropAction] call EFUNC(interact_menu,addActionToClass);
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);

View File

@ -52,4 +52,4 @@ _dragAction = [QGVAR(drag), localize "STR_ACE_Dragging_Drag", "", {[_player, _ta
_dropAction = [QGVAR(drop), localize "STR_ACE_Dragging_Drop", "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}] call EFUNC(interact_menu,createAction);
[_type, 0, ["ACE_MainActions"], _dragAction] call EFUNC(interact_menu,addActionToClass);
[_type, 0, ["ACE_MainActions"], _dropAction] call EFUNC(interact_menu,addActionToClass);
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);

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,17 @@ _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;
// drop if in timeout
private "_draggedObject";
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
if (!isNull _draggedObject) exitWith {
[_unit, _draggedObject] call FUNC(dropObject);
};
// re-enable everything
_unit setVariable [QGVAR(isDragging), false, true];
};
// unit is ready to start dragging