Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ResourceStorageOpenAction.c
Go to the documentation of this file.
2 {
3  [Attribute(defvalue: EResourceType.SUPPLIES.ToString(), uiwidget: UIWidgets.ComboBox, desc: "Sets the type of Resource to be used.\nOnly a transaction matching Resource types can be successfully concluded.", enums: ParamEnumArray.FromEnum(EResourceType))]
4  protected EResourceType m_eResourceType;
5  protected IEntity m_TopMostOwner;
6 
7  //------------------------------------------------------------------------------------------------
8  override event bool CanBePerformedScript(IEntity user)
9  {
10  m_TopMostOwner = GetOwner();
11  IEntity topOwner = m_TopMostOwner.GetParent();
12 
13  while (topOwner)
14  {
15  SCR_ResourceComponent component = SCR_ResourceComponent.Cast(topOwner.FindComponent(SCR_ResourceComponent));
16 
17  if (component && component.GetEncapsulator(m_eResourceType))
18  m_TopMostOwner = topOwner;
19 
20  topOwner = topOwner.GetParent();
21  }
22 
23  return super.CanBePerformedScript(user);
24  }
25 
26  #ifndef DISABLE_INVENTORY
27  //------------------------------------------------------------------------------------------------
28  override protected void PerformActionInternal(SCR_InventoryStorageManagerComponent manager, IEntity pOwnerEntity, IEntity pUserEntity)
29  {
30  m_TopMostOwner = pOwnerEntity;
31  IEntity topOwner = m_TopMostOwner.GetParent();
32 
33  while (topOwner)
34  {
35  SCR_ResourceComponent component = SCR_ResourceComponent.Cast(topOwner.FindComponent(SCR_ResourceComponent));
36 
37  if (component && component.GetEncapsulator(m_eResourceType))
38  m_TopMostOwner = topOwner;
39 
40  topOwner = topOwner.GetParent();
41  }
42 
43  SCR_InventoryStorageManagerComponent manager2 = SCR_InventoryStorageManagerComponent.Cast(m_TopMostOwner.FindComponent( SCR_InventoryStorageManagerComponent ));
44 
45  if ( !manager2 )
46  return;
47 
48  super.PerformActionInternal(manager2, m_TopMostOwner, pUserEntity);
49  }
50  #endif
51 
52  //------------------------------------------------------------------------------------------------
53  override event void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
54  {
55  m_TopMostOwner = pOwnerEntity;
56  IEntity topOwner = pOwnerEntity.GetParent();
57 
58  while (topOwner)
59  {
60  SCR_ResourceComponent component = SCR_ResourceComponent.Cast(topOwner.FindComponent(SCR_ResourceComponent));
61 
62  if (component && component.GetEncapsulator(m_eResourceType))
63  m_TopMostOwner = topOwner;
64 
65  topOwner = topOwner.GetParent();
66  }
67  }
68 }
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_ResourceStorageOpenAction
Definition: SCR_ResourceStorageOpenAction.c:1
EResourceType
EResourceType
Definition: SCR_ResourceContainer.c:1
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
SCR_OpenStorageAction
modded version for to be used with the inventory 2.0
Definition: SCR_OpenStorageAction.c:3