mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
13193d3e6d
* Added weight override parameter to ace_dragging_fnc_setCarryable/setDraggable - Additional optional parameter that ignores the `startCarry`/`startDrag` weight checks. - Minor `==` to `isEqualto` replacements * `count crew _target isEqualto -1` to `count crew _target isEqualto 0` * Tab Replacement - remove \t * Reverted UAV check, Params formatting, Lazy Eval * Update addons/dragging/functions/fnc_startCarry.sqf Co-Authored-By: PiZZAD0X <509thparachuteinfantry@gmail.com> * Update fnc_startDrag.sqf * Remove beta suggestion extra line additions * Update addons/dragging/functions/fnc_startDrag.sqf Co-Authored-By: PiZZAD0X <509thparachuteinfantry@gmail.com>
56 lines
2.2 KiB
Plaintext
56 lines
2.2 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: commy2, PiZZADOX
|
|
* Enable the object to be carried.
|
|
*
|
|
* Arguments:
|
|
* 0: Any object <OBJECT>
|
|
* 1: true to enable carrying, false to disable <BOOL>
|
|
* 2: Position offset for attachTo command <ARRAY> (default: [0,1,1])
|
|
* 3: Direction in degree to rotate the object after attachTo <NUMBER> (default: 0)
|
|
* 4: Override weight limit (optional; default: false) <BOOL>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [object, true, [0,1,1], 0, false] call ace_dragging_fnc_setCarryable;
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
//IGNORE_PRIVATE_WARNING ["_player", "_target"];
|
|
params ["_object", "_enableCarry", "_position", "_direction", ["_ignoreWeightCarry", false, [false]]];
|
|
|
|
if (isNil "_position") then {
|
|
_position = _object getVariable [QGVAR(carryPosition), [0,1,1]];
|
|
};
|
|
|
|
if (isNil "_direction") then {
|
|
_direction = _object getVariable [QGVAR(carryDirection), 0];
|
|
};
|
|
|
|
// update variables
|
|
_object setVariable [QGVAR(canCarry), _enableCarry];
|
|
_object setVariable [QGVAR(carryPosition), _position];
|
|
_object setVariable [QGVAR(carryDirection), _direction];
|
|
_object setVariable [QGVAR(ignoreWeightCarry), _ignoreWeightCarry];
|
|
|
|
// add action to class if it is not already present
|
|
private _type = typeOf _object;
|
|
private _initializedClasses = GETGVAR(initializedClasses_carry,[]);
|
|
|
|
// do nothing if the class is already initialized
|
|
if (_type in _initializedClasses) exitWith {};
|
|
|
|
_initializedClasses pushBack _type;
|
|
GVAR(initializedClasses_carry) = _initializedClasses;
|
|
|
|
private _icon = [QUOTE(PATHTOF(UI\icons\box_carry.paa)), QUOTE(PATHTOF(UI\icons\person_carry.paa))] select (_object isKindOf "Man");
|
|
|
|
private _carryAction = [QGVAR(carry), localize LSTRING(Carry), _icon, {[_player, _target] call FUNC(startCarry)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction);
|
|
private _dropAction = [QGVAR(drop_carry), localize LSTRING(Drop), "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction);
|
|
|
|
[_type, 0, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass);
|
|
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|