Dragging - Fix dragging breaking via keybind (#10261)

Fixed dragging breaking via keybind
This commit is contained in:
johnb432 2024-08-27 06:36:07 +02:00 committed by GitHub
parent db7b78c068
commit 3b10396d3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 14 deletions

View File

@ -48,9 +48,6 @@ if (_target isKindOf "CAManBase") then {
[QEGVAR(common,setDir), [_target, _direction], _target] call CBA_fnc_targetEvent;
_unit setVariable [QGVAR(isCarrying), true, true];
_unit setVariable [QGVAR(carriedObject), _target, true];
// Add drop action
_unit setVariable [QGVAR(releaseActionID), [
_unit, "DefaultAction",

View File

@ -49,9 +49,6 @@ if (_target isKindOf "CAManBase") then {
[_target, "AinjPpneMrunSnonWnonDb_still", 0] call EFUNC(common,doAnimation);
};
_unit setVariable [QGVAR(isDragging), true, true];
_unit setVariable [QGVAR(draggedObject), _target, true];
// Add drop action
GVAR(unit) = _unit;

View File

@ -82,7 +82,7 @@ if (_target isKindOf "CAManBase") then {
// Prevents dragging and carrying at the same time
_unit setVariable [QGVAR(isCarrying), true, true];
// Required for aborting animation
// Required for aborting (animation & keybind)
_unit setVariable [QGVAR(carriedObject), _target, true];
[LINKFUNC(startCarryPFH), 0.2, [_unit, _target, _timer]] call CBA_fnc_addPerFrameHandler;

View File

@ -53,10 +53,9 @@ if (_target isKindOf "CAManBase") then {
// Timeout: Drop target. CBA_missionTime, because anim length is linked to ingame time
if (CBA_missionTime > _timeOut) exitWith {
TRACE_4("timeout",_unit,_target,_timeOut,CBA_missionTime);
_idPFH call CBA_fnc_removePerFrameHandler;
[_unit, _target] call FUNC(dropObject_carry);
private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
[_unit, _carriedObject] call FUNC(dropObject_carry);
_idPFH call CBA_fnc_removePerFrameHandler;
};
// Wait for the unit to stand up

View File

@ -99,6 +99,9 @@ if (_target isKindOf "CAManBase") then {
// Prevents dragging and carrying at the same time
_unit setVariable [QGVAR(isDragging), true, true];
// Required for aborting (keybind)
_unit setVariable [QGVAR(draggedObject), _target, true];
[LINKFUNC(startDragPFH), 0.2, [_unit, _target, CBA_missionTime + 5]] call CBA_fnc_addPerFrameHandler;
// Disable collisions by setting the physx mass to almost zero

View File

@ -43,11 +43,9 @@ if (!alive _target || {_unit distance _target > 10}) exitWith {
// Timeout: Drop target. CBA_missionTime, because anim length is linked to ingame time
if (CBA_missionTime > _timeOut) exitWith {
TRACE_4("timeout",_unit,_target,_timeOut,CBA_missionTime);
_idPFH call CBA_fnc_removePerFrameHandler;
[_unit, _target] call FUNC(dropObject);
// Drop if in timeout
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
[_unit, _draggedObject] call FUNC(dropObject);
_idPFH call CBA_fnc_removePerFrameHandler;
};
// Unit is ready to start dragging