Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ComponentHelper.c
Go to the documentation of this file.
2 {
3  //------------------------------------------------------------------------------------------------
7  static IEntityComponentSource GetWeaponComponentSource(IEntitySource entitySource)
8  {
9  if (!entitySource)
10  return null;
11 
12  int componentsCount = entitySource.GetComponentCount();
13  for (int i = 0; i < componentsCount; i++)
14  {
15  IEntityComponentSource componentSource = entitySource.GetComponent(i);
16  if (componentSource.GetClassName().ToType().IsInherited(WeaponComponent))
17  return componentSource;
18  }
19  return null;
20  }
21 
22  //------------------------------------------------------------------------------------------------
26  static WeaponUIInfo GetWeaponComponentInfo(IEntityComponentSource componentSource)
27  {
28  BaseContainer infoSource = componentSource.GetObject("UIInfo");
29  if (!infoSource)
30  return null;
31 
32  WeaponUIInfo info = WeaponUIInfo.Cast(BaseContainerTools.CreateInstanceFromContainer(infoSource));
33  return info;
34  }
35 
36  //------------------------------------------------------------------------------------------------
40  static IEntityComponentSource GetInventoryItemComponentSource(IEntitySource entitySource)
41  {
42  if (!entitySource)
43  return null;
44 
45  int componentsCount = entitySource.GetComponentCount();
46  for (int i = 0; i < componentsCount; i++)
47  {
48  IEntityComponentSource componentSource = entitySource.GetComponent(i);
49  if (componentSource.GetClassName().ToType().IsInherited(InventoryItemComponent))
50  return componentSource;
51  }
52  return null;
53  }
54 
55  //------------------------------------------------------------------------------------------------
59  static SCR_ItemAttributeCollection GetInventoryItemInfo(IEntityComponentSource componentSource)
60  {
61  BaseContainer infoSource = componentSource.GetObject("Attributes");
62  if (!infoSource)
63  return null;
64 
65  SCR_ItemAttributeCollection attributeCollection = SCR_ItemAttributeCollection.Cast(BaseContainerTools.CreateInstanceFromContainer(infoSource));
66  return attributeCollection;
67  }
68 };
SCR_ComponentHelper
Definition: SCR_ComponentHelper.c:1
WeaponUIInfo
Definition: WeaponUIInfo.c:3
InventoryItemComponent
Definition: InventoryItemComponent.c:12
SCR_ItemAttributeCollection
Definition: SCR_ItemAttributeCollection.c:2