ACE3/addons/captives/functions/fnc_handleGetOut.sqf
Glowbal b489750d5b Minor optimizations using private, params, and isEqualType (#4323)
* Optimizations with private, params, and isEqualType

* Fixed tab being used instead of space

* Fixed tabs inserted by notepad++

* More usage of new private syntax and params

- changed a few checks for an array being empty to `_arr isEqualTo []`
rather than `count _arr == 0`
- added more uses of `private` on the same line as the variable is
declared
- added more uses of params to assign variables passed as parameters
- removed unnecessary parentheses
- removed several unnecessary variable declarations with private array
syntax

* clean up and formatting
2016-09-04 16:44:22 +02:00

36 lines
992 B
Plaintext

/*
* Author: commy2
* Handles when a captive unit gets out of a vehicle.
*
* Arguments:
* 0: _vehicle <OBJECT>
* 1: dunno <OBJECT>
* 2: _unit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [car2, x, player] call ACE_captives_fnc_handleGetOut
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle", "", "_unit"];
TRACE_2("params",_vehicle,_unit);
if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
private _cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
if (_cargoIndex != -1) then {
//If captive was not "unloaded", then move them back into the vehicle.
TRACE_1("forcing back into vehicle",_cargoIndex);
_unit moveInCargo [_vehicle, _cargoIndex];
} else {
//Getting out of vehicle:
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
};
};