Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EntityCatalogInventoryItem.c
Go to the documentation of this file.
1 
4 //[BaseContainerProps(), BaseContainerCustomDoubleCheckIntResourceNameTitleField("m_bEnabled", "m_sEntityPrefab", 1, "(Item) %1", "DISABLED - (Item) %1")]
5 [BaseContainerProps(), SCR_BaseContainerCustomInventoryCatalogEntry("m_sEntityPrefab", "m_aEntityDataList", "m_bEnabled")]
7 {
8  //======================================== UI INFO ========================================\\
9  //--------------------------------- UI Info not supported ---------------------------------\\
10  override SCR_UIInfo GetEntityUiInfo()
11  {
12  Print("Getting UIInfo from Inventory Items is not supported from Catalog. Get it from InventoryItemComponent after spawning instead!", LogLevel.WARNING);
13 
14  //~ Returns emtpy UIInfo for now. Also to make sure autotest succeeds
15  return new SCR_UIInfo();
16  }
17 };
18 
19 //~ Custom title to show Type of inventory
20 class SCR_BaseContainerCustomInventoryCatalogEntry : BaseContainerCustomTitle
21 {
22  protected string m_sPrefabName;
23  protected string m_sDataListName;
24  protected string m_sEnabledName;
25 
26  //------------------------------------------------------------------------------------------------
27  void SCR_BaseContainerCustomInventoryCatalogEntry(string prefabName, string dataListName, string enabledName)
28  {
29  m_sPrefabName = prefabName;
30  m_sDataListName = dataListName;
31  m_sEnabledName = enabledName;
32  }
33 
34  //------------------------------------------------------------------------------------------------
35  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
36  {
37  bool enabled;
38  if (!source.Get(m_sEnabledName, enabled))
39  return false;
40 
41  ResourceName path;
42  if (!source.Get(m_sPrefabName, path))
43  return false;
44 
45  if (!path.IsEmpty())
46  {
47  title = FilePath.StripPath(path.GetPath());
48  }
49  else
50  {
51  title = "NO PREFAB"
52  }
53 
54  array<ref SCR_BaseEntityCatalogData> entityDataList;
55  if (!source.Get(m_sDataListName, entityDataList))
56  return false;
57 
58  string typeTitle, modeTitle;
59  SCR_ArsenalItem arsenalItem;
60 
61  //~ Show specific type info if ArsenalItem
62  foreach (SCR_BaseEntityCatalogData data: entityDataList)
63  {
64  arsenalItem = SCR_ArsenalItem.Cast(data);
65  if (arsenalItem)
66  {
67  //~ Show type
68  typeTitle = typename.EnumToString(SCR_EArsenalItemType, arsenalItem.GetItemType());
69  title = title + " ~ " + typeTitle;
70 
71  //~ Only show mode if not default
72  if (arsenalItem.GetItemMode() != SCR_EArsenalItemMode.DEFAULT)
73  {
74  modeTitle = typename.EnumToString(SCR_EArsenalItemMode, arsenalItem.GetItemMode());
75  title = title + " - " + modeTitle
76  }
77  }
78  }
79 
80  //~ Disabled so do not show types
81  if (!enabled)
82  title = "DISABLED - " + title;
83 
84  return true;
85  }
86 };
SCR_EntityCatalogInventoryItem
Definition: SCR_EntityCatalogInventoryItem.c:6
SCR_BaseEntityCatalogData
Definition: SCR_BaseEntityCatalogData.c:5
SCR_EArsenalItemMode
SCR_EArsenalItemMode
Definition: SCR_EArsenalItemMode.c:1
SCR_EArsenalItemType
SCR_EArsenalItemType
Definition: SCR_EArsenalItemType.c:2
SCR_UIInfo
Definition: SCR_UIInfo.c:7
SCR_BaseContainerCustomInventoryCatalogEntry
Definition: SCR_EntityCatalogInventoryItem.c:20
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
SCR_EntityCatalogEntryNonEditable
Definition: SCR_EntityCatalogEntryNonEditable.c:5
SCR_ArsenalItem
Definition: SCR_ArsenalItem.c:2
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468