ACE3/addons/common/functions/fnc_getTurretIndex.sqf

31 lines
531 B
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
/*
* 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
*/
params [["_unit", objNull, [objNull]]];
2015-09-20 21:40:51 +00:00
2015-11-17 16:43:07 +00:00
private _vehicle = vehicle _unit;
2015-01-16 20:16:42 +00:00
if (_unit == _vehicle) exitWith {[]};
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
[]