ACE3/addons/common/functions/fnc_getWeaponMuzzles.sqf

40 lines
758 B
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
/*
* Author: commy2, johnb43
* Get the muzzles of a weapon.
*
2015-09-21 11:08:10 +00:00
* Arguments:
* 0: Weapon <STRING>
*
* Return Value:
* All weapon muzzles <ARRAY>
*
* Example:
* "arifle_AK12_F" call ace_common_fnc_getWeaponMuzzles
*
2015-09-21 11:08:10 +00:00
* Public: Yes
*/
params [["_weapon", "", [""]]];
private _config = configFile >> "CfgWeapons" >> _weapon;
if (!isClass _config) exitWith {
[] // return
};
private _muzzles = [];
// Get config case muzzle names
{
if (_x == "this") then {
_muzzles pushBack (configName _config);
} else {
if (isClass (_config >> _x)) then {
_muzzles pushBack (configName (_config >> _x));
};
};
} forEach getArray (_config >> "muzzles");
2015-01-17 17:26:51 +00:00
_muzzles // return