Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
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"
)]
6
class
SCR_EntityCatalogInventoryItem
:
SCR_EntityCatalogEntryNonEditable
7
{
8
//--------------------------------- Class Specific Init ---------------------------------\\
9
protected override void ClassSpecificInit()
10
{
11
if
(
m_EditableEntityUiInfo
!= null)
12
return
;
13
14
Resource
resource =
Resource
.Load(
GetPrefab
());
15
if
(!resource || !resource.IsValid())
16
return
;
17
18
IEntitySource
entitySource =
SCR_BaseContainerTools
.FindEntitySource(resource);
19
if
(!entitySource)
20
return
;
21
22
UIInfo
uiInfo;
23
24
//~ Get UI info from weapon
25
IEntityComponentSource
weaponEntitySource =
SCR_ComponentHelper
.GetWeaponComponentSource(entitySource);
26
if
(weaponEntitySource)
27
{
28
uiInfo =
SCR_ComponentHelper
.GetWeaponComponentInfo(weaponEntitySource);
29
30
if
(uiInfo)
31
{
32
m_EditableEntityUiInfo
=
SCR_UIInfo
.
CreateInfo
(uiInfo);
33
return
;
34
}
35
}
36
37
//~ Get UI info from item
38
IEntityComponentSource
inventoryEntitySource =
SCR_ComponentHelper
.GetInventoryItemComponentSource(entitySource);
39
if
(inventoryEntitySource)
40
{
41
SCR_ItemAttributeCollection
inventoryEntityUiInfo =
SCR_ComponentHelper
.GetInventoryItemInfo(inventoryEntitySource);
42
if
(inventoryEntityUiInfo)
43
{
44
uiInfo = inventoryEntityUiInfo.GetUIInfo();
45
46
if
(uiInfo)
47
{
48
m_EditableEntityUiInfo
=
SCR_UIInfo
.
CreateInfo
(uiInfo);
49
return
;
50
}
51
}
52
}
53
54
//~ No UI info found so create new invalid
55
if
(!
m_EditableEntityUiInfo
)
56
{
57
Print
(
"Catalog Entry: '"
+
GetPrefab
() +
"' could not create UIinfo for inventory item. Non was found for weapon nor Inventory item data"
,
LogLevel
.WARNING);
58
m_EditableEntityUiInfo
=
new
SCR_UIInfo
();
59
m_EditableEntityUiInfo
.CreateInfo(
"MISSING"
);
60
}
61
}
62
};
63
64
//~ Custom title to show Type of inventory
65
class
SCR_BaseContainerCustomInventoryCatalogEntry
:
BaseContainerCustomTitle
66
{
67
protected
string
m_sPrefabName
;
68
protected
string
m_sDataListName
;
69
protected
string
m_sEnabledName
;
70
71
//------------------------------------------------------------------------------------------------
72
void
SCR_BaseContainerCustomInventoryCatalogEntry
(
string
prefabName,
string
dataListName,
string
enabledName)
73
{
74
m_sPrefabName
= prefabName;
75
m_sDataListName
= dataListName;
76
m_sEnabledName
= enabledName;
77
}
78
79
//------------------------------------------------------------------------------------------------
80
override
bool
_WB_GetCustomTitle
(
BaseContainer
source, out
string
title)
81
{
82
bool
enabled;
83
if
(!source.Get(
m_sEnabledName
, enabled))
84
return
false
;
85
86
ResourceName
path
;
87
if
(!source.Get(
m_sPrefabName
,
path
))
88
return
false
;
89
90
if
(!
path
.IsEmpty())
91
{
92
title =
FilePath
.StripPath(
path
.GetPath());
93
}
94
else
95
{
96
title =
"NO PREFAB"
97
}
98
99
array<ref SCR_BaseEntityCatalogData> entityDataList;
100
if
(!source.Get(
m_sDataListName
, entityDataList))
101
return
false
;
102
103
string
typeTitle, modeTitle;
104
SCR_ArsenalItem
arsenalItem;
105
106
//~ Show specific type info if ArsenalItem
107
foreach
(
SCR_BaseEntityCatalogData
data
: entityDataList)
108
{
109
arsenalItem =
SCR_ArsenalItem
.Cast(
data
);
110
if
(arsenalItem)
111
{
112
//~ Show type
113
typeTitle =
typename
.EnumToString(
SCR_EArsenalItemType
, arsenalItem.
GetItemType
());
114
title = title +
" ~ "
+ typeTitle;
115
116
//~ Only show mode if not default
117
if
(arsenalItem.
GetItemMode
() !=
SCR_EArsenalItemMode
.DEFAULT)
118
{
119
modeTitle =
typename
.EnumToString(
SCR_EArsenalItemMode
, arsenalItem.
GetItemMode
());
120
title = title +
" - "
+ modeTitle
121
}
122
}
123
}
124
125
//~ Disabled so do not show types
126
if
(!enabled)
127
title =
"DISABLED - "
+ title;
128
129
return
true
;
130
}
131
};
path
string path
Definition
AddonBuildInfoTool.c:249
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
SCR_EArsenalItemMode
SCR_EArsenalItemMode
Definition
SCR_EArsenalItemMode.c:2
SCR_EArsenalItemType
SCR_EArsenalItemType
Definition
SCR_EArsenalItemType.c:3
data
Get all prefabs that have the spawner data
Definition
SCR_EntityCatalogManagerComponent.c:320
BaseContainerCustomTitle
Definition
BaseContainerCustomTitle.c:35
BaseContainer
Definition
BaseContainer.c:13
FilePath
Definition
FilePath.c:13
IEntityComponentSource
Definition
IEntityComponentSource.c:13
IEntitySource
Definition
IEntitySource.c:13
Resource
Object holding reference to resource. In destructor release the resource.
Definition
Resource.c:25
ResourceName
Definition
ResourceName.c:13
SCR_ArsenalItem
Definition
SCR_ArsenalItem.c:3
SCR_ArsenalItem::GetItemType
SCR_EArsenalItemType GetItemType()
Definition
SCR_ArsenalItem.c:39
SCR_ArsenalItem::GetItemMode
SCR_EArsenalItemMode GetItemMode()
Definition
SCR_ArsenalItem.c:46
SCR_BaseContainerCustomInventoryCatalogEntry
Definition
SCR_EntityCatalogInventoryItem.c:66
SCR_BaseContainerCustomInventoryCatalogEntry::m_sPrefabName
string m_sPrefabName
Definition
SCR_EntityCatalogInventoryItem.c:67
SCR_BaseContainerCustomInventoryCatalogEntry::_WB_GetCustomTitle
override bool _WB_GetCustomTitle(BaseContainer source, out string title)
Definition
SCR_EntityCatalogInventoryItem.c:80
SCR_BaseContainerCustomInventoryCatalogEntry::m_sEnabledName
string m_sEnabledName
Definition
SCR_EntityCatalogInventoryItem.c:69
SCR_BaseContainerCustomInventoryCatalogEntry::m_sDataListName
string m_sDataListName
Definition
SCR_EntityCatalogInventoryItem.c:68
SCR_BaseContainerCustomInventoryCatalogEntry::SCR_BaseContainerCustomInventoryCatalogEntry
void SCR_BaseContainerCustomInventoryCatalogEntry(string prefabName, string dataListName, string enabledName)
Definition
SCR_EntityCatalogInventoryItem.c:72
SCR_BaseContainerTools
Definition
SCR_BaseContainerTools.c:4
SCR_BaseEntityCatalogData
Definition
SCR_BaseEntityCatalogData.c:6
SCR_ComponentHelper
Definition
SCR_ComponentHelper.c:2
SCR_EntityCatalogEntry::GetPrefab
Get Prefab data return Prefab data *ResourceName GetPrefab()
Definition
SCR_EntityCatalogEntry.c:51
SCR_EntityCatalogEntry::m_EditableEntityUiInfo
ref SCR_UIInfo m_EditableEntityUiInfo
Definition
SCR_EntityCatalogEntry.c:20
SCR_EntityCatalogEntryNonEditable
Definition
SCR_EntityCatalogEntryNonEditable.c:6
SCR_EntityCatalogInventoryItem
Definition
SCR_EntityCatalogInventoryItem.c:7
SCR_ItemAttributeCollection
Definition
SCR_ItemAttributeCollection.c:3
SCR_UIInfo
Definition
SCR_UIInfo.c:8
SCR_UIInfo::CreateInfo
static SCR_UIInfo CreateInfo(UIInfo source)
Definition
SCR_UIInfo.c:146
UIInfo
UIInfo - allows to define UI elements.
Definition
UIInfo.c:14
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
scripts
Game
EntityCatalog
EntityCatalogEntry
SCR_EntityCatalogInventoryItem.c
Generated by
1.17.0