ACE3/addons/inventory/XEH_postInit.sqf

42 lines
1.8 KiB
Plaintext
Raw Normal View History

2015-12-11 00:02:15 +00:00
#include "script_component.hpp"
if (!hasInterface) exitWith {};
// 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;
private _allItems = uiNamespace getVariable [QGVAR(ItemKeyCache), []]; //See XEH_preStart.sqf
// 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;
};
} forEach ([[], _allItems] select (_allItems isEqualType []));
2015-12-11 00:02:15 +00:00
GVAR(customFilters) = [];
GVAR(selectedFilterIndex) = -1;
// add custom filters
// 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);
// 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);