2015-02-03 02:04:50 +00:00
|
|
|
/*
|
|
|
|
* Author: Nic547, commy2
|
|
|
|
* Makes a civilian unable to move.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: True to take captive, false to release captive <BOOL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* TODO
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
PARAMS_2(_unit,_state);
|
|
|
|
|
|
|
|
if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc};
|
|
|
|
|
|
|
|
if (_state) then {
|
2015-02-04 19:16:19 +00:00
|
|
|
if (_unit getVariable [QGVAR(isCaptive), false]) exitWith {};
|
2015-02-03 02:04:50 +00:00
|
|
|
|
2015-02-04 19:16:19 +00:00
|
|
|
_unit setVariable [QGVAR(isCaptive), true, true];
|
2015-02-03 02:04:50 +00:00
|
|
|
|
2015-02-04 05:13:44 +00:00
|
|
|
// fix anim on mission start (should work on dedicated servers)
|
|
|
|
_unit spawn {
|
|
|
|
[_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus;
|
2015-02-03 02:04:50 +00:00
|
|
|
|
2015-02-04 19:16:19 +00:00
|
|
|
if (_this getVariable [QGVAR(isCaptive), false] && {vehicle _this == _this}) then {
|
2015-02-04 05:13:44 +00:00
|
|
|
[_this] call EFUNC(common,fixLoweredRifleAnimation);
|
|
|
|
[_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation);
|
|
|
|
};
|
2015-02-03 02:04:50 +00:00
|
|
|
};
|
|
|
|
|
2015-02-04 05:13:44 +00:00
|
|
|
_unit setVariable ["ACE_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true];
|
2015-02-03 02:04:50 +00:00
|
|
|
|
2015-02-04 05:13:44 +00:00
|
|
|
if (_unit == ACE_player) then {
|
|
|
|
showHUD false;
|
|
|
|
};
|
2015-02-03 02:04:50 +00:00
|
|
|
} else {
|
2015-02-04 19:16:19 +00:00
|
|
|
if !(_unit getVariable [QGVAR(isCaptive), false]) exitWith {};
|
2015-02-03 02:04:50 +00:00
|
|
|
|
2015-02-04 19:16:19 +00:00
|
|
|
_unit setVariable [QGVAR(isCaptive), false, true];
|
2015-02-04 05:13:44 +00:00
|
|
|
[_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus;
|
|
|
|
if (vehicle _unit == _unit) then {
|
|
|
|
[_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
|
|
|
};
|
2015-02-03 02:04:50 +00:00
|
|
|
|
2015-02-04 05:13:44 +00:00
|
|
|
if (_unit getVariable ["ACE_Captives_CargoIndex", -1] != -1) then {
|
|
|
|
_unit setVariable ["ACE_Captives_CargoIndex", -1, true];
|
|
|
|
};
|
2015-02-03 02:04:50 +00:00
|
|
|
|
2015-02-04 05:13:44 +00:00
|
|
|
if (_unit == ACE_player) then {
|
|
|
|
showHUD true;
|
|
|
|
};
|
2015-02-03 02:04:50 +00:00
|
|
|
};
|