ACE3/addons/common/functions/fnc_getWeaponModes.sqf

36 lines
642 B
Plaintext
Raw Normal View History

#include "script_component.hpp"
/*
* Author: commy2
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>
*
2015-09-21 11:08:10 +00:00
* Return Value:
* Firing Modes <ARRAY>
*
* Example:
* ["gun"] call ace_common_fnc_getWeaponModes
*
2015-09-21 11:08:10 +00:00
* Public: Yes
*/
params [["_weapon", "", [""]]];
private _config = configFile >> "CfgWeapons" >> _weapon;
2015-09-21 11:08:10 +00:00
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 {
2015-01-17 17:26:51 +00:00
_modes pushBack _x;
};
if (_x == "this") then {
_modes pushBack _weapon;
};
2015-09-21 11:08:10 +00:00
false
} count getArray (_config >> "modes");
2015-01-17 17:26:51 +00:00
_modes