2015-08-04 01:08:21 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Find the next Grenade Muzzle.
|
|
|
|
*
|
2015-08-08 12:40:23 +00:00
|
|
|
* Arguments:
|
2015-08-04 01:08:21 +00:00
|
|
|
* 0: Grenade Type ("All", "Frag", "NonFrag") <STRING>
|
|
|
|
*
|
2015-08-08 12:40:23 +00:00
|
|
|
* Return Value:
|
2015-08-04 01:08:21 +00:00
|
|
|
* Class name of next throw muzzle <STRING>
|
2015-08-08 12:40:23 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* ["All"] call ace_weaponselect_fnc_findNextGrenadeMuzzle
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-08-04 01:08:21 +00:00
|
|
|
*/
|
2015-01-17 17:26:51 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-04 01:08:21 +00:00
|
|
|
private ["_allMags", "_allMuzzles", "_magazines", "_start", "_index", "_nextMuzzle"];
|
2015-01-17 17:26:51 +00:00
|
|
|
|
2015-08-04 01:08:21 +00:00
|
|
|
params ["_type"];
|
2015-01-17 17:26:51 +00:00
|
|
|
|
|
|
|
_allMags = missionNamespace getVariable [format [QGVAR(%1Magazines), _type], []];
|
|
|
|
_allMuzzles = missionNamespace getVariable [format [QGVAR(%1Muzzles), _type], []];
|
|
|
|
|
|
|
|
_magazines = magazines ACE_player;
|
|
|
|
|
|
|
|
_start = [GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag);
|
|
|
|
_index = _allMuzzles find _start;
|
|
|
|
|
|
|
|
scopeName "SearchMain";
|
|
|
|
|
|
|
|
_nextMuzzle = "";
|
|
|
|
for "_index" from (_index + 1) to (count _allMuzzles - 1) do {
|
|
|
|
{
|
|
|
|
if (_x in (_allMags select _index)) exitWith {_nextMuzzle = _allMuzzles select _index; breakTo "SearchMain"};
|
|
|
|
} count _magazines;
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_nextMuzzle != "") exitWith {_nextMuzzle};
|
|
|
|
|
|
|
|
for "_index" from 0 to _index do {
|
|
|
|
{
|
|
|
|
if (_x in (_allMags select _index)) exitWith {_nextMuzzle = _allMuzzles select _index; breakTo "SearchMain"};
|
|
|
|
} count _magazines;
|
|
|
|
};
|
|
|
|
|
|
|
|
_nextMuzzle
|