ACE3/addons/inventory/XEH_postInit.sqf
johnb432 7f998c3234
Inventory - Improve multiple aspects (#9706)
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
2024-01-06 18:26:46 -03:00

41 lines
1.7 KiB
Plaintext

#include "script_component.hpp"
if (!hasInterface) exitWith {};
// If medical_treatment is loaded, get its items
if (["ace_medical_treatment"] call EFUNC(common,isModLoaded)) then {
private _medicalList = +(uiNamespace getVariable [QGVAR(medicalItemList), createHashMap]);
_medicalList merge [uiNamespace getVariable [QEGVAR(medical_treatment,treatmentItems), createHashMap], true];
GVAR(medicalItemList) = compileFinal _medicalList;
} else {
GVAR(medicalItemList) = uiNamespace getVariable [QGVAR(medicalItemList), compileFinal createHashMap];
};
GVAR(customFilters) = [];
GVAR(selectedFilterIndex) = -1;
// Add custom filters
[LLSTRING(Grenades), QFUNC(filterGrenades)] call FUNC(addCustomFilter);
[LLSTRING(Backpacks), QFUNC(filterBackpacks)] call FUNC(addCustomFilter);
[LLSTRING(Uniforms), QFUNC(filterUniforms)] call FUNC(addCustomFilter);
[LLSTRING(Vests), QFUNC(filterVests)] call FUNC(addCustomFilter);
[LLSTRING(Headgear), QFUNC(filterHeadgear)] call FUNC(addCustomFilter);
[LLSTRING(Medical), QFUNC(filterMedical)] call FUNC(addCustomFilter);
// Used for displaying the correct name when opening a subordinate's inventory
GVAR(unit) = ACE_player;
["CAManBase", "InventoryOpened", {
params ["_unit", "_container"];
// GVAR(unit) is ACE_player by default
if (_unit isEqualTo ACE_player) exitWith {};
// If the player is a group leader and opens a subordinate's inventory or has a subordinate open the player's backpack, update name to correct unit
if (leader ACE_player == ACE_player && {(_unit in units ACE_player) || {(objectParent _container) isEqualTo ACE_player}}) then {
GVAR(unit) = _unit;
};
}] call CBA_fnc_addClassEventHandler;