diff --git a/addons/captives/CfgWeapons.hpp b/addons/captives/CfgWeapons.hpp index 34f7b59e100..23c7d0c2ce5 100644 --- a/addons/captives/CfgWeapons.hpp +++ b/addons/captives/CfgWeapons.hpp @@ -4,6 +4,7 @@ class CfgWeapons { class ACE_CableTie: ACE_ItemCore { author = ECSTRING(common,ACETeam); + GVAR(restraint) = 1; displayName = CSTRING(CableTie); descriptionShort = CSTRING(CableTieDescription); model = QPATHTOF(models\ace_cabletie.p3d); diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 61bd9788a30..8ec915e4f2d 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -8,6 +8,8 @@ PREP_RECOMPILE_END; GVAR(captivityEnabled) = false; +GVAR(restraints) = call (uiNamespace getVariable QGVAR(restraints)); + #include "initSettings.sqf" ADDON = true; diff --git a/addons/captives/XEH_preStart.sqf b/addons/captives/XEH_preStart.sqf index 022888575ed..75cbb90ef98 100644 --- a/addons/captives/XEH_preStart.sqf +++ b/addons/captives/XEH_preStart.sqf @@ -1,3 +1,6 @@ #include "script_component.hpp" #include "XEH_PREP.hpp" + +private _restraints = (QUOTE(getNumber (_x >> QQGVAR(restraint)) > 0) configClasses (configFile >> "CfgWeapons") apply {configName _x}); +uiNamespace setVariable [QGVAR(restraints), compileFinal str _restraints]; diff --git a/addons/captives/functions/fnc_canApplyHandcuffs.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf index 72ac745517f..5c97606f2e0 100644 --- a/addons/captives/functions/fnc_canApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -20,7 +20,7 @@ params ["_unit", "_target"]; //Check sides, Player has cableTie, target is alive and not already handcuffed (GVAR(allowHandcuffOwnSide) || {(side _unit) != (side _target)}) && -{"ACE_CableTie" in (_unit call EFUNC(common,uniqueItems))} && +{((_unit call EFUNC(common,uniqueItems)) findAny GVAR(restraints)) != -1} && {alive _target} && {!(_target getVariable [QGVAR(isHandcuffed), false])} && { diff --git a/addons/captives/functions/fnc_doApplyHandcuffs.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf index ad1ef3f2d69..76ae4c1b32b 100644 --- a/addons/captives/functions/fnc_doApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -23,4 +23,6 @@ playSound3D [QUOTE(PATHTO_R(sounds\cable_tie_zipping.ogg)), objNull, false, (get [QGVAR(setHandcuffed), [_target, true, _unit], [_target]] call CBA_fnc_targetEvent; -_unit removeItem "ACE_CableTie"; +private _cuffs = (_unit call EFUNC(common,uniqueItems)) arrayIntersect GVAR(restraints); + +_unit removeItem (_cuffs#0);