2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
*
|
|
|
|
* Get the turret index of a units current turret.
|
|
|
|
*
|
|
|
|
* Argument:
|
|
|
|
* 0: Unit, not the vehicle (as in not a car but the player) (Object)
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* Turret index array or config path. E.g: [0] for gunner or [0,0] for commander. Returns empty array if unit is not in a turret. (Array)
|
|
|
|
*/
|
2015-01-13 19:56:02 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
private ["_unit", "_vehicle", "_turrets", "_units", "_index"];
|
|
|
|
|
|
|
|
_unit = _this select 0;
|
|
|
|
_vehicle = vehicle _unit;
|
|
|
|
|
2015-01-16 20:16:42 +00:00
|
|
|
if (_unit == _vehicle) exitWith {[]};
|
|
|
|
|
2015-01-11 18:20:14 +00:00
|
|
|
//_turrets = [typeOf _vehicle] call FUNC(getTurrets);
|
2015-01-11 16:42:31 +00:00
|
|
|
_turrets = allTurrets [_vehicle, true];
|
|
|
|
|
|
|
|
_units = [];
|
|
|
|
{
|
|
|
|
_units pushBack (_vehicle turretUnit _x);
|
|
|
|
} forEach _turrets;
|
|
|
|
|
|
|
|
_index = _units find _unit;
|
|
|
|
|
|
|
|
if (_index == -1) exitWith {[]};
|
|
|
|
|
|
|
|
_turrets select _index;
|