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 caller to captiveStatusChanged event #8360

Merged
merged 7 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/captives/functions/fnc_doApplyHandcuffs.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ params ["_unit", "_target"];

playSound3D [QUOTE(PATHTO_R(sounds\cable_tie_zipping.ogg)), objNull, false, (getPosASL _target), 1, 1, 10];

[QGVAR(setHandcuffed), [_target, true], [_target]] call CBA_fnc_targetEvent;
[QGVAR(setHandcuffed), [_target, true, _unit], [_target]] call CBA_fnc_targetEvent;

_unit removeItem "ACE_CableTie";
7 changes: 4 additions & 3 deletions addons/captives/functions/fnc_doRemoveHandcuffs.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
* Remove handcuffs from a target
*
* Arguments:
* 0: target <OBJECT>
* 0: Caller <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [bob, false] call ACE_captives_fnc_doRemoveHandcuffs
* [bob, bill] call ACE_captives_fnc_doRemoveHandcuffs
*
* Public: No
*/

LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved
params ["_unit", "_target"];

[QGVAR(setHandcuffed), [_target, false], [_target]] call CBA_fnc_targetEvent;
[QGVAR(setHandcuffed), [_target, false, _unit], [_target]] call CBA_fnc_targetEvent;
9 changes: 5 additions & 4 deletions addons/captives/functions/fnc_setHandcuffed.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@
* Arguments:
* 0: Unit <OBJECT>
* 1: True to take captive, false to release captive <BOOL>
* 2: Caller <OBJECT>
*
* Return Value:
* None
*
* Example:
* [bob, true] call ACE_captives_fnc_setHandcuffed;
* [bob, true, dave] call ACE_captives_fnc_setHandcuffed;
*
* Public: No
*/

params ["_unit","_state"];
TRACE_2("params",_unit,_state);
params ["_unit", "_state", ["_caller", objNull]];
TRACE_3("params",_unit,_state,_caller);

if (!local _unit) exitWith {
WARNING("running setHandcuffed on remote unit");
Expand Down Expand Up @@ -103,4 +104,4 @@ if (_state) then {
};

//Global Event after changes:
["ace_captiveStatusChanged", [_unit, _state, "SetHandcuffed"]] call CBA_fnc_globalEvent;
["ace_captiveStatusChanged", [_unit, _state, "SetHandcuffed", _caller]] call CBA_fnc_globalEvent;
2 changes: 1 addition & 1 deletion docs/wiki/framework/events-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ MenuType: 0 = Interaction, 1 = Self Interaction

| Event Key | Parameters | Locality | Type | Description |
|----------|---------|---------|---------|---------|---------|
|`ace_captiveStatusChanged` | [_unit, _state(BOOL), _reason ("SetHandcuffed" or "SetSurrendered")] | Global | Listen | Unit's captivity state changed
|`ace_captiveStatusChanged` | [_unit, _state(BOOL), _reason ("SetHandcuffed" or "SetSurrendered"), _caller] | Global | Listen | Unit's captivity state changed
|`ace_captives_setSurrendered` | [_unit, _state(BOOL)] | Target | Callable | Sets a unit to either start or stop surrendering
|`ace_captives_setHandcuffed` | [_unit, _state(BOOL)] | Target | Callable | Sets a unit to either start or stop being handcuffed

Expand Down