4 [
Attribute(
desc:
"List of blacklist entries. Each blacklist becomes a button in attributes which the GM can enable and/or disable and is a set of items/item types which cannot be saved in loadout if the blacklist is activate")]
5 protected ref array<ref SCR_LoadoutSaveBlackList> m_LoadoutSaveBlackLists;
11 for (
int i = m_LoadoutSaveBlackLists.Count() - 1; i >= 0; i--)
14 if (!m_LoadoutSaveBlackLists[i].
IsEnabled() || !m_LoadoutSaveBlackLists[i].Init())
16 m_LoadoutSaveBlackLists.RemoveOrdered(i);
26 int GetLoadoutSaveBlackLists(out notnull array<SCR_LoadoutSaveBlackList> loadoutSaveBlackLists)
28 loadoutSaveBlackLists.Clear();
32 loadoutSaveBlackLists.Insert(blackList);
35 return loadoutSaveBlackLists.Count();
40 int GetBlackListsCount()
42 return m_LoadoutSaveBlackLists.Count();
49 bool IsPrefabBlacklisted(ResourceName prefab)
56 if (!blackList || !blackList.IsActive())
60 if (blackList.DoesBlackListContaintPrefab(prefab))
72 bool IsBlackListActive(
int index)
74 if (!m_LoadoutSaveBlackLists.IsIndexValid(
index))
76 Print(
"'SCR_LoadoutSaveBlackListHolder' function 'IsBlackListEnabled' given index is invalid", LogLevel.ERROR);
80 return m_LoadoutSaveBlackLists[
index].IsActive();
87 void SetBlackListActive(
int index,
bool active)
89 if (!m_LoadoutSaveBlackLists.IsIndexValid(
index))
91 Print(
"'SCR_LoadoutSaveBlackListHolder' function 'SetBlackListEnabled' given index is invalid", LogLevel.ERROR);
95 m_LoadoutSaveBlackLists[
index].SetActive(active);
102 int GetOrderedBlackListsActive(out notnull array<bool> orderedBlackListActive)
104 orderedBlackListActive.Clear();
106 array<SCR_LoadoutSaveBlackList> loadoutSaveBlackLists = {};
107 GetLoadoutSaveBlackLists(loadoutSaveBlackLists);
111 orderedBlackListActive.Insert(blackList.IsActive());
114 return orderedBlackListActive.Count();
120 void SetOrderedBlackListsActive(notnull array<bool> orderedBlackListActive)
122 for (
int i = 0, count = orderedBlackListActive.Count(); i < count; i++)
124 SetBlackListActive(i, orderedBlackListActive[i]);
133 [
Attribute(
"1",
"If blacklist is enabled or not. Disabled blacklists are removed on init and is used for mods")]
134 protected bool m_bEnabled;
136 [
Attribute(
"0",
"If blacklist is active or not. If active than the items within the prefab list can never be saved in loadouts")]
137 protected bool m_bBlackListActive;
139 [
Attribute(
desc:
"Ui info to display in editor to set blacklist saving or not")]
142 [
Attribute(
desc:
"List of entities that are blacklisted and can never be saved when player saves their loadout. Is cleared on init and any prefabs are added to a faster set.", uiwidget: UIWidgets.ResourcePickerThumbnail,
params:
"et")]
143 protected ref array<ResourceName> m_aBlackListedPrefabs;
145 [
Attribute(
desc:
"List of item type and mode that cannot be saved in loadout. This list is cleared on init and any prefabs that fit the set up are added to a faster set.")]
146 protected ref array<ref SCR_LoadoutSaveBlackListItemType> m_BlackListedItemTypes;
149 protected ref set<ResourceName> m_BlackListedPrefabs =
new set<ResourceName>();
164 SCR_EntityCatalogManagerComponent catalogManager = SCR_EntityCatalogManagerComponent.GetInstance();
168 Debug.Error2(
"SCR_LoadoutSaveBlackList",
"Black lists need the 'SCR_EntityCatalogManagerComponent' to set the the prefabs who are blacklisted. The blacklist will be disabled if the custom prefab blacklist is empty");
181 array<SCR_ArsenalItem> filteredArsenalItems = {};
187 if (blackList.m_bIgnoreItemMode)
188 catalogManager.GetAllArsenalItems(filteredArsenalItems, blackList.m_eItemType);
190 catalogManager.GetAllArsenalItems(filteredArsenalItems, blackList.m_eItemType, blackList.m_eItemMode);
221 void SetActive(
bool active)
230 bool DoesBlackListContaintPrefab(ResourceName prefab)
247 class SCR_LoadoutSaveBlackListItemType
255 [
Attribute(
"1",
desc:
"If true than the ItemMode will be ignored and any items that have the type regardless of the mode will be blacklisted", UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(
SCR_EArsenalItemMode))]
256 bool m_bIgnoreItemMode;