Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AICharacterLeanOnAbort.c
Go to the documentation of this file.
1 class SCR_AICharacterLeanOnAbort: AITaskScripted
2 {
3  protected bool m_bAbortDone;
4 
5  //-----------------------------------------------------------------------------------------------------------------------------------------
6  protected override bool VisibleInPalette()
7  {
8  return true;
9  }
10 
11  //-----------------------------------------------------------------------------------------------------------------------------------------
12  protected override bool CanReturnRunning()
13  {
14  return true;
15  }
16 
17  //-----------------------------------------------------------------------------------------------------------------------------------------
18  protected override void OnEnter(AIAgent owner)
19  {
20  m_bAbortDone = false;
21  }
22 
23  //-----------------------------------------------------------------------------------------------------------------------------------------
24  protected override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
25  {
26  return ENodeResult.RUNNING;
27  }
28 
29  //-----------------------------------------------------------------------------------------------------------------------------------------
30  protected override void OnAbort(AIAgent owner, Node nodeCausingAbort)
31  {
32  if (m_bAbortDone)
33  return;
34  IEntity ent = owner.GetControlledEntity();
35  if (!ent)
36  {
37  NodeError(this, owner, "Abort called on AIAgent without entity. Invalid usage.");
38  };
39  CharacterControllerComponent cc = CharacterControllerComponent.Cast(ent.FindComponent(CharacterControllerComponent));
40  if (cc && cc.IsLeaning())
41  {
42  cc.SetWantedLeaning(0);
43  };
44  m_bAbortDone = true;
45  }
46 
47  //-----------------------------------------------------------------------------------------------------------------------------------------
48  override static string GetOnHoverDescription()
49  {
50  return "Clears leaning state of owner entity OnAbort";
51  }
52 };
SCR_AICharacterLeanOnAbort
Definition: SCR_AICharacterLeanOnAbort.c:1
NodeError
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition: NodeError.c:3