mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Dragging - Add parameters check for FUNC(setDraggable)
& FUNC(setCarryable)
(#10264)
* Check params * Update fnc_setDraggable.sqf
This commit is contained in:
parent
284d3105db
commit
db7b78c068
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Object <OBJECT>
|
* 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])
|
* 2: Position offset for attachTo command <ARRAY> (default: [0, 1, 1])
|
||||||
* 3: Direction in degrees to rotate the object after attachTo <NUMBER> (default: 0)
|
* 3: Direction in degrees to rotate the object after attachTo <NUMBER> (default: 0)
|
||||||
* 4: Override weight limit <BOOL> (default: false)
|
* 4: Override weight limit <BOOL> (default: false)
|
||||||
@ -14,12 +14,28 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* 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
|
* 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 {
|
if (isNil "_position") then {
|
||||||
_position = _object getVariable [QGVAR(carryPosition), [0, 1, 1]];
|
_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, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
|
|
||||||
|
nil // return
|
||||||
|
@ -5,21 +5,37 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Object <OBJECT>
|
* 0: Object <OBJECT>
|
||||||
* 1: True to enable dragging, false to disable <BOOL>
|
* 1: True to enable dragging, false to disable <BOOL> (default: false)
|
||||||
* 2: Position offset for attachTo command (optional; default: [0, 1.5, 0]) <ARRAY>
|
* 2: Position offset for attachTo command <ARRAY> (default: [0, 1.5, 0])
|
||||||
* 3: Direction in degrees to rotate the object after attachTo (optional; default: 0) <NUMBER>
|
* 3: Direction in degrees to rotate the object after attachTo <NUMBER> (default: 0)
|
||||||
* 4: Override weight limit <BOOL> (default: false)
|
* 4: Override weight limit <BOOL> (default: false)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* 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
|
* 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 {
|
if (isNil "_position") then {
|
||||||
_position = _object getVariable [QGVAR(dragPosition), [0, 1.5, 0]];
|
_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, ["ACE_MainActions"], _dragAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
|
|
||||||
|
nil // return
|
||||||
|
Loading…
Reference in New Issue
Block a user