mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
32 lines
733 B
Plaintext
32 lines
733 B
Plaintext
/*
|
|
* Author: commy2
|
|
*
|
|
* Get the turret index of a units current turret.
|
|
*
|
|
* Argument:
|
|
* 0: Unit, not the vehicle (as in not a car but the player) (Object)
|
|
*
|
|
* Return value:
|
|
* Turret index array or config path. E.g: [0] for gunner or [0,0] for commander. Returns empty array if unit is not in a turret. (Array)
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
private ["_unit", "_vehicle", "_turrets", "_units", "_index"];
|
|
|
|
_unit = _this select 0;
|
|
_vehicle = vehicle _unit;
|
|
|
|
//_turrets = [typeOf _vehicle] call FUNC(getTurrets);
|
|
_turrets = allTurrets [_vehicle, true];
|
|
|
|
_units = [];
|
|
{
|
|
_units pushBack (_vehicle turretUnit _x);
|
|
} forEach _turrets;
|
|
|
|
_index = _units find _unit;
|
|
|
|
if (_index == -1) exitWith {[]};
|
|
|
|
_turrets select _index;
|