ACE3/addons/dragging/functions/fnc_canDrag.sqf
PiZZAD0X 13193d3e6d Dragging - Additional weight override parameter for setCarryable/setDraggable (#6780)
* 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>
2019-01-20 10:23:24 -06:00

27 lines
1022 B
Plaintext

#include "script_component.hpp"
/*
* Author: commy2
* Check if unit can drag the object. Doesn't check weight.
*
* Arguments:
* 0: Unit that should do the dragging <OBJECT>
* 1: Object to drag <OBJECT>
*
* Return Value:
* Can the unit drag the object? <BOOL>
*
* Example:
* [player, cursorTarget] call ace_dragging_fnc_canDrag;
*
* Public: No
*/
params ["_unit", "_target"];
if !([_unit, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)) exitWith {false};
// a static weapon has to be empty for dragging (ignore UAV AI)
if ((typeOf _target) isKindOf "StaticWeapon" && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false};
alive _target && {vehicle _target isEqualto _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getVariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}