diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf index 0eb64e7373..58899f088d 100644 --- a/addons/captives/functions/fnc_canUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author: commy2 + * Author: commy2, LinkIsGrim * Check if the unit can unload a captive from the vehicle. * * Arguments: @@ -19,4 +19,6 @@ params ["_player", "_unit"]; // Don't show "Unload Captive" if unit is unconscious (already has "Unload Patient") -(vehicle _unit != _unit) && {vehicle _player == _player} && {_unit getVariable [QGVAR(isHandcuffed), false]} && {!(_unit getVariable ["ACE_isUnconscious", false])} +!isNull objectParent _unit && +{_unit getVariable [QGVAR(isHandcuffed), false]} && +{lifeState _unit in ["HEALTHY", "INJURED"]} diff --git a/addons/common/functions/fnc_findUnloadPosition.sqf b/addons/common/functions/fnc_findUnloadPosition.sqf index 2479ad4f94..2047f7349d 100644 --- a/addons/common/functions/fnc_findUnloadPosition.sqf +++ b/addons/common/functions/fnc_findUnloadPosition.sqf @@ -54,7 +54,7 @@ if (_item isKindOf "CAManBase") then { }; }; -if (isNull _unloader) then { +if (isNull _unloader || {_unloader in _vehicle}) then { _unloader = _vehicle; }; diff --git a/addons/medical_gui/CfgVehicles.hpp b/addons/medical_gui/CfgVehicles.hpp index 370015688d..502039325a 100644 --- a/addons/medical_gui/CfgVehicles.hpp +++ b/addons/medical_gui/CfgVehicles.hpp @@ -57,7 +57,7 @@ class CfgVehicles { }; class ACE_UnloadPatient { displayName = CSTRING(UnloadPatient); - condition = QUOTE((_target getVariable [ARR_2('ACE_isUnconscious',false)] || {!alive _target}) && {!isNull objectParent _target} && {isNull objectParent _player}); + condition = QUOTE([ARR_2(_player,_target)] call EFUNC(medical_treatment,canUnloadUnit)); exceptions[] = {"isNotDragging", "isNotCarrying", "isNotInside"}; statement = QUOTE([ARR_2(_player,_target)] call EFUNC(medical_treatment,unloadUnit)); icon = QPATHTOF(ui\cross.paa); diff --git a/addons/medical_treatment/XEH_PREP.hpp b/addons/medical_treatment/XEH_PREP.hpp index 9222b0bd8b..709c97952f 100644 --- a/addons/medical_treatment/XEH_PREP.hpp +++ b/addons/medical_treatment/XEH_PREP.hpp @@ -13,6 +13,7 @@ PREP(canStitch); PREP(canTreat); PREP(canTreatCached); PREP(canTreat_holsterCheck); +PREP(canUnloadUnit); PREP(checkBloodPressure); PREP(checkBloodPressureLocal); PREP(checkPulse); diff --git a/addons/medical_treatment/functions/fnc_canUnloadUnit.sqf b/addons/medical_treatment/functions/fnc_canUnloadUnit.sqf new file mode 100644 index 0000000000..f1a15f04f9 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_canUnloadUnit.sqf @@ -0,0 +1,22 @@ +#include "..\script_component.hpp" +/* + * Author: LinkIsGrim + * Checks if unit can be unloaded. + * + * Arguments: + * 0: Unloader + * 1: Target + * + * Return Value: + * Can Unload + * + * Example: + * [player, bob] call ace_medical_treatment_fnc_canUnloadUnit + * + * Public: No + */ + +params ["_unloader", "_target"]; + +!isNull objectParent _target && +{!(lifeState _target in ["HEALTHY", "INJURED"])}