From 535662b883e0a0013ee4ff19b67f5571e357088e Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Mon, 10 Jul 2023 06:45:53 +0300 Subject: [PATCH] Dragging - Add limping check to carrier and improve limping check for target unit (#9251) * fix limping damage threshold * add check for carrier not limping --- addons/dragging/functions/fnc_canCarry.sqf | 4 ++-- addons/dragging/functions/fnc_canDrag.sqf | 4 ++-- addons/dragging/functions/fnc_carryObjectPFH.sqf | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index 41fc983ba7..dac874f6c0 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -31,10 +31,10 @@ if (_target isKindOf "StaticWeapon") exitWith { crew _target findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1 }; -// Units need to be unconscious or be limping +// Units need to be unconscious or limping if (_target isKindOf "CAManBase") exitWith { lifeState _target isEqualTo "INCAPACITATED" - || {_target getHitPointDamage "HitLegs" > 0.4} + || {_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 82cb33068b..8336e20f2d 100644 --- a/addons/dragging/functions/fnc_canDrag.sqf +++ b/addons/dragging/functions/fnc_canDrag.sqf @@ -27,10 +27,10 @@ if (_target isKindOf "StaticWeapon") exitWith { crew _target findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1 }; -// Units need to be unconscious or be limping +// Units need to be unconscious or limping if (_target isKindOf "CAManBase") exitWith { lifeState _target isEqualTo "INCAPACITATED" - || {_target getHitPointDamage "HitLegs" > 0.4} + || {_target getHitPointDamage "HitLegs" >= 0.5} }; // Check max items for WeaponHolders diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index 93e35547ad..072b688b9d 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -33,8 +33,8 @@ if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; -// drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) -if (!alive _target || {_unit distance _target > 10}) exitWith { +// drop if the crate is destroyed OR target moved away from carrier (weapon disassembled) OR carrier starts limping +if !(alive _target && {_unit distance _target <= 10} && {_unit getHitPointDamage "HitLegs" < 0.5}) exitWith { TRACE_2("dead/distance",_unit,_target); if ((_unit distance _target > 10) && {(CBA_missionTime - _startTime) < 1}) exitWith { //attachTo seems to have some kind of network delay and target can return an odd position during the first few frames,