2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Get the turret index of a units current turret.
|
|
|
|
*
|
2015-09-20 21:40:51 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Turret Index <ARRAY>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2015-09-20 21:40:51 +00:00
|
|
|
* Public: Yes
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
2015-01-13 19:56:02 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-09-20 21:40:51 +00:00
|
|
|
params ["_unit"];
|
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
private ["_vehicle", "_turrets", "_units", "_index"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_vehicle = vehicle _unit;
|
|
|
|
|
2015-01-16 20:16:42 +00:00
|
|
|
if (_unit == _vehicle) exitWith {[]};
|
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
_turrets = allTurrets [_vehicle, true];
|
|
|
|
|
|
|
|
_units = [];
|
2015-09-20 21:40:51 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
{
|
2015-09-20 21:40:51 +00:00
|
|
|
_units pushBack (_vehicle turretUnit _x);
|
|
|
|
false
|
|
|
|
} count _turrets;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_index = _units find _unit;
|
|
|
|
|
|
|
|
if (_index == -1) exitWith {[]};
|
|
|
|
|
|
|
|
_turrets select _index;
|