2015-12-11 00:02:15 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2016-03-06 05:53:59 +00:00
|
|
|
// cache config
|
|
|
|
// items in the inventory display can only be distinguished by their lb names and pictures
|
|
|
|
// this can cause collisions (mainly weapons with attachments),
|
|
|
|
// but if the item has the same name and picture it at least shouldn't change the filter anyway
|
|
|
|
// luckily we don't need private items, so dummy and parent classes are out of the picture
|
|
|
|
|
|
|
|
GVAR(ItemKeyNamespace) = [] call CBA_fnc_createNamespace;
|
2019-02-17 17:41:48 +00:00
|
|
|
private _allItems = uiNamespace getVariable [QGVAR(ItemKeyCache), []]; //See XEH_preStart.sqf
|
2016-03-06 05:53:59 +00:00
|
|
|
|
2019-02-17 17:41:48 +00:00
|
|
|
// isEqualType is hacking protection as we cannot trust that the cache hasn't been manipulated
|
|
|
|
{
|
|
|
|
if (_x isEqualType [] && {_x isEqualTypeArray ["", configNull]}) then {
|
|
|
|
GVAR(ItemKeyNamespace) setVariable _x;
|
2016-03-06 05:53:59 +00:00
|
|
|
};
|
2019-02-17 17:41:48 +00:00
|
|
|
} forEach ([[], _allItems] select (_allItems isEqualType []));
|
2016-03-06 05:53:59 +00:00
|
|
|
|
2015-12-11 00:02:15 +00:00
|
|
|
GVAR(customFilters) = [];
|
|
|
|
GVAR(selectedFilterIndex) = -1;
|
|
|
|
|
|
|
|
// add custom filters
|
|
|
|
|
2019-02-17 17:41:48 +00:00
|
|
|
// get list of grenades
|
|
|
|
GVAR(Grenades_ItemList) = uiNamespace getVariable [QGVAR(Grenades_ItemList), []];
|
|
|
|
if (!(GVAR(Grenades_ItemList) isEqualType [])) then {GVAR(Grenades_ItemList) = []};
|
2015-12-11 00:02:15 +00:00
|
|
|
|
2015-12-11 12:14:58 +00:00
|
|
|
[localize LSTRING(Grenades), QFUNC(filterGrenades)] call FUNC(addCustomFilter);
|
|
|
|
|
|
|
|
[localize LSTRING(Backpacks), QFUNC(filterBackpacks)] call FUNC(addCustomFilter);
|
|
|
|
[localize LSTRING(Uniforms), QFUNC(filterUniforms)] call FUNC(addCustomFilter);
|
2015-12-11 00:02:15 +00:00
|
|
|
[localize LSTRING(Vests), QFUNC(filterVests)] call FUNC(addCustomFilter);
|
2015-12-11 12:14:58 +00:00
|
|
|
[localize LSTRING(Headgear), QFUNC(filterHeadgear)] call FUNC(addCustomFilter);
|
|
|
|
|
2019-02-17 17:41:48 +00:00
|
|
|
// get list of medical items
|
|
|
|
GVAR(Medical_ItemList) = uiNamespace getVariable [QGVAR(Medical_ItemList), []];
|
|
|
|
if (!(GVAR(Medical_ItemList) isEqualType [])) then {GVAR(Medical_ItemList) = []};
|
2015-12-11 12:14:58 +00:00
|
|
|
|
|
|
|
[localize LSTRING(Medical), QFUNC(filterMedical)] call FUNC(addCustomFilter);
|