Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WeaponLoadAction.c
Go to the documentation of this file.
2 {
3  private IEntity m_Owner;
4  private IEntity m_LastObserver;
5 
6  private BaseWeaponComponent m_Weapon;
7 
8  //------------------------------------------------------------------------------------------------
9  override bool CanBeShownScript(IEntity user)
10  {
11  m_LastObserver = user;
12  return CanBePerformedScript(user);
13  }
14 
15  //------------------------------------------------------------------------------------------------
17  override bool CanBePerformedScript(IEntity user)
18  {
19  return false;
20  /*
21  if(!m_Weapon)
22  return false;
23 
24  IEntity parent = m_Owner.GetParent();
25  if (!parent)
26  return false;
27 
28  auto genericUser = GenericEntity.Cast(user);
29 
30  // Check if user is in a compartment
31  ChimeraCharacter char = ChimeraCharacter.Cast(genericUser);
32  if (char)
33  {
34  CompartmentAccessComponent comp = char.GetCompartmentAccessComponent();
35  if (comp && comp.IsInCompartment())
36  return false;
37  }
38 
39  // Check for compatible magazines
40  SCR_InventoryManagerComponent inventory = SCR_InventoryManagerComponent.Cast(genericUser.FindComponent(SCR_InventoryManagerComponent));
41  if (inventory && inventory.GetMagazineCountByWeapon(m_Weapon) <= 0)
42  return false;
43 
45  MortarMuzzleComponent mortarMuzzleComponent = MortarMuzzleComponent.Cast(m_Weapon.GetCurrentMuzzle());
46  if (mortarMuzzleComponent && mortarMuzzleComponent.GetAmmoCount() >= mortarMuzzleComponent.GetMaxAmmoCount())
47  return false;
48 
49  return true;
50  */
51  }
52 
53  //---------------------------------------------------------
55  override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
56  {
57  /*
58  GenericEntity genericUserEntity = GenericEntity.Cast(pUserEntity);
59  BaseInventoryManagerComponent baseInventoryManager = BaseInventoryManagerComponent.Cast(genericUserEntity.FindComponent(BaseInventoryManagerComponent));
60  SCR_InventoryManagerComponent inventoryManager = SCR_InventoryManagerComponent.Cast(baseInventoryManager);
61 
62  MortarMuzzleComponent mortarMuzzleComponent = MortarMuzzleComponent.Cast(m_Weapon.GetCurrentMuzzle());
63  if (mortarMuzzleComponent && mortarMuzzleComponent.GetAmmoCount() < mortarMuzzleComponent.GetMaxAmmoCount())
64  {
65  IEntity shell = inventoryManager.OnGetMagazine(mortarMuzzleComponent.GetMagazineWell());
66  inventoryManager.Remove(shell, null, true);
67  mortarMuzzleComponent.LoadMortar(shell);
68  }
69  */
70  }
71 
72  //------------------------------------------------------------------------------------------------
73  override bool GetActionNameScript(out string outName)
74  {
75  if (m_LastObserver)
76  {
77  GenericEntity watcher = GenericEntity.Cast(m_LastObserver);
78  outName = "Load";
79  return true;
80  }
81 
82  return false;
83  }
84 
85  //------------------------------------------------------------------------------------------------
86  override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
87  {
88  m_Owner = pOwnerEntity;
90  }
91 
92  //------------------------------------------------------------------------------------------------
93  /*override bool HasLocalEffectOnlyScript()
94  {
95  return true;
96  }*/
97 };
SCR_WeaponLoadAction
Definition: SCR_WeaponLoadAction.c:1
m_Weapon
IEntity m_Weapon
Definition: SCR_MeleeComponent.c:9
ScriptedUserAction
Definition: ScriptedUserAction.c:12
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
BaseWeaponComponent
Definition: BaseWeaponComponent.c:12
m_Owner
SCR_AIGroupUtilityComponentClass m_Owner