Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIWeaponHandlingBase.c
Go to the documentation of this file.
1 class SCR_AIWeaponHandlingBase : AITaskScripted
3 {
4  protected CharacterControllerComponent m_ControlComp;
5  protected BaseWeaponManagerComponent m_WeaponMgrComp;
6  protected SCR_InventoryStorageManagerComponent m_InventoryMgr;
7  protected CompartmentAccessComponent m_CompartmentAccessComp;
8 
9  //--------------------------------------------------------------------------------------------
10  override void OnInit(AIAgent owner)
11  {
12  IEntity controlledEnt = owner.GetControlledEntity();
13 
14  m_WeaponMgrComp = BaseWeaponManagerComponent.Cast(controlledEnt.FindComponent(BaseWeaponManagerComponent));
15  m_ControlComp = CharacterControllerComponent.Cast(controlledEnt.FindComponent(CharacterControllerComponent));
16  m_InventoryMgr = SCR_InventoryStorageManagerComponent.Cast(controlledEnt.FindComponent(SCR_InventoryStorageManagerComponent));
17  m_CompartmentAccessComp = CompartmentAccessComponent.Cast(controlledEnt.FindComponent(CompartmentAccessComponent));
18 
19  if (!m_WeaponMgrComp || !m_ControlComp || !m_InventoryMgr)
20  {
21  NodeError(this, owner, "SCR_AIWeaponHandlingBase didn't find necessary components!");
22  }
23  }
24 
25 
26  #ifdef AI_DEBUG
27  //--------------------------------------------------------------------------------------------
28  protected SCR_AIInfoBaseComponent m_InfoComp; // Needed only for debugging
29  protected void AddDebugMessage(string str, LogLevel logLevel = LogLevel.NORMAL)
30  {
31  if (!m_InfoComp)
32  {
33  IEntity owner = m_ControlComp.GetOwner();
34  AIControlComponent controlComp = AIControlComponent.Cast(owner.FindComponent(AIControlComponent));
35  AIAgent agent = controlComp.GetAIAgent();
36  SCR_AIInfoBaseComponent infoComp = SCR_AIInfoBaseComponent.Cast(agent.FindComponent(SCR_AIInfoBaseComponent));
37  m_InfoComp = infoComp;
38  }
39 
40  m_InfoComp.AddDebugMessage(str, msgType: EAIDebugMsgType.WEAPON, logLevel);
41  }
42  #endif
43 }
EAIDebugMsgType
EAIDebugMsgType
Definition: SCR_AIDebugMessage.c:1
NodeError
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition: NodeError.c:3
SCR_AIWeaponHandlingBase
Base class for nodes which handle magazine switching.
Definition: SCR_AIWeaponHandlingBase.c:2