ACE3/addons/common/functions/fnc_getTurretIndex.sqf
jonpas 742626ff1a
General - Relative script_component.hpp includes (#9378)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-12 20:58:10 +02:00

31 lines
531 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: commy2
* Get the turret index of a units current turret.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Turret Index <ARRAY>
*
* Example:
* [ace_player] call ace_common_fnc_getTurretIndex
*
* Public: Yes
*/
params [["_unit", objNull, [objNull]]];
private _vehicle = vehicle _unit;
if (_unit == _vehicle) exitWith {[]};
scopeName "main";
{
if (_unit == (_vehicle turretUnit _x)) then {_x breakOut "main"};
nil
} count allTurrets [_vehicle, true];
[]