2015-02-06 09:38:27 +00:00
|
|
|
#include "script_component.hpp"
|
2019-03-21 13:52:32 +00:00
|
|
|
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
|
2015-02-06 09:38:27 +00:00
|
|
|
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_settingsInitialized", {
|
2016-03-04 17:45:38 +00:00
|
|
|
// Hold on a little bit longer to ensure anims will work
|
|
|
|
[{
|
|
|
|
GVAR(captivityEnabled) = true;
|
2016-05-22 13:27:24 +00:00
|
|
|
}, [], 0.05] call CBA_fnc_waitAndExecute;
|
2016-05-22 15:29:05 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2015-02-06 09:38:27 +00:00
|
|
|
|
|
|
|
//Handles when someone starts escorting and then disconnects, leaving the captive attached
|
|
|
|
//This is normaly handled by the PFEH in doEscortCaptive, but that won't be running if they DC
|
2015-02-17 00:30:35 +00:00
|
|
|
|
2015-02-06 09:38:27 +00:00
|
|
|
if (isServer) then {
|
|
|
|
addMissionEventHandler ["HandleDisconnect", {
|
2015-08-15 02:29:01 +00:00
|
|
|
params ["_disconnectedPlayer"];
|
2016-09-04 14:44:22 +00:00
|
|
|
private _escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull];
|
2015-02-06 09:38:27 +00:00
|
|
|
if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then {
|
|
|
|
detach _escortedUnit;
|
|
|
|
};
|
|
|
|
if (_disconnectedPlayer getVariable [QGVAR(isEscorting), false]) then {
|
|
|
|
_disconnectedPlayer setVariable [QGVAR(isEscorting), false, true];
|
|
|
|
};
|
|
|
|
}];
|
|
|
|
};
|
|
|
|
|
2024-06-11 15:34:32 +00:00
|
|
|
["unit", LINKFUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
|
2024-03-28 18:57:23 +00:00
|
|
|
[QGVAR(moveInCaptive), LINKFUNC(vehicleCaptiveMoveIn)] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(moveOutCaptive), LINKFUNC(vehicleCaptiveMoveOut)] call CBA_fnc_addEventHandler;
|
2015-02-17 00:03:09 +00:00
|
|
|
|
2024-03-28 18:57:23 +00:00
|
|
|
[QGVAR(setHandcuffed), LINKFUNC(setHandcuffed)] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(setSurrendered), LINKFUNC(setSurrendered)] call CBA_fnc_addEventHandler;
|
2015-02-15 20:55:17 +00:00
|
|
|
|
2015-09-29 15:17:17 +00:00
|
|
|
//Medical Integration Events
|
2024-03-28 18:57:23 +00:00
|
|
|
["ace_unconscious", LINKFUNC(handleOnUnconscious)] call CBA_fnc_addEventHandler;
|
2015-03-15 08:26:16 +00:00
|
|
|
|
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2017-09-26 04:22:10 +00:00
|
|
|
["ACE3 Common", QGVAR(captives), [(localize LSTRING(SetCaptive)), (localize LSTRING(KeyComb_description))],
|
|
|
|
{
|
|
|
|
private _target = cursorObject;
|
|
|
|
if !([ACE_player, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
2017-11-27 04:43:45 +00:00
|
|
|
if !(_target isKindOf "CAManBase") exitWith {false};
|
2022-03-09 03:41:21 +00:00
|
|
|
if ((_target distance ACE_player) > getNumber (configOf ACE_player >> "ACE_Actions" >> "ACE_ApplyHandcuffs" >> "distance")) exitWith {false};
|
2017-09-26 04:22:10 +00:00
|
|
|
|
|
|
|
if ([ACE_player, _target] call FUNC(canApplyHandcuffs)) exitWith {
|
2019-03-05 15:40:10 +00:00
|
|
|
[ACE_player, _target] call FUNC(doApplyHandcuffs);
|
2017-09-26 04:22:10 +00:00
|
|
|
true
|
|
|
|
};
|
|
|
|
false
|
|
|
|
},
|
|
|
|
{false},
|
|
|
|
[DIK_F1, [true, false, false]], true] call CBA_fnc_addKeybind; // Shift + F1
|
|
|
|
|
2017-12-30 13:38:45 +00:00
|
|
|
["isNotEscorting", {!GETVAR(_this select 0,GVAR(isEscorting),false)}] call EFUNC(common,addCanInteractWithCondition);
|
|
|
|
["isNotHandcuffed", {!GETVAR(_this select 0,GVAR(isHandcuffed),false)}] call EFUNC(common,addCanInteractWithCondition);
|
|
|
|
["isNotSurrendering", {!GETVAR(_this select 0,GVAR(isSurrendering),false)}] call EFUNC(common,addCanInteractWithCondition);
|