Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dragging - Fix dragging breaking via keybind #10261

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions addons/dragging/functions/fnc_carryObject.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions addons/dragging/functions/fnc_dragObject.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion addons/dragging/functions/fnc_startCarryLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions addons/dragging/functions/fnc_startCarryPFH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions addons/dragging/functions/fnc_startDragLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions addons/dragging/functions/fnc_startDragPFH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down