Skip to content
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
24 changes: 21 additions & 3 deletions addons/dragging/functions/fnc_setCarryable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Arguments:
* 0: Object <OBJECT>
* 1: True to enable carrying, false to disable <BOOL>
* 1: True to enable carrying, false to disable <BOOL> (default: false)
* 2: Position offset for attachTo command <ARRAY> (default: [0, 1, 1])
* 3: Direction in degrees to rotate the object after attachTo <NUMBER> (default: 0)
* 4: Override weight limit <BOOL> (default: false)
Expand All @@ -14,12 +14,28 @@
* None
*
* Example:
* [cursorTarget, true, [0, 1, 1], 0, false] call ace_dragging_fnc_setCarryable;
* [cursorTarget, true, [0, 1, 1], 0, false] call ace_dragging_fnc_setCarryable
*
* Public: Yes
*/

params ["_object", "_enableCarry", "_position", "_direction", ["_ignoreWeightCarry", false, [false]]];
params [
["_object", objNull, [objNull]],
["_enableCarry", false, [false]],
"_position",
"_direction",
["_ignoreWeightCarry", false, [false]]
];

if (isNull _object) exitWith {};

if (!isNil "_position" && {!(_position isEqualType []) || {!(_position isEqualTypeArray [0, 0, 0])}}) exitWith {
ERROR_2("setCarryable: Bad position parameter [%1] for [%2], should be a 3D position or nil",_position,_object);
};

if (!isNil "_direction" && {!(_direction isEqualType 0)}) exitWith {
ERROR_2("setCarryable: Bad direction parameter [%1] for [%2], should be a number or nil",_direction,_object);
};

if (isNil "_position") then {
_position = _object getVariable [QGVAR(carryPosition), [0, 1, 1]];
Expand Down Expand Up @@ -78,3 +94,5 @@ private _dropAction = [

[_type, 0, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass);
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);

nil // return
28 changes: 23 additions & 5 deletions addons/dragging/functions/fnc_setDraggable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,37 @@
*
* Arguments:
* 0: Object <OBJECT>
* 1: True to enable dragging, false to disable <BOOL>
* 2: Position offset for attachTo command (optional; default: [0, 1.5, 0]) <ARRAY>
* 3: Direction in degrees to rotate the object after attachTo (optional; default: 0) <NUMBER>
* 1: True to enable dragging, false to disable <BOOL> (default: false)
* 2: Position offset for attachTo command <ARRAY> (default: [0, 1.5, 0])
* 3: Direction in degrees to rotate the object after attachTo <NUMBER> (default: 0)
* 4: Override weight limit <BOOL> (default: false)
*
* Return Value:
* None
*
* Example:
* [cursorTarget, true, [0, 0, 0], 0, false] call ace_dragging_fnc_setDraggable;
* [cursorTarget, true, [0, 0, 0], 0, false] call ace_dragging_fnc_setDraggable
*
* Public: Yes
*/

params ["_object", "_enableDrag", "_position", "_direction", ["_ignoreWeightDrag", false, [false]]];
params [
["_object", objNull, [objNull]],
["_enableDrag", false, [false]],
"_position",
"_direction",
["_ignoreWeightDrag", false, [false]]
];

if (isNull _object) exitWith {};

if (!isNil "_position" && {!(_position isEqualType []) || {!(_position isEqualTypeArray [0, 0, 0])}}) exitWith {
ERROR_2("setDraggable: Bad position parameter [%1] for [%2], should be a 3D position or nil",_position,_object);
};

if (!isNil "_direction" && {!(_direction isEqualType 0)}) exitWith {
ERROR_2("setDraggable: Bad direction parameter [%1] for [%2], should be a number or nil",_direction,_object);
};

if (isNil "_position") then {
_position = _object getVariable [QGVAR(dragPosition), [0, 1.5, 0]];
Expand Down Expand Up @@ -78,3 +94,5 @@ private _dropAction = [

[_type, 0, ["ACE_MainActions"], _dragAction] call EFUNC(interact_menu,addActionToClass);
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);

nil // return