diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 57179d9097..75f4221aba 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -22,6 +22,7 @@ PREP(addUnloadPatientActions); PREP(canAccessMedicalEquipment); PREP(canTreat); PREP(canTreatCached); +PREP(canCarry); PREP(determineIfFatal); PREP(getBloodLoss); PREP(getBloodPressure); diff --git a/addons/medical/functions/fnc_canCarry.sqf b/addons/medical/functions/fnc_canCarry.sqf new file mode 100644 index 0000000000..a7db1f6cc3 --- /dev/null +++ b/addons/medical/functions/fnc_canCarry.sqf @@ -0,0 +1,29 @@ +/* + * Author: Glowbal + * Check if caller can carry or drag the target + * + * Arguments: + * 0: The caller + * 1: The target + * + * Return Value: + * NONE + * + * Public: No + */ + +#include "script_component.hpp" + + private ["_caller", "_target", "_positionUnit", "_carry"]; +_caller = _this select 0; +_target = _this select 1; + +if (!(_target isKindOf "CaManBase") || !(_caller isKindOf "CaManBase")) exitwith{false}; + +if (vehicle _caller != _caller || vehicle _target != _target) exitwith {false}; + +if (!([_caller] call EFUNC(common,canInteract)) || {_caller == _target} || {(([_target] call EFUNC(common,isAwake)))}) exitwith {false}; + +if (!alive _target) exitwith {GVAR(allowDeadBodyMovement)}; + +((isNull ([_caller] call FUNC(getCarriedObj))) && {isNull ([_target] call FUNC(getCarriedObj))} && {isNull ([_caller] call FUNC(getCarriedBy))} && {isNull ([_target] call FUNC(getCarriedBy))})