2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2024-07-20 06:13:42 +00:00
|
|
|
* 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-01-11 16:42:31 +00:00
|
|
|
*
|
2015-09-21 11:08:10 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Weapon <STRING>
|
2024-07-20 06:13:42 +00:00
|
|
|
* 1: Muzzle <STRING> (default: weapon)
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2015-09-21 11:08:10 +00:00
|
|
|
* Return Value:
|
|
|
|
* Firing Modes <ARRAY>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
2024-07-20 06:13:42 +00:00
|
|
|
* "arifle_AK12_F" call ace_common_fnc_getWeaponModes
|
2017-06-08 13:31:51 +00:00
|
|
|
*
|
2015-09-21 11:08:10 +00:00
|
|
|
* Public: Yes
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
|
|
|
|
2024-07-20 06:13:42 +00:00
|
|
|
params [["_weapon", "", [""]], ["_muzzle", nil, [""]]];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _config = configFile >> "CfgWeapons" >> _weapon;
|
2015-09-21 11:08:10 +00:00
|
|
|
|
2024-07-20 06:13:42 +00:00
|
|
|
if (!isNil "_muzzle") then {
|
|
|
|
_config = _config >> _muzzle
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!isClass _config) exitWith {
|
|
|
|
[] // return
|
|
|
|
};
|
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _modes = [];
|
2015-09-21 11:08:10 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
{
|
2015-09-21 11:08:10 +00:00
|
|
|
if (getNumber (_config >> _x >> "showToPlayer") == 1) then {
|
2024-07-20 06:13:42 +00:00
|
|
|
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
|
|
|
};
|
2024-04-04 11:15:26 +00:00
|
|
|
} forEach getArray (_config >> "modes");
|
2015-01-17 17:26:51 +00:00
|
|
|
|
2024-07-20 06:13:42 +00:00
|
|
|
_modes // return
|