Should be faster

This commit is contained in:
IT07 2016-06-23 22:38:21 +02:00
parent 10b59ab1ee
commit 72bc999ed6

View File

@ -26,27 +26,22 @@ if (_this isEqualType []) then
{ // Select random scope { // Select random scope
private ["_scopes"]; private ["_scopes"];
_scopes = getArray (configFile >> "CfgWeapons" >> _primaryWeapon >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems"); _scopes = getArray (configFile >> "CfgWeapons" >> _primaryWeapon >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems");
if ("allowTWS" call VEMFr_fnc_getSetting isEqualTo 0) then if (("allowTWS" call VEMFr_fnc_getSetting) isEqualTo 0) then
{ {
private["_indexes"]; private["_forbiddenScopes"];
_indexes = []; _forbiddenScopes = [];
{ {
if (_x find "tws" > -1) then if (((toLower _x) find "tws") > -1) then
{ {
_indexes pushBack _forEachIndex; _forbiddenScopes pushBack _x;
} else
{
if (_x find "TWS" > -1) then
{
_indexes pushBack _forEachIndex;
};
}; };
} forEach _scopes; } forEach _scopes;
{ {
_scopes deleteAt _x; _index = _scopes find _x;
} forEach _indexes; _scopes deleteAt _index;
} forEach _forbiddenScopes;
}; };
_unit addPrimaryWeaponItem (selectRandom _scopes); _unit addPrimaryWeaponItem (selectRandom _scopes);
}; };
if (selectRandom _randomPattern isEqualTo 1) then if (selectRandom _randomPattern isEqualTo 1) then
{ // Select random muzzle { // Select random muzzle