ACE3/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf

45 lines
1.2 KiB
Plaintext
Raw Normal View History

2015-01-17 17:26:51 +00:00
/*
* Author: CAA-Picard, commy2
*
* Cycle through non explosive grenades.
*
* Argument:
* None
*
* Return value:
* None
*/
#include "script_component.hpp"
private ["_unit", "_nextMuzzle"];
_unit = _this select 0;
_nextMuzzle = ["NonFrag"] call FUNC(findNextGrenadeMuzzle);
if (_nextMuzzle != "") then {
GVAR(CurrentGrenadeMuzzleOther) = _nextMuzzle;
private ["_magazines", "_magazine", "_count", "_return"];
_magazines = GVAR(NonFragMagazines) select (GVAR(NonFragMuzzles) find _nextMuzzle);
reverse _magazines;
_magazine = "";
_count = {_return = _x in _magazines; if (_return) then {_magazine = _x}; _return} count magazines _unit;
// There is a muzzle with magazines --> cycle to it
[_unit, _nextMuzzle] call FUNC(setNextGrenadeMuzzle);
[_magazine, _count] call FUNC(displayGrenadeTypeAndNumber);
} else {
// There is a no muzzle with magazines --> select nothing
GVAR(CurrentGrenadeMuzzleOther) = "";
if (GVAR(DisplayText)) then {
_text = [localize "STR_ACE_WeaponSelect_NoMiscGrenadeLeft", [1,0,0]] call EFUNC(common,stringToColoredText);
[composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured);
};
2015-01-17 17:26:51 +00:00
};
GVAR(CurrentGrenadeMuzzleIsFrag) = false;