mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
add more filters to ammo boxes
This commit is contained in:
parent
2b63b2efa8
commit
5d9a057165
@ -16,36 +16,44 @@ PREP(onLBSelChanged);
|
||||
|
||||
if !(uiNamespace getVariable [QGVAR(configCached), false]) then {
|
||||
private _fnc_addToCache = {
|
||||
private _displayName = getText (_x >> "displayName");
|
||||
private _picture = getText (_x >> "picture");
|
||||
private _displayName = getText (_this >> "displayName");
|
||||
private _picture = getText (_this >> "picture");
|
||||
|
||||
// list box seems to delete the leading backslash
|
||||
if (_picture select [0,1] == "\") then {
|
||||
_picture = _picture select [1];
|
||||
};
|
||||
|
||||
uiNamespace setVariable [format [QGVAR(ItemKey:%1:%2), _displayName, _picture], _x];
|
||||
uiNamespace setVariable [format [QGVAR(ItemKey:%1:%2), _displayName, _picture], _this];
|
||||
};
|
||||
|
||||
// weapons, magazines, items
|
||||
// weapons and items
|
||||
{
|
||||
if (getNumber (_x >> "scope") > 0) then _fnc_addToCache;
|
||||
if (getNumber (_x >> "scope") > 0) then {_x call _fnc_addToCache};
|
||||
false
|
||||
} count (
|
||||
("true" configClasses (configFile >> "CfgWeapons")) +
|
||||
("true" configClasses (configFile >> "CfgMagazines")) +
|
||||
("true" configClasses (configFile >> "CfgGlasses"))
|
||||
);
|
||||
|
||||
// magazines
|
||||
{
|
||||
if (getNumber (_x >> "scope") == 2) then {_x call _fnc_addToCache};
|
||||
false
|
||||
} count ("true" configClasses (configFile >> "CfgMagazines"));
|
||||
|
||||
// backpacks
|
||||
{
|
||||
if (getNumber (_x >> "scope") > 0 && {getNumber (_x >> "isBackpack") == 1}) then _fnc_addToCache;
|
||||
if (getNumber (_x >> "scope") > 0 && {getNumber (_x >> "isBackpack") == 1}) then {_x call _fnc_addToCache};
|
||||
false
|
||||
} count ("true" configClasses (configFile >> "CfgVehicles"));
|
||||
|
||||
uiNamespace setVariable [QGVAR(configCached), true];
|
||||
};
|
||||
|
||||
PREP(filterWeapons);
|
||||
PREP(filterMagazines);
|
||||
PREP(filterItems);
|
||||
PREP(filterHeadgear);
|
||||
PREP(filterUniforms);
|
||||
PREP(filterVests);
|
||||
|
17
addons/filters/functions/fnc_filterItems.sqf
Normal file
17
addons/filters/functions/fnc_filterItems.sqf
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Remove uniforms, vests and backpacks from Items filter.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Item config entry <CONFIG>
|
||||
*
|
||||
* Return Value:
|
||||
* Item should appear in this list? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_config"];
|
||||
|
||||
!(_this call FUNC(filterUniforms)) && {!(_this call FUNC(filterVests))} && {!(_this call FUNC(filterBackpacks))}
|
15
addons/filters/functions/fnc_filterMagazines.sqf
Normal file
15
addons/filters/functions/fnc_filterMagazines.sqf
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Remove backpacks and grenades from Magazines filter.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Item config entry <CONFIG>
|
||||
*
|
||||
* Return Value:
|
||||
* Item should appear in this list? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
!(_this call FUNC(filterBackpacks)) && {!(_this call FUNC(filterGrenades))}
|
15
addons/filters/functions/fnc_filterWeapons.sqf
Normal file
15
addons/filters/functions/fnc_filterWeapons.sqf
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Remove backpacks from Weapons filter.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Item config entry <CONFIG>
|
||||
*
|
||||
* Return Value:
|
||||
* Item should appear in this list? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
!(_this call FUNC(filterBackpacks))
|
@ -27,7 +27,7 @@ if (_filterFunction isEqualType {}) then {
|
||||
format [QGVAR(ItemKey:%1:%2), _itemList lbText _i, _itemList lbPicture _i],
|
||||
configNull
|
||||
];
|
||||
|
||||
diag_log text format [QGVAR(ItemKey:%1:%2), _itemList lbText _i, _itemList lbPicture _i];
|
||||
if (!isNull _config && {!(_config call _filterFunction)}) then {
|
||||
_itemList lbDelete _i;
|
||||
|
||||
|
@ -35,6 +35,11 @@ _filter ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChanged)}];
|
||||
private _nameAll = _filter lbText _index;
|
||||
_filter lbDelete _index;
|
||||
|
||||
// add additional filter functions to the default filters. These remove backpacks etc.
|
||||
_filter lbSetData [0, QFUNC(filterWeapons)];
|
||||
_filter lbSetData [1, QFUNC(filterMagazines)];
|
||||
_filter lbSetData [2, QFUNC(filterItems)];
|
||||
|
||||
// add our custom filters
|
||||
{
|
||||
_x params ["_name", "_fncName"];
|
||||
|
Loading…
Reference in New Issue
Block a user