ACE3/addons/common/functions/fnc_getTurretIndex.sqf
johnb432 8f46ffd8d5
General - Change count to forEach where appropriate (#9890)
count -> forEach

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
2024-04-04 08:15:26 -03:00

30 lines
525 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"};
} forEach allTurrets [_vehicle, true];
[]