Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Captives - Add modded cable tie support #9350

Merged
merged 21 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/captives/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions addons/captives/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ PREP_RECOMPILE_END;

GVAR(captivityEnabled) = false;

GVAR(restraints) = call (uiNamespace getVariable QGVAR(restraints));

#include "initSettings.sqf"

ADDON = true;
3 changes: 3 additions & 0 deletions addons/captives/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -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];
2 changes: 1 addition & 1 deletion addons/captives/functions/fnc_canApplyHandcuffs.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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])} &&
{
Expand Down
4 changes: 3 additions & 1 deletion addons/captives/functions/fnc_doApplyHandcuffs.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);