Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ResupplySelfSupportStationAction.c
Go to the documentation of this file.
2 {
3  [Attribute("1", desc: "Check if magazines or projectiles in owner storage. If not it will not allow to resupply. Used in tandum with arsenals")]
4  protected bool m_bCheckIfItemInStorage;
5 
6  [Attribute("0", desc: "If true allows to get storage manager from parent if not on self. Storagemanager is used to check if magazine is in the storage and is used in tandum with arsenal. Ignored if m_bCheckIfMagazineInStorage is false.")]
7  protected bool m_bAllowGetStorageFromParent;
8 
9  protected InventoryStorageManagerComponent m_InventoryManagerProvider;
10 
11  //------------------------------------------------------------------------------------------------
12  protected override void SetTargetInventory(IEntity user, IEntity owner)
13  {
14  m_InventoryManagerTarget = SCR_InventoryStorageManagerComponent.Cast(user.FindComponent(SCR_InventoryStorageManagerComponent));
15  }
16 
17  //------------------------------------------------------------------------------------------------
18  override bool CanBeShownScript(IEntity user)
19  {
20  if (!super.CanBeShownScript(user))
21  return false;
22 
23  bool canPerform = super.CanBePerformedScript(user);
24  if (!canPerform && GetShowButDisabled())
25  return true;
26 
27  return canPerform;
28  }
29 
30  //------------------------------------------------------------------------------------------------
31  override bool CanBePerformedScript(IEntity user)
32  {
33  return !GetShowButDisabled();
34  }
35 
36  //------------------------------------------------------------------------------------------------
37  protected override InventoryStorageManagerComponent GetProviderInventory()
38  {
39  return m_InventoryManagerProvider;
40  }
41 
42  //------------------------------------------------------------------------------------------------
43  protected override void ResetReferencesOnServer()
44  {
46  super.ResetReferencesOnServer();
47  }
48 
49  //------------------------------------------------------------------------------------------------
50  override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
51  {
52  super.Init(pOwnerEntity, pManagerComponent);
53 
54  //~ Get storage manager to check if ammo is in storage (Should be used only if arseneal)
55  if (m_bCheckIfItemInStorage)
56  {
57  m_InventoryManagerProvider = InventoryStorageManagerComponent.Cast(pOwnerEntity.FindComponent(InventoryStorageManagerComponent));
58  if (!m_InventoryManagerProvider && m_bAllowGetStorageFromParent && pOwnerEntity.GetParent())
59  m_InventoryManagerProvider = InventoryStorageManagerComponent.Cast(pOwnerEntity.GetParent().FindComponent(InventoryStorageManagerComponent));
60 
61  if (!m_InventoryManagerProvider)
62  Print(string.Format("'SCR_ResupplySelfSupportStationAction': %1 should check if Item is in storage but no storage manager found so this step will be ignored!", pOwnerEntity.GetName()), LogLevel.ERROR);
63  }
64  }
65 }
SCR_ResupplySelfSupportStationAction
Definition: SCR_ResupplySelfSupportStationAction.c:1
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
GetShowButDisabled
protected bool GetShowButDisabled()
Definition: SCR_ResupplySupportStationAction.c:52
InventoryStorageManagerComponent
Definition: InventoryStorageManagerComponent.c:12
Attribute
typedef Attribute
Post-process effect of scripted camera.
m_InventoryManagerTarget
protected SCR_InventoryStorageManagerComponent m_InventoryManagerTarget
Definition: SCR_ResupplySupportStationAction.c:20
SCR_BaseResupplySupportStationAction
Definition: SCR_ResupplySupportStationAction.c:3