ACE3/addons/common/functions/fnc_getTurretIndex.sqf

31 lines
507 B
Plaintext
Raw Normal View History

/*
* 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-10-04 04:05:46 +00:00
* Example:
* [ace_player] call ace_common_fnc_getTurretIndex
*
2015-09-20 21:40:51 +00:00
* Public: Yes
*/
2015-01-13 19:56:02 +00:00
#include "script_component.hpp"
2015-09-20 21:40:51 +00:00
params ["_unit"];
2015-11-17 16:43:07 +00:00
private _vehicle = vehicle _unit;
2015-01-16 20:16:42 +00:00
if (_unit == _vehicle) exitWith {[]};
2015-10-04 04:05:46 +00:00
scopeName "main";
2015-09-20 21:40:51 +00:00
{
2015-10-04 04:05:46 +00:00
if (_unit == (_vehicle turretUnit _x)) then {_x breakOut "main"};
nil
} count allTurrets [_vehicle, true];
2015-10-04 04:05:46 +00:00
[]