Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIDebugCounter.c
Go to the documentation of this file.
1 // Node for debug and test purpouses
2 class SCR_AIDebugCounter : AITaskScripted
3 {
4  [Attribute("0", UIWidgets.CheckBox, "Fail node after simulate?")]
5  protected bool m_bFailAfter;
6 
7  [Attribute("0", UIWidgets.CheckBox, "Running until OnAbort")]
8  protected bool m_bWaitOnAbort;
9 
10  [Attribute("0", UIWidgets.CheckBox, "Increment OnAbort")]
11  protected bool m_bIncrementOnAbort;
12 
13  [Attribute("", UIWidgets.Auto, "Echo when increased")]
14  protected string m_sDebugMessage;
15 
16  static const string PORT_VAR_IN = "Counter";
17  static const string PORT_VAR_OUT= "Out";
18 
19  //------------------------------------------------------------------------------------------------
20  protected static ref TStringArray s_aVarsIn = {
21  PORT_VAR_IN
22  };
23  override TStringArray GetVariablesIn()
24  {
25  return s_aVarsIn;
26  }
27 
28  //------------------------------------------------------------------------------------------------
29  protected static ref TStringArray s_aVarsOut = {
30  PORT_VAR_OUT
31  };
32  override array<string> GetVariablesOut()
33  {
34  return s_aVarsOut;
35  }
36 
37  //------------------------------------------------------------------------------------------------
38  override void OnAbort(AIAgent owner, Node nodeCausingAbort)
39  {
40  if (m_bIncrementOnAbort)
41  {
42  int count;
43  GetVariableIn(PORT_VAR_IN, count);
44  count++;
45  if (m_sDebugMessage != string.Empty)
46  Print("DebugCounter: " + m_sDebugMessage);
47  SetVariableOut(PORT_VAR_OUT, count);
48  }
49  }
50 
51  //------------------------------------------------------------------------------------------------
52  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
53  {
54  if (m_bWaitOnAbort)
55  return ENodeResult.RUNNING;
56 
57  int count;
58  GetVariableIn(PORT_VAR_IN, count);
59  count++;
60  if (m_sDebugMessage != string.Empty)
61  Print("DebugCounter: " + m_sDebugMessage);
62  SetVariableOut(PORT_VAR_OUT, count);
63 
64  if (m_bFailAfter)
65  return ENodeResult.FAIL;
66 
67  return ENodeResult.SUCCESS;
68  }
69 
70  //------------------------------------------------------------------------------------------------
71  override bool VisibleInPalette()
72  {
73  return true;
74  }
75 
76  //------------------------------------------------------------------------------------------------
77  override protected bool CanReturnRunning()
78  {
79  return true;
80  }
81 
82  //------------------------------------------------------------------------------------------------
83  protected override string GetOnHoverDescription()
84  {
85  return "Increments variable for debug with configurable node behavior.";
86  }
87 
88  //------------------------------------------------------------------------------------------------
89  override string GetNodeMiddleText()
90  {
91  string text = "";
92  if (m_bIncrementOnAbort)
93  text = "Increment OnAbort\n";
94  if (m_bWaitOnAbort)
95  return text + "RUNNING";
96  if (m_bFailAfter)
97  return text + "FAILS";
98  else
99  return text + "SUCESS";
100  }
101 };
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
SCR_AIDebugCounter
Definition: SCR_AIDebugCounter.c:2
Attribute
typedef Attribute
Post-process effect of scripted camera.