2015-01-17 17:26:51 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: esteldunedain, commy2
|
2015-01-17 17:26:51 +00:00
|
|
|
* Cycle through frags.
|
|
|
|
*
|
2015-08-08 12:40:23 +00:00
|
|
|
* Arguments:
|
2015-08-04 01:08:21 +00:00
|
|
|
* 0: Unit <OBJECT>
|
2015-01-17 17:26:51 +00:00
|
|
|
*
|
2015-08-08 12:40:23 +00:00
|
|
|
* Return Value:
|
2015-01-17 17:26:51 +00:00
|
|
|
* None
|
2015-08-08 12:40:23 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player] call ace_weaponselect_fnc_selectGrenadeFrag
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-17 17:26:51 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-17 20:45:00 +00:00
|
|
|
private ["_text", "_nextMuzzle"];
|
2015-01-17 17:26:51 +00:00
|
|
|
|
2015-08-04 01:08:21 +00:00
|
|
|
params ["_unit"];
|
2015-01-17 17:26:51 +00:00
|
|
|
|
|
|
|
_nextMuzzle = ["Frag"] call FUNC(findNextGrenadeMuzzle);
|
|
|
|
|
|
|
|
if (_nextMuzzle != "") then {
|
2015-04-17 20:45:00 +00:00
|
|
|
GVAR(CurrentGrenadeMuzzleFrag) = _nextMuzzle;
|
2015-01-17 17:26:51 +00:00
|
|
|
|
2015-04-17 20:45:00 +00:00
|
|
|
private ["_magazines", "_magazine", "_count", "_return"];
|
|
|
|
_magazines = GVAR(FragMagazines) select (GVAR(FragMuzzles) find _nextMuzzle);
|
|
|
|
reverse _magazines;
|
2015-01-17 17:26:51 +00:00
|
|
|
|
2015-04-17 20:45:00 +00:00
|
|
|
_magazine = "";
|
|
|
|
_count = {_return = _x in _magazines; if (_return) then {_magazine = _x}; _return} count magazines _unit;
|
2015-01-17 17:26:51 +00:00
|
|
|
|
2015-04-17 20:45:00 +00:00
|
|
|
// There is a muzzle with magazines --> cycle to it
|
|
|
|
[_unit, _nextMuzzle] call FUNC(setNextGrenadeMuzzle);
|
2015-01-17 17:26:51 +00:00
|
|
|
|
2015-04-17 20:45:00 +00:00
|
|
|
[_magazine, _count] call FUNC(displayGrenadeTypeAndNumber);
|
2015-01-17 17:26:51 +00:00
|
|
|
|
|
|
|
} else {
|
2015-04-17 20:45:00 +00:00
|
|
|
// There is a no muzzle with magazines --> select nothing
|
|
|
|
GVAR(CurrentGrenadeMuzzleFrag) = "";
|
|
|
|
if (GVAR(DisplayText)) then {
|
2015-05-28 19:59:04 +00:00
|
|
|
_text = [localize LSTRING(NoFragsLeft), [1,0,0]] call EFUNC(common,stringToColoredText);
|
2015-04-17 20:45:00 +00:00
|
|
|
[composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured);
|
|
|
|
};
|
2015-01-17 17:26:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GVAR(CurrentGrenadeMuzzleIsFrag) = true;
|