ACE3/addons/common/functions/fnc_getWeaponModes.sqf

46 lines
986 B
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
/*
* Author: commy2, johnb43
2015-09-21 11:08:10 +00:00
* Get the available firing modes of a weapon. Will ignore the AI helper modes.
*
2015-09-21 11:08:10 +00:00
* Arguments:
* 0: Weapon <STRING>
* 1: Muzzle <STRING> (default: weapon)
*
2015-09-21 11:08:10 +00:00
* Return Value:
* Firing Modes <ARRAY>
*
* Example:
* "arifle_AK12_F" call ace_common_fnc_getWeaponModes
*
2015-09-21 11:08:10 +00:00
* Public: Yes
*/
params [["_weapon", "", [""]], ["_muzzle", nil, [""]]];
private _config = configFile >> "CfgWeapons" >> _weapon;
2015-09-21 11:08:10 +00:00
if (!isNil "_muzzle") then {
_config = _config >> _muzzle
};
if (!isClass _config) exitWith {
[] // return
};
private _modes = [];
2015-09-21 11:08:10 +00:00
{
2015-09-21 11:08:10 +00:00
if (getNumber (_config >> _x >> "showToPlayer") == 1) then {
if (_x == "this") then {
_modes pushBack (configName _config);
} else {
if (isClass (_config >> _x)) then {
_modes pushBack (configName (_config >> _x));
};
};
2015-01-17 17:26:51 +00:00
};
} forEach getArray (_config >> "modes");
2015-01-17 17:26:51 +00:00
_modes // return