Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIAllowLookAction.c
Go to the documentation of this file.
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;
38 if (m_CurrentBehavior)
39 m_CurrentBehavior.m_bAllowLook = false;
40 }
41 }
42
43 //------------------------------------------------------------------------------------------------
44 protected static override bool VisibleInPalette() {return true;}
45
46 //------------------------------------------------------------------------------------------------
47 static override bool CanReturnRunning() {return true;}
48
49 //------------------------------------------------------------------------------------------------
50 protected static override string GetOnHoverDescription() {return "Node that allows free look of AI unit and disallows it on abort.";}
51};
void SCR_AIBehaviorBase(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity)
Definition Node.c:13
static override bool CanReturnRunning()
static override string GetOnHoverDescription()
static override bool VisibleInPalette()
ENodeResult
Definition ENodeResult.c:13