Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIDecoWeaponUnobstructed.c
Go to the documentation of this file.
1 class SCR_AIDecoWeaponUnobstructed : DecoratorScripted
2 {
3  override bool VisibleInPalette() { return true; }
4 
5  protected CharacterControllerComponent m_CharacterController;
6  protected CompartmentAccessComponent m_CompartmentAccess;
7  protected bool m_bInitialized;
8 
9  override bool TestFunction(AIAgent owner)
10  {
11  if (!m_bInitialized)
12  return false;
13 
14  // Don't care if in compartment
15  if (m_CompartmentAccess.GetCompartment())
16  return true;
17 
18  return m_CharacterController.GetWeaponObstructedState() == EWeaponObstructedState.UNOBSTRUCTED;
19  }
20 
21  override void OnInit(AIAgent owner)
22  {
23  IEntity controlledEntity = owner.GetControlledEntity();
24  m_CharacterController = CharacterControllerComponent.Cast(controlledEntity.FindComponent(CharacterControllerComponent));
25  m_CompartmentAccess = CompartmentAccessComponent.Cast(controlledEntity.FindComponent(CompartmentAccessComponent));
26  m_bInitialized = m_CharacterController && m_CompartmentAccess;
27  }
28 
29  override string GetOnHoverDescription()
30  {
31  return "Returns TRUE if current weapon is not obstructed";
32  }
33 }
m_CharacterController
SCR_CharacterPerceivableComponentClass m_CharacterController
EWeaponObstructedState
EWeaponObstructedState
Definition: EWeaponObstructedState.c:12
SCR_AIDecoWeaponUnobstructed
Definition: SCR_AIDecoWeaponUnobstructed.c:1
m_bInitialized
protected bool m_bInitialized
Definition: SCR_CampaignMilitaryBaseComponent.c:122