Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIDecoTestHasMagazines.c
Go to the documentation of this file.
2{
3 SCR_InventoryStorageManagerComponent inventoryManager;
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};
proto external Managed FindComponent(typename typeName)
override bool TestFunction(AIAgent agent, IEntity controlled)