From 9d0083c82a742a4ede56d1bfa1f1cdd8002e9a86 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Thu, 25 Jul 2024 08:55:35 +0200 Subject: [PATCH] Make muzzles configcase --- addons/common/fnc_getMuzzles.sqf | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/addons/common/fnc_getMuzzles.sqf b/addons/common/fnc_getMuzzles.sqf index d6a7b8d7c..77811b20e 100644 --- a/addons/common/fnc_getMuzzles.sqf +++ b/addons/common/fnc_getMuzzles.sqf @@ -13,23 +13,34 @@ Returns: Examples: (begin example) - _muzzles = "M4A1_RCO_GL" call CBA_fnc_getMuzzles - -> ["M4_ACOG_Muzzle", "M203Muzzle"] + _muzzles = "arifle_AK12_GL_F" call CBA_fnc_getMuzzles + -> ["arifle_AK12_GL_F","EGLM"] (end) Author: - commy2 + commy2, johnb43 ---------------------------------------------------------------------------- */ SCRIPT(getMuzzles); params [["_weapon", "", [""]]]; -private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); +private _config = configFile >> "CfgWeapons" >> _weapon; +if (!isClass _config) exitWith { + [] // return +}; + +private _muzzles = []; + +// Get config case muzzle names { if (_x == "this") then { - _muzzles set [_forEachIndex, _weapon]; + _muzzles pushBack (configName _config); + } else { + if (isClass (_config >> _x)) then { + _muzzles pushBack (configName (_config >> _x)); + }; }; -} forEach _muzzles; +} forEach getArray (_config >> "muzzles"); -_muzzles +_muzzles // return