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

Raise lower carry object #5234

Merged
merged 8 commits into from
Jun 4, 2017
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions addons/dragging/functions/fnc_carryObject.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ if (_target isKindOf "CAManBase") then {
private _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2);

_position = _position vectorAdd [0, 0, _offset];
_target setVariable [QGVAR(carryPosition), _position, true];

// attach object
_target attachTo [_unit, _position];
Expand Down
5 changes: 5 additions & 0 deletions addons/dragging/functions/fnc_dropObject_carry.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ private _inBuilding = [_unit] call FUNC(isObjectOnObject);
// release object
detach _target;

// Set to default value
private _parentConfig = [_target] call CBA_fnc_getObjectConfig;
private _defaultPos = getArray(_parentConfig >> QGVAR(carryPosition));
_target setVariable [QGVAR(carryPosition), _defaultPos, true];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks ace_dragging_fnc_setCarryable because the object has no config, so it stores []


// fix anim when aborting carrying persons
if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS}) then {
if (vehicle _unit == _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
Expand Down
6 changes: 3 additions & 3 deletions addons/dragging/functions/fnc_handleScrollWheel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ private _carriedItem = _unit getVariable [QGVAR(carriedObject), objNull];
//disabled for persons
if (_carriedItem isKindOf "CAManBase") exitWith {false};

private _position = getPosATL _carriedItem;
private _position = _carriedItem getVariable [QGVAR(carryPosition), [0, 0, 0]];
private _maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2;

_position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight];

// move up/down object and reattach at current position
detach _carriedItem;
_carriedItem setPosATL _position;
_carriedItem attachTo [_unit];
_carriedItem setVariable [QGVAR(carryPosition), _position, [0,0,0]];
_carriedItem attachTo [_unit, _position];

//reset the carry direction
private _direction = _carriedItem getVariable [QGVAR(carryDirection), 0];
Expand Down