Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIAllowLookAction.c
Go to the documentation of this file.
1 class SCR_AIAllowLookAction : AITaskScripted
2 {
3  private SCR_AIBehaviorBase m_CurrentBehavior;
4  private bool m_bLookAllowed;
5 
6 
7  //------------------------------------------------------------------------------------------------
8  override void OnEnter(AIAgent owner)
9  {
10  SCR_AIUtilityComponent utility = SCR_AIUtilityComponent.Cast(owner.FindComponent(SCR_AIUtilityComponent));
11  m_CurrentBehavior = utility.GetCurrentBehavior();
12  }
13 
14  //------------------------------------------------------------------------------------------------
15  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
16  {
17  if (!m_CurrentBehavior)
18  return ENodeResult.FAIL;
19 
20  if(!m_CurrentBehavior.m_bAllowLook)
21  {
22  m_CurrentBehavior.m_bAllowLook = true;
23  m_bLookAllowed = true;
24  }
25 
26  if (m_bLookAllowed)
27  return ENodeResult.RUNNING;
28  else
29  return ENodeResult.SUCCESS;
30  }
31 
32  //------------------------------------------------------------------------------------------------
33  override void OnAbort(AIAgent owner, Node nodeCausingAbort)
34  {
35  if (m_bLookAllowed)
36  {
37  m_bLookAllowed = false;
39  m_CurrentBehavior.m_bAllowLook = false;
40  }
41  }
42 
43  //------------------------------------------------------------------------------------------------
44  protected override bool VisibleInPalette() {return true;}
45 
46  //------------------------------------------------------------------------------------------------
47  override bool CanReturnRunning() {return true;}
48 
49  //------------------------------------------------------------------------------------------------
50  protected override string GetOnHoverDescription() {return "Node that allows free look of AI unit and disallows it on abort.";}
51 };
SCR_AIAllowLookAction
Definition: SCR_AIAllowLookAction.c:1
m_CurrentBehavior
ref SCR_AIBehaviorBase m_CurrentBehavior
Used for avoiding constant casting, outside of this class use GetCurrentBehavior()
Definition: SCR_AIUtilityComponent.c:19
SCR_AIBehaviorBase
Definition: SCR_AIBehavior.c:1