diff --git a/addons/dragging/functions/fnc_setCarryable.sqf b/addons/dragging/functions/fnc_setCarryable.sqf index 60b9854f41..f20197769e 100644 --- a/addons/dragging/functions/fnc_setCarryable.sqf +++ b/addons/dragging/functions/fnc_setCarryable.sqf @@ -5,7 +5,7 @@ * * Arguments: * 0: Object - * 1: True to enable carrying, false to disable + * 1: True to enable carrying, false to disable (default: false) * 2: Position offset for attachTo command (default: [0, 1, 1]) * 3: Direction in degrees to rotate the object after attachTo (default: 0) * 4: Override weight limit (default: false) @@ -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]]; @@ -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 diff --git a/addons/dragging/functions/fnc_setDraggable.sqf b/addons/dragging/functions/fnc_setDraggable.sqf index e024ec5be2..34f7689e52 100644 --- a/addons/dragging/functions/fnc_setDraggable.sqf +++ b/addons/dragging/functions/fnc_setDraggable.sqf @@ -5,21 +5,37 @@ * * Arguments: * 0: Object - * 1: True to enable dragging, false to disable - * 2: Position offset for attachTo command (optional; default: [0, 1.5, 0]) - * 3: Direction in degrees to rotate the object after attachTo (optional; default: 0) + * 1: True to enable dragging, false to disable (default: false) + * 2: Position offset for attachTo command (default: [0, 1.5, 0]) + * 3: Direction in degrees to rotate the object after attachTo (default: 0) * 4: Override weight limit (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]]; @@ -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