Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIIsValidAction.c
Go to the documentation of this file.
1 class SCR_AIIsValidAction : DecoratorScripted
2 {
3  private SCR_AIBaseUtilityComponent m_Utility;
4  protected override bool TestFunction(AIAgent owner)
5  {
6  if (!m_Utility)
7  {
8  m_Utility = SCR_AIBaseUtilityComponent.Cast(owner.FindComponent(SCR_AIBaseUtilityComponent));
9  if (!m_Utility)
10  return false;
11  }
12 
13  SCR_AIActionBase executedAction = SCR_AIActionBase.Cast(m_Utility.GetExecutedAction());
14 
15  if (!executedAction)
16  return false;
17 
18  // There seems to be a bug that RunBT node keeps running previous tree if we provide an empty string
19  if (executedAction.m_sBehaviorTree == string.Empty)
20  return false;
21 
22  EAIActionState state = executedAction.GetActionState();
23  return state != EAIActionState.COMPLETED && state != EAIActionState.FAILED;
24  }
25 
26  protected override bool VisibleInPalette()
27  {
28  return true;
29  }
30 
31  protected override string GetOnHoverDescription()
32  {
33  return "Test if current action is still valid, or it was already completed or failed";
34  }
35 };
SCR_AIActionBase
Definition: SCR_AIAction.c:1
SCR_AIIsValidAction
Definition: SCR_AIIsValidAction.c:1
EAIActionState
EAIActionState
Definition: EAIActionState.c:12