Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIDecoTestHasMagazines.c
Go to the documentation of this file.
1 class SCR_AIDecoTestHasMagazines : DecoratorTestScripted
2 {
3  SCR_InventoryStorageManagerComponent inventoryManager;
4  BaseWeaponComponent weapon;
5 
6  protected override bool TestFunction(AIAgent agent, IEntity controlled)
7  {
8  if (!inventoryManager && !weapon)
9  {
10  GenericEntity entity = GenericEntity.Cast(controlled);
11  if ( !entity )
12  return false;
13  inventoryManager = SCR_InventoryStorageManagerComponent.Cast(entity.FindComponent(SCR_InventoryStorageManagerComponent));
14  if ( !inventoryManager )
15  return false;
16  BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast(entity.FindComponent(BaseWeaponManagerComponent));
17  if (!weaponManager)
18  return false;
19  weapon = weaponManager.GetCurrent();
20  if (!weapon)
21  return false;
22  }
23  int ammo = inventoryManager.GetMagazineCountByWeapon(weapon);
24  return ammo > 0;
25  }
26 };
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
SCR_AIDecoTestHasMagazines
Definition: SCR_AIDecoTestHasMagazines.c:1
BaseWeaponComponent
Definition: BaseWeaponComponent.c:12