11 static const string PORT_MAGAZINE_COUNT =
"MagazineCountOut";
15 [
Attribute(
"0", UIWidgets.EditBox,
"Test Value" )]
16 protected int m_iNumberOfMagazines;
18 protected SCR_InventoryStorageManagerComponent m_inventoryManager;
20 protected int prevAmmo;
24 protected static ref TStringArray s_aVarsOut = {
27 override TStringArray GetVariablesOut()
32 override void OnInit(AIAgent owner)
34 m_entity = owner.GetControlledEntity();
37 protected override bool TestFunction(AIAgent owner)
39 if (m_entity && !m_weapon)
41 m_inventoryManager = SCR_InventoryStorageManagerComponent.Cast(m_entity.FindComponent(SCR_InventoryStorageManagerComponent));
42 BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast(m_entity.FindComponent(BaseWeaponManagerComponent));
44 m_weapon = weaponManager.GetCurrent();
47 if (!m_inventoryManager || !m_weapon)
49 int ammo = m_inventoryManager.GetMagazineCountByWeapon(m_weapon);
55 result = ammo == m_iNumberOfMagazines;
60 result = ammo > m_iNumberOfMagazines;
65 result = ammo < m_iNumberOfMagazines;
70 result = ammo != prevAmmo;
75 SetVariableOut(PORT_MAGAZINE_COUNT, ammo);
79 protected override bool VisibleInPalette()
84 override protected string GetNodeMiddleText()
86 return "Checks: " +
typename.EnumToString(
EVariableTestType,m_TestType) +
" with value: " + m_iNumberOfMagazines.ToString();
89 protected override string GetOnHoverDescription()
91 return "Decorator that tests if entity has a weapon specified in attribute either as weapon type or as magazine well, in that case it returns the weapon type of the weapon";