From 4a5f056d713918da7998ea838ea90730f23ac7e4 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sun, 7 Jan 2024 16:29:01 +0100 Subject: [PATCH] Fixed/improved checks --- addons/dragging/functions/fnc_canCarry.sqf | 9 ++++----- addons/dragging/functions/fnc_canDrag.sqf | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index 1d0168d119..6d45d2df71 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -28,15 +28,14 @@ if ((_unit getHitPointDamage "HitLegs") >= 0.5) exitWith {false}; // Static weapons need to be empty for carrying (ignore UAV AI) if (_target isKindOf "StaticWeapon") exitWith { - (crew _target) findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1 + (crew _target) findIf {!unitIsUAV _x} == -1 }; // Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues if (_target isKindOf "CAManBase") exitWith { - isAwake _target && // not ragdolled - {lifeState _target == "INCAPACITATED" || - {_target getHitPointDamage "HitLegs" >= 0.5} || - {(animationState _target) in ["", "unconscious", "deadstate"]}} + (isAwake _target != alive _target) && // not ragdolled + {!(lifeState _target in ["HEALTHY", "INJURED"]) || + {_target getHitPointDamage "HitLegs" >= 0.5}} }; // Check max items for WeaponHolders diff --git a/addons/dragging/functions/fnc_canDrag.sqf b/addons/dragging/functions/fnc_canDrag.sqf index f67a3d6f86..ad1f0d40b4 100644 --- a/addons/dragging/functions/fnc_canDrag.sqf +++ b/addons/dragging/functions/fnc_canDrag.sqf @@ -24,15 +24,14 @@ if !([_unit, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)) exi // Static weapons need to be empty for dragging (ignore UAV AI) if (_target isKindOf "StaticWeapon") exitWith { - (crew _target) findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1 + (crew _target) findIf {!unitIsUAV _x} == -1 }; // Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues if (_target isKindOf "CAManBase") exitWith { - isAwake _target && // not ragdolled - {lifeState _target == "INCAPACITATED" || - {_target getHitPointDamage "HitLegs" >= 0.5} || - {(animationState _target) in ["", "unconscious", "deadstate"]}} + (isAwake _target != alive _target) && // not ragdolled + {!(lifeState _target in ["HEALTHY", "INJURED"]) || + {_target getHitPointDamage "HitLegs" >= 0.5}} }; // Check max items for WeaponHolders