Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIDebugTask.c
Go to the documentation of this file.
1 // base class for debug nodes. override PrintInternal in child class
2 class SCR_AIDebugTask : AITaskScripted
3 {
4  [Attribute("0", UIWidgets.CheckBox, "Message prefixed with ref to self")]
5  private bool m_bIncludeMe;
6 
7  [Attribute("", UIWidgets.EditBox, "Message to show")]
8  private string m_sDebugMessage;
9 
10  [Attribute("0", UIWidgets.CheckBox, "Fail node after print?")]
11  protected bool m_bFailAfter;
12 
13  static const string PORT_DEBUG_MESSAGE = "DebugMessage";
14 
15  //------------------------------------------------------------------------------------------------
16  protected static ref TStringArray s_aVarsIn = {
17  PORT_DEBUG_MESSAGE
18  };
19  override TStringArray GetVariablesIn()
20  {
21  return s_aVarsIn;
22  }
23 
24  // override this in child class
25  //------------------------------------------------------------------------------------------------
26  protected void PrintInternal(string in)
27  {
28  }
29 
30  //------------------------------------------------------------------------------------------------
31  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
32  {
33 //switch defines when neede to debug on server
34 //#ifdef AI_DEBUG
35 #ifdef WORKBENCH
36  string prefix;
37  if ( m_bIncludeMe )
38  prefix = owner.ToString() + ": ";
39  PrintInternal(prefix + m_sDebugMessage + SCR_AIGetStringFromPort(this, PORT_DEBUG_MESSAGE));
40 #endif
41  if (m_bFailAfter)
42  return ENodeResult.FAIL;
43  else
44  return ENodeResult.SUCCESS;
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  override bool VisibleInPalette()
49  {
50  return false;
51  }
52 
53  //------------------------------------------------------------------------------------------------
54  override string GetNodeMiddleText()
55  {
56  if (m_bFailAfter)
57  return "FAILS";
58  else
59  return "";
60  }
61 };
SCR_AIDebugTask
Definition: SCR_AIDebugTask.c:2
Attribute
typedef Attribute
Post-process effect of scripted camera.