mirror of
https://github.com/acemod/ACE3.git
synced 2025-07-26 05:12:54 +00:00
49 lines
2.0 KiB
Plaintext
49 lines
2.0 KiB
Plaintext
#include "script_component.hpp"
|
|
params ["_configCategory", "_className", "_ctrlPanel", ["_pictureEntryName", "picture", [""]]];
|
|
|
|
private _cacheNamespace = _ctrlPanel; //For better readability.
|
|
|
|
private _cachedItemInfo = _cacheNamespace getVariable [_configCategory+_className, []];
|
|
|
|
//_cachedItemInfo == [_displayName, _itemPicture, _modPicture, _modID]
|
|
|
|
if (_cachedItemInfo isEqualTo []) then {//Not in cache. So get info and put into cache.
|
|
|
|
private _configPath = configFile >> _configCategory >> _className;
|
|
|
|
_cachedItemInfo set [0, getText (_configPath >> "displayName")];
|
|
//if _pictureEntryName is empty then this item has no Icons. (Faces)
|
|
_cachedItemInfo set [1, if (_pictureEntryName isEqualTo "") then {""} else {getText (_configPath >> _pictureEntryName)}];
|
|
|
|
//get name of DLC
|
|
private _dlcName = "";
|
|
private _addons = configsourceaddonlist _configPath;
|
|
if !(_addons isEqualTo []) then {
|
|
private _mods = configsourcemodlist (configfile >> "CfgPatches" >> _addons select 0);
|
|
if !(_mods isEqualTo []) then {
|
|
_dlcName = _mods select 0;
|
|
};
|
|
};
|
|
|
|
if (_dlcName != "") then {
|
|
_cachedItemInfo set [2, (modParams [_dlcName,["logo"]]) param [0,""]];//mod picture
|
|
_modID = GVAR(modList) find _dlcName;
|
|
if (_modID < 0) then {_modID = GVAR(modList) pushback _dlcName;};//We keep a ordered list of all mods for sorting later.
|
|
_cachedItemInfo set [3, _modID];//mod ID
|
|
} else {
|
|
_cachedItemInfo set [2, ""];//mod picture
|
|
_cachedItemInfo set [3, 0];//mod ID
|
|
};
|
|
_cacheNamespace setVariable [_configCategory+_className, _cachedItemInfo];
|
|
};
|
|
|
|
_cachedItemInfo params ["_displayName", "_itemPicture", "_modPicture", "_modID"];
|
|
|
|
private _lbAdd = _ctrlPanel lbAdd _displayName;
|
|
|
|
_ctrlPanel lbSetData [_lbAdd, _className];
|
|
_ctrlPanel lbSetPicture [_lbAdd, _itemPicture];
|
|
_ctrlPanel lbSetPictureRight [_lbAdd,["",_modPicture] select (GVAR(enableModIcons))];
|
|
_ctrlPanel lbSetValue [_lbAdd,_modID];
|
|
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];
|