From fe10dd0786cac55e007edf6d3eec35dc5e4e4e54 Mon Sep 17 00:00:00 2001 From: Phyma Date: Fri, 2 Jun 2017 12:42:33 +0200 Subject: [PATCH 1/8] Fix to move items up and down --- addons/dragging/functions/fnc_carryObject.sqf | 1 + addons/dragging/functions/fnc_dropObject_carry.sqf | 5 +++++ addons/dragging/functions/fnc_handleScrollWheel.sqf | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index 985f3ddab6a..fdd5c946716 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -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, [0, 0, 0]]; // attach object _target attachTo [_unit, _position]; diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index c3521bbed00..8256c77cf59 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -31,6 +31,11 @@ private _inBuilding = [_unit] call FUNC(isObjectOnObject); // release object detach _target; +// Set to default value +_parentConfig = [_target] call CBA_fnc_getObjectConfig; +_defaultPos = getArray(_parentConfig >> QGVAR(carryPosition)); +_target setVariable [QGVAR(carryPosition), _defaultPos, true]; + // 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 { diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index e3a30ea9e04..eb77cac7db4 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -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]; From 65480f18f3e0fe467192efa4bf49a66175d61eb2 Mon Sep 17 00:00:00 2001 From: Phyma Date: Fri, 2 Jun 2017 12:43:55 +0200 Subject: [PATCH 2/8] Fixed private --- addons/dragging/functions/fnc_dropObject_carry.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index 8256c77cf59..733581c899a 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -32,8 +32,8 @@ private _inBuilding = [_unit] call FUNC(isObjectOnObject); detach _target; // Set to default value -_parentConfig = [_target] call CBA_fnc_getObjectConfig; -_defaultPos = getArray(_parentConfig >> QGVAR(carryPosition)); +private _parentConfig = [_target] call CBA_fnc_getObjectConfig; +private _defaultPos = getArray(_parentConfig >> QGVAR(carryPosition)); _target setVariable [QGVAR(carryPosition), _defaultPos, true]; // fix anim when aborting carrying persons From 1e9bba21baa2fbedce1265d11a8f5cec0f3cb2e9 Mon Sep 17 00:00:00 2001 From: Phyma Date: Fri, 2 Jun 2017 12:47:22 +0200 Subject: [PATCH 3/8] Fixed public bug --- addons/dragging/functions/fnc_carryObject.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index fdd5c946716..f9fb421c04a 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -39,7 +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, [0, 0, 0]]; + _target setVariable [QGVAR(carryPosition), _position, true]; // attach object _target attachTo [_unit, _position]; From 9049792eadab6f3aaf93bc7e3fa7b595f282da6c Mon Sep 17 00:00:00 2001 From: Phyma Date: Sat, 3 Jun 2017 10:04:46 +0200 Subject: [PATCH 4/8] Inserted Pabst solution --- addons/dragging/functions/fnc_carryObject.sqf | 1 - addons/dragging/functions/fnc_dropObject_carry.sqf | 5 ----- addons/dragging/functions/fnc_handleScrollWheel.sqf | 8 +++++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index f9fb421c04a..985f3ddab6a 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -39,7 +39,6 @@ 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]; diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index 733581c899a..c3521bbed00 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -31,11 +31,6 @@ 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]; - // 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 { diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index eb77cac7db4..2cba626a41e 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -30,15 +30,17 @@ private _carriedItem = _unit getVariable [QGVAR(carriedObject), objNull]; //disabled for persons if (_carriedItem isKindOf "CAManBase") exitWith {false}; -private _position = _carriedItem getVariable [QGVAR(carryPosition), [0, 0, 0]]; +private _position = getPosATL _carriedItem; 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 setVariable [QGVAR(carryPosition), _position, [0,0,0]]; -_carriedItem attachTo [_unit, _position]; +private _positionChange = _position vectorDiff (getPosATL _carriedItem); +private _selectionPosition = _unit worldToModel (ASLtoAGL getPosWorld _carriedItem); +_selectionPosition = _selectionPosition vectorAdd _positionChange; +_carriedItem attachTo [_unit, _selectionPosition]; //reset the carry direction private _direction = _carriedItem getVariable [QGVAR(carryDirection), 0]; From a6490d93d4545022ae561a2daa59c6eec88ffe2a Mon Sep 17 00:00:00 2001 From: Phyma Date: Sat, 3 Jun 2017 10:05:44 +0200 Subject: [PATCH 5/8] Remove extra space --- addons/dragging/functions/fnc_handleScrollWheel.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index 2cba626a41e..de8f170d8c1 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -30,7 +30,7 @@ private _carriedItem = _unit getVariable [QGVAR(carriedObject), objNull]; //disabled for persons if (_carriedItem isKindOf "CAManBase") exitWith {false}; -private _position = getPosATL _carriedItem; +private _position = getPosATL _carriedItem; private _maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2; _position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight]; From 1e809b87df90cf39ea646052e8d06d71a9ca6347 Mon Sep 17 00:00:00 2001 From: Phyma Date: Sun, 4 Jun 2017 12:14:38 +0200 Subject: [PATCH 6/8] Fixed request + added author --- AUTHORS.txt | 1 + addons/dragging/functions/fnc_handleScrollWheel.sqf | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 401722e05ca..2ebcec90883 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -103,6 +103,7 @@ nomisum OnkelDisMaster oscarmolinadev PaxJaromeMalues +Phyma pokertour Professor rakowozz diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index de8f170d8c1..9362bcba73f 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -37,7 +37,9 @@ _position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) // move up/down object and reattach at current position detach _carriedItem; -private _positionChange = _position vectorDiff (getPosATL _carriedItem); + +// Uses this method of selecting position because setATL dosen't work on dedicated server +private _positionChange = _position vectorDiff (getPosATL _carriedItem); private _selectionPosition = _unit worldToModel (ASLtoAGL getPosWorld _carriedItem); _selectionPosition = _selectionPosition vectorAdd _positionChange; _carriedItem attachTo [_unit, _selectionPosition]; From 2567ca286eca75dc2ce7d09630bafb77ae4b7a6e Mon Sep 17 00:00:00 2001 From: Phyma Date: Sun, 4 Jun 2017 19:38:01 +0200 Subject: [PATCH 7/8] Fixed to correct comment --- addons/dragging/functions/fnc_handleScrollWheel.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index 9362bcba73f..34e29dc8485 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -38,7 +38,7 @@ _position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) // move up/down object and reattach at current position detach _carriedItem; -// Uses this method of selecting position because setATL dosen't work on dedicated server +// Uses this method of selecting position because on dedicated server setATL doesn't work when object is not local private _positionChange = _position vectorDiff (getPosATL _carriedItem); private _selectionPosition = _unit worldToModel (ASLtoAGL getPosWorld _carriedItem); _selectionPosition = _selectionPosition vectorAdd _positionChange; From 6b550ff842a5be9c148d0c73426667041f1dd537 Mon Sep 17 00:00:00 2001 From: Phyma Date: Sun, 4 Jun 2017 19:45:34 +0200 Subject: [PATCH 8/8] Tweeked comment again --- addons/dragging/functions/fnc_handleScrollWheel.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index 34e29dc8485..f82478d5319 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -38,7 +38,7 @@ _position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) // move up/down object and reattach at current position detach _carriedItem; -// Uses this method of selecting position because on dedicated server setATL doesn't work when object is not local +// Uses this method of selecting position because setPosATL did not have immediate effect private _positionChange = _position vectorDiff (getPosATL _carriedItem); private _selectionPosition = _unit worldToModel (ASLtoAGL getPosWorld _carriedItem); _selectionPosition = _selectionPosition vectorAdd _positionChange;