ACE3/addons/common/functions/fnc_setArrestState.sqf

45 lines
1.3 KiB
Plaintext
Raw Normal View History

2015-01-16 23:21:47 +00:00
/**
* fn_setArrestState.sqf
* @Descr: Set a unit in arrest state
* @Author: Glowbal
*
* @Arguments: [unitToBeArrested OBJECT, setArrested BOOL]
* @Return: void
* @PublicAPI: true
*/
#include "script_component.hpp"
private ["_unit","_setArrest"];
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param;
_setArrest = [_this, 1, false, [false]] call BIS_fnc_Param;
if (_setArrest) then {
2015-01-18 19:09:19 +00:00
[_unit, QGVAR(StateArrested), true] call FUNC(setDefinedVariable);
2015-01-16 23:21:47 +00:00
2015-01-18 19:09:19 +00:00
if ([_unit] call FUNC(isAwake)) then {
if (vehicle _unit == _unit) then {
[_unit,"UnaErcPoslechVelitele2",1] call FUNC(doAnimation);
};
};
if (IsPlayer _unit) then {
[["arrested", true],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc);
};
_unit disableAI "Move";
_unit disableAI "ANIM";
2015-01-16 23:21:47 +00:00
} else {
2015-01-18 19:09:19 +00:00
[_unit, QGVAR(StateArrested), false] call FUNC(setDefinedVariable);
2015-01-16 23:21:47 +00:00
2015-01-18 19:09:19 +00:00
if ([_unit] call FUNC(isAwake)) then {
if (vehicle _unit == _unit) then {
[_unit,"",1] call FUNC(doAnimation);
};
_unit enableAI "Move";
_unit enableAI "ANIM";
};
if (IsPlayer _unit) then {
[["arrested", false],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc);
};
2015-01-16 23:21:47 +00:00
};